Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa207f2e authored by Bill Lin's avatar Bill Lin
Browse files

3/ Add wmHelper to controll the state of test activity

* launchSplitScreen(wmHelper)
* reopenAppFromOverview(wmHelper)
* openQuickstep(wmHelper)
+ waitForActivityDestroyed()

Test: atest FlickerTests
Test: atest WMShellFlickerTests
Test: atest WindowManagerSmokeTest
Bug: 179116910
Change-Id: Ic050a255ebfe5bbe657af7383e5bbe90ca0d56a8
parent 0b4057f0
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.wm.shell.flicker.helpers

import android.app.Instrumentation
import android.content.ComponentName
import android.os.SystemClock
import com.android.wm.shell.flicker.testapp.Components

class SplitScreenHelper(
@@ -27,17 +26,6 @@ class SplitScreenHelper(
    componentsInfo: ComponentName
) : BaseAppHelper(instrumentation, activityLabel, componentsInfo) {

    /**
     * Reopens the first device window from the list of recent apps (overview)
     */
    fun reopenAppFromOverview() {
        val x = uiDevice.displayWidth / 2
        val y = uiDevice.displayHeight / 2
        uiDevice.click(x, y)
        // Wait for animation to complete.
        SystemClock.sleep(TIMEOUT_MS)
    }

    companion object {
        const val TEST_REPETITIONS = 1
        const val TIMEOUT_MS = 3_000L
+1 −1
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ class EnterSplitScreenDockActivity(
                }
                repeat { SplitScreenHelper.TEST_REPETITIONS }
                transitions {
                    device.launchSplitScreen()
                    device.launchSplitScreen(wmHelper)
                }
                assertions {
                    layersTrace {
+3 −2
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import com.android.server.wm.flicker.appWindowBecomesVisible
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.buildTestTag
import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.flicker.helpers.reopenAppFromOverview
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
import com.android.server.wm.flicker.startRotation
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
@@ -62,8 +63,8 @@ class EnterSplitScreenLaunchToSide(
                }
                repeat { SplitScreenHelper.TEST_REPETITIONS }
                transitions {
                    device.launchSplitScreen()
                    secondaryApp.reopenAppFromOverview()
                    device.launchSplitScreen(wmHelper)
                    device.reopenAppFromOverview(wmHelper)
                }
                assertions {
                    layersTrace {
+8 −3
Original line number Diff line number Diff line
@@ -60,10 +60,15 @@ class EnterSplitScreenNonResizableNotDock(
                    buildTestTag("testLegacySplitScreenNonResizeableActivityNotDock", configuration)
                }
                repeat { SplitScreenHelper.TEST_REPETITIONS }
                teardown {
                    eachRun {
                        nonResizeableApp.exit(wmHelper)
                    }
                }
                transitions {
                    nonResizeableApp.launchViaIntent(wmHelper)
                    device.openQuickstep()
                    if (device.canSplitScreen()) {
                    device.openQuickstep(wmHelper)
                    if (device.canSplitScreen(wmHelper)) {
                        Assert.fail("Non-resizeable app should not enter split screen")
                    }
                }
@@ -93,7 +98,7 @@ class EnterSplitScreenNonResizableNotDock(
                }
            }
            return FlickerTestRunnerFactory.getInstance().buildTest(
                instrumentation, defaultTransitionSetup, testSpec,
                instrumentation, cleanSetup, testSpec,
                repetitions = SplitScreenHelper.TEST_REPETITIONS,
                supportedRotations = listOf(Surface.ROTATION_0 /* bugId = 178685668 */))
        }
+11 −1
Original line number Diff line number Diff line
@@ -60,8 +60,18 @@ class ExitLegacySplitScreenFromBottom(
                    buildTestTag("testExitLegacySplitScreenFromBottom", configuration)
                }
                repeat { SplitScreenHelper.TEST_REPETITIONS }
                setup {
                    eachRun {
                        splitScreenApp.launchViaIntent(wmHelper)
                        device.launchSplitScreen(wmHelper)
                    }
                }
                teardown {
                    eachRun {
                        splitScreenApp.exit(wmHelper)
                    }
                }
                transitions {
                    device.launchSplitScreen()
                    device.exitSplitScreenFromBottom()
                }
                assertions {
Loading