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
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -62,7 +62,7 @@ class EnterSplitScreenDockActivity(
|
||||
}
|
||||
repeat { SplitScreenHelper.TEST_REPETITIONS }
|
||||
transitions {
|
||||
device.launchSplitScreen()
|
||||
device.launchSplitScreen(wmHelper)
|
||||
}
|
||||
assertions {
|
||||
layersTrace {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 */))
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.android.server.wm.flicker.appWindowBecomesInVisible
|
||||
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.layerBecomesInvisible
|
||||
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
|
||||
@@ -58,11 +59,18 @@ class ExitPrimarySplitScreenShowSecondaryFullscreen(
|
||||
buildTestTag("testExitPrimarySplitScreenShowSecondaryFullscreen", configuration)
|
||||
}
|
||||
repeat { SplitScreenHelper.TEST_REPETITIONS }
|
||||
teardown {
|
||||
eachRun {
|
||||
secondaryApp.exit(wmHelper)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
device.launchSplitScreen()
|
||||
secondaryApp.reopenAppFromOverview()
|
||||
splitScreenApp.launchViaIntent(wmHelper)
|
||||
secondaryApp.launchViaIntent(wmHelper)
|
||||
device.launchSplitScreen(wmHelper)
|
||||
device.reopenAppFromOverview(wmHelper)
|
||||
// TODO(b/175687842) Can not find Split screen divider, use exit() instead
|
||||
splitScreenApp.exit()
|
||||
splitScreenApp.exit(wmHelper)
|
||||
}
|
||||
assertions {
|
||||
layersTrace {
|
||||
|
||||
@@ -80,13 +80,12 @@ class LegacySplitScreenToLauncher(
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
device.openQuickStepAndClearRecentAppsFromOverview()
|
||||
device.openQuickStepAndClearRecentAppsFromOverview(wmHelper)
|
||||
}
|
||||
eachRun {
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
this.setRotation(configuration.endRotation)
|
||||
device.launchSplitScreen()
|
||||
device.waitForIdle()
|
||||
device.launchSplitScreen(wmHelper)
|
||||
}
|
||||
}
|
||||
teardown {
|
||||
|
||||
@@ -21,7 +21,10 @@ import android.os.Bundle
|
||||
import android.support.test.launcherhelper.LauncherStrategyFactory
|
||||
import android.view.Surface
|
||||
import com.android.server.wm.flicker.dsl.FlickerBuilder
|
||||
import com.android.server.wm.flicker.helpers.exitSplitScreen
|
||||
import com.android.server.wm.flicker.helpers.isInSplitScreen
|
||||
import com.android.server.wm.flicker.helpers.openQuickStepAndClearRecentAppsFromOverview
|
||||
import com.android.server.wm.flicker.helpers.openQuickstep
|
||||
import com.android.server.wm.flicker.helpers.setRotation
|
||||
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
|
||||
import com.android.server.wm.flicker.startRotation
|
||||
@@ -46,7 +49,7 @@ abstract class LegacySplitScreenTransition(
|
||||
setup {
|
||||
eachRun {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
device.openQuickStepAndClearRecentAppsFromOverview()
|
||||
device.openQuickStepAndClearRecentAppsFromOverview(wmHelper)
|
||||
secondaryApp.launchViaIntent(wmHelper)
|
||||
splitScreenApp.launchViaIntent(wmHelper)
|
||||
this.setRotation(configuration.startRotation)
|
||||
@@ -54,8 +57,12 @@ abstract class LegacySplitScreenTransition(
|
||||
}
|
||||
teardown {
|
||||
eachRun {
|
||||
splitScreenApp.exit()
|
||||
secondaryApp.exit()
|
||||
// TODO(b/175687842) Workaround for exit legacy split screen
|
||||
device.openQuickstep(wmHelper)
|
||||
if (device.isInSplitScreen()) {
|
||||
device.exitSplitScreen()
|
||||
}
|
||||
device.pressHome()
|
||||
this.setRotation(Surface.ROTATION_0)
|
||||
}
|
||||
}
|
||||
@@ -66,13 +73,18 @@ abstract class LegacySplitScreenTransition(
|
||||
setup {
|
||||
eachRun {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
device.openQuickStepAndClearRecentAppsFromOverview()
|
||||
device.openQuickStepAndClearRecentAppsFromOverview(wmHelper)
|
||||
this.setRotation(configuration.startRotation)
|
||||
}
|
||||
}
|
||||
teardown {
|
||||
eachRun {
|
||||
nonResizeableApp.exit()
|
||||
// TODO(b/175687842) Workaround for exit legacy split screen
|
||||
device.openQuickstep(wmHelper)
|
||||
if (device.isInSplitScreen()) {
|
||||
device.exitSplitScreen()
|
||||
}
|
||||
device.pressHome()
|
||||
this.setRotation(Surface.ROTATION_0)
|
||||
}
|
||||
}
|
||||
@@ -83,15 +95,19 @@ abstract class LegacySplitScreenTransition(
|
||||
setup {
|
||||
eachRun {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
device.openQuickStepAndClearRecentAppsFromOverview()
|
||||
device.openQuickStepAndClearRecentAppsFromOverview(wmHelper)
|
||||
secondaryApp.launchViaIntent(wmHelper)
|
||||
splitScreenApp.launchViaIntent(wmHelper)
|
||||
}
|
||||
}
|
||||
teardown {
|
||||
eachRun {
|
||||
splitScreenApp.exit()
|
||||
secondaryApp.exit()
|
||||
// TODO(b/175687842) Workaround for exit legacy split screen
|
||||
device.openQuickstep(wmHelper)
|
||||
if (device.isInSplitScreen()) {
|
||||
device.exitSplitScreen()
|
||||
}
|
||||
device.pressHome()
|
||||
this.setRotation(Surface.ROTATION_0)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,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.layerBecomesInvisible
|
||||
import com.android.server.wm.flicker.layerBecomesVisible
|
||||
import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry
|
||||
@@ -60,12 +61,15 @@ class NonResizableDismissInLegacySplitScreen(
|
||||
buildTestTag("testNonResizableDismissInLegacySplitScreen", configuration)
|
||||
}
|
||||
repeat { SplitScreenHelper.TEST_REPETITIONS }
|
||||
setup {
|
||||
eachRun {
|
||||
nonResizeableApp.launchViaIntent(wmHelper)
|
||||
splitScreenApp.launchViaIntent(wmHelper)
|
||||
device.launchSplitScreen(wmHelper)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
nonResizeableApp.launchViaIntent(wmHelper)
|
||||
splitScreenApp.launchViaIntent(wmHelper)
|
||||
device.launchSplitScreen()
|
||||
nonResizeableApp.reopenAppFromOverview()
|
||||
wmHelper.waitForAppTransitionIdle()
|
||||
device.reopenAppFromOverview(wmHelper)
|
||||
}
|
||||
assertions {
|
||||
layersTrace {
|
||||
|
||||
@@ -60,9 +60,13 @@ class NonResizableLaunchInLegacySplitScreen(
|
||||
buildTestTag("testNonResizableLaunchInLegacySplitScreen", configuration)
|
||||
}
|
||||
repeat { SplitScreenHelper.TEST_REPETITIONS }
|
||||
setup {
|
||||
eachRun {
|
||||
splitScreenApp.launchViaIntent(wmHelper)
|
||||
device.launchSplitScreen(wmHelper)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
splitScreenApp.launchViaIntent(wmHelper)
|
||||
device.launchSplitScreen()
|
||||
nonResizeableApp.launchViaIntent(wmHelper)
|
||||
wmHelper.waitForAppTransitionIdle()
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class OpenAppToLegacySplitScreen(
|
||||
}
|
||||
repeat { SplitScreenHelper.TEST_REPETITIONS }
|
||||
transitions {
|
||||
device.launchSplitScreen()
|
||||
device.launchSplitScreen(wmHelper)
|
||||
wmHelper.waitForAppTransitionIdle()
|
||||
}
|
||||
assertions {
|
||||
|
||||
@@ -100,7 +100,7 @@ class ResizeLegacySplitScreen(
|
||||
device.pressHome()
|
||||
testAppTop.launchViaIntent(wmHelper)
|
||||
device.waitForIdle()
|
||||
device.launchSplitScreen()
|
||||
device.launchSplitScreen(wmHelper)
|
||||
val snapshot =
|
||||
device.findObject(By.res(device.launcherPackageName, "snapshot"))
|
||||
snapshot.click()
|
||||
|
||||
@@ -63,7 +63,7 @@ class RotateOneLaunchedAppAndEnterSplitScreen(
|
||||
}
|
||||
repeat { SplitScreenHelper.TEST_REPETITIONS }
|
||||
transitions {
|
||||
device.launchSplitScreen()
|
||||
device.launchSplitScreen(wmHelper)
|
||||
this.setRotation(configuration.startRotation)
|
||||
}
|
||||
assertions {
|
||||
|
||||
@@ -64,7 +64,7 @@ class RotateOneLaunchedAppInSplitScreenMode(
|
||||
repeat { SplitScreenHelper.TEST_REPETITIONS }
|
||||
transitions {
|
||||
this.setRotation(configuration.startRotation)
|
||||
device.launchSplitScreen()
|
||||
device.launchSplitScreen(wmHelper)
|
||||
}
|
||||
assertions {
|
||||
layersTrace {
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.android.server.wm.flicker.dsl.FlickerBuilder
|
||||
import com.android.server.wm.flicker.endRotation
|
||||
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.helpers.setRotation
|
||||
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
|
||||
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
|
||||
@@ -65,8 +66,8 @@ class RotateTwoLaunchedAppAndEnterSplitScreen(
|
||||
repeat { SplitScreenHelper.TEST_REPETITIONS }
|
||||
transitions {
|
||||
this.setRotation(configuration.startRotation)
|
||||
device.launchSplitScreen()
|
||||
secondaryApp.reopenAppFromOverview()
|
||||
device.launchSplitScreen(wmHelper)
|
||||
device.reopenAppFromOverview(wmHelper)
|
||||
}
|
||||
assertions {
|
||||
layersTrace {
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.android.server.wm.flicker.dsl.FlickerBuilder
|
||||
import com.android.server.wm.flicker.endRotation
|
||||
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.helpers.setRotation
|
||||
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
|
||||
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
|
||||
@@ -65,8 +66,8 @@ class RotateTwoLaunchedAppInSplitScreenMode(
|
||||
repeat { SplitScreenHelper.TEST_REPETITIONS }
|
||||
setup {
|
||||
eachRun {
|
||||
device.launchSplitScreen()
|
||||
splitScreenApp.reopenAppFromOverview()
|
||||
device.launchSplitScreen(wmHelper)
|
||||
device.reopenAppFromOverview(wmHelper)
|
||||
this.setRotation(configuration.startRotation)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ class PipLegacySplitScreenTest(
|
||||
}
|
||||
transitions {
|
||||
testApp.launchViaIntent()
|
||||
device.launchSplitScreen()
|
||||
device.launchSplitScreen(wmHelper)
|
||||
imeApp.launchViaIntent()
|
||||
waitForAnimationComplete()
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ class ReOpenImeWindowTest(
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
device.reopenAppFromOverview()
|
||||
device.reopenAppFromOverview(wmHelper)
|
||||
wmHelper.waitImeWindowShown()
|
||||
}
|
||||
teardown {
|
||||
|
||||
@@ -81,7 +81,7 @@ class OpenAppFromOverviewTest(
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
device.reopenAppFromOverview()
|
||||
device.reopenAppFromOverview(wmHelper)
|
||||
wmHelper.waitForFullScreenApp(testApp.component)
|
||||
}
|
||||
teardown {
|
||||
|
||||
Reference in New Issue
Block a user