1/ Refactor LegacySplitScreenTests
1) Separate NonResizable activity tests 2) Fix flaky in visibleWindowsShownMoreThanOneConsecutiveEntry 3) Fix flaky in OpenAppToLegacySplitScreenTest 4) Align implementation of ExitLegacySplitScreenFromBottomTest Test: atest WMShellFlickerTests Bug: 176897747 Bug: 176923301 Bug: 176134495 Change-Id: I1e3efdbb1645f6d1a77950101e2c9f5b34856a2f
This commit is contained in:
@@ -43,6 +43,18 @@ fun LayersAssertion.appPairsDividerIsInvisible(
|
||||
}
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun LayersAssertion.appPairsDividerBecomesVisible(
|
||||
bugId: Int = 0,
|
||||
enabled: Boolean = bugId == 0
|
||||
) {
|
||||
all("dividerLayerBecomesVisible") {
|
||||
this.hidesLayer(FlickerTestBase.DOCKED_STACK_DIVIDER)
|
||||
.then()
|
||||
.showsLayer(FlickerTestBase.DOCKED_STACK_DIVIDER)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun LayersAssertion.dockedStackDividerIsVisible(
|
||||
bugId: Int = 0,
|
||||
|
||||
@@ -21,7 +21,6 @@ import android.view.Surface
|
||||
import androidx.test.filters.RequiresDevice
|
||||
import com.android.server.wm.flicker.dsl.FlickerBuilder
|
||||
import com.android.server.wm.flicker.dsl.runWithFlicker
|
||||
import com.android.server.wm.flicker.helpers.WindowUtils
|
||||
import com.android.server.wm.flicker.helpers.canSplitScreen
|
||||
import com.android.server.wm.flicker.helpers.exitSplitScreen
|
||||
import com.android.server.wm.flicker.helpers.isInSplitScreen
|
||||
@@ -35,6 +34,7 @@ import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
|
||||
|
||||
import com.android.wm.shell.flicker.dockedStackPrimaryBoundsIsVisible
|
||||
import com.android.wm.shell.flicker.dockedStackSecondaryBoundsIsVisible
|
||||
import org.junit.Assert
|
||||
@@ -59,8 +59,6 @@ class EnterLegacySplitScreenTest(
|
||||
rotationName: String,
|
||||
rotation: Int
|
||||
) : SplitScreenTestBase(rotationName, rotation) {
|
||||
private val letterBox = "Letterbox"
|
||||
|
||||
private val splitScreenSetup: FlickerBuilder
|
||||
get() = FlickerBuilder(instrumentation).apply {
|
||||
val testLaunchActivity = "launch_splitScreen_test_activity"
|
||||
@@ -91,7 +89,6 @@ class EnterLegacySplitScreenTest(
|
||||
windowManagerTrace {
|
||||
navBarWindowIsAlwaysVisible()
|
||||
statusBarWindowIsAlwaysVisible()
|
||||
visibleWindowsShownMoreThanOneConsecutiveEntry(listOf(launcherPackageName))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -114,7 +111,8 @@ class EnterLegacySplitScreenTest(
|
||||
rotation, splitScreenApp.defaultWindowName, 169271943)
|
||||
dockedStackDividerBecomesVisible()
|
||||
visibleLayersShownMoreThanOneConsecutiveEntry(
|
||||
listOf(launcherPackageName, splitScreenApp.defaultWindowName)
|
||||
listOf(LAUNCHER_PACKAGE_NAME, splitScreenApp.defaultWindowName,
|
||||
LIVE_WALLPAPER_PACKAGE_NAME)
|
||||
)
|
||||
}
|
||||
windowManagerTrace {
|
||||
@@ -148,7 +146,7 @@ class EnterLegacySplitScreenTest(
|
||||
rotation, secondaryApp.defaultWindowName, 169271943)
|
||||
dockedStackDividerBecomesVisible()
|
||||
visibleLayersShownMoreThanOneConsecutiveEntry(
|
||||
listOf(launcherPackageName, splitScreenApp.defaultWindowName,
|
||||
listOf(LAUNCHER_PACKAGE_NAME, splitScreenApp.defaultWindowName,
|
||||
secondaryApp.defaultWindowName)
|
||||
)
|
||||
}
|
||||
@@ -157,6 +155,7 @@ class EnterLegacySplitScreenTest(
|
||||
showsAppWindow(splitScreenApp.defaultWindowName)
|
||||
.and().showsAppWindow(secondaryApp.defaultWindowName)
|
||||
}
|
||||
visibleWindowsShownMoreThanOneConsecutiveEntry(listOf(LAUNCHER_PACKAGE_NAME))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -181,85 +180,14 @@ class EnterLegacySplitScreenTest(
|
||||
layersTrace {
|
||||
dockedStackDividerIsInvisible()
|
||||
visibleLayersShownMoreThanOneConsecutiveEntry(
|
||||
listOf(launcherPackageName, nonResizeableApp.defaultWindowName)
|
||||
listOf(LAUNCHER_PACKAGE_NAME, nonResizeableApp.defaultWindowName)
|
||||
)
|
||||
}
|
||||
windowManagerTrace {
|
||||
end {
|
||||
hidesAppWindow(nonResizeableApp.defaultWindowName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testNonResizeableWhenAlreadyInSplitScreenPrimary() {
|
||||
val testTag = "testNonResizeableWhenAlreadyInSplitScreenPrimary"
|
||||
runWithFlicker(splitScreenSetup) {
|
||||
withTestName { testTag }
|
||||
repeat {
|
||||
TEST_REPETITIONS
|
||||
}
|
||||
transitions {
|
||||
nonResizeableApp.launchViaIntent()
|
||||
splitScreenApp.launchViaIntent()
|
||||
uiDevice.launchSplitScreen()
|
||||
nonResizeableApp.reopenAppFromOverview()
|
||||
}
|
||||
assertions {
|
||||
layersTrace {
|
||||
dockedStackDividerIsInvisible()
|
||||
end("appsEndingBounds", enabled = false) {
|
||||
val displayBounds = WindowUtils.getDisplayBounds(rotation)
|
||||
this.hasVisibleRegion(nonResizeableApp.defaultWindowName, displayBounds)
|
||||
}
|
||||
visibleLayersShownMoreThanOneConsecutiveEntry(
|
||||
listOf(launcherPackageName, splitScreenApp.defaultWindowName,
|
||||
nonResizeableApp.defaultWindowName, letterBox)
|
||||
)
|
||||
}
|
||||
windowManagerTrace {
|
||||
end {
|
||||
showsAppWindow(nonResizeableApp.defaultWindowName)
|
||||
hidesAppWindow(splitScreenApp.defaultWindowName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testNonResizeableWhenAlreadyInSplitScreenSecondary() {
|
||||
val testTag = "testNonResizeableWhenAlreadyInSplitScreenSecondary"
|
||||
runWithFlicker(splitScreenSetup) {
|
||||
withTestName { testTag }
|
||||
repeat {
|
||||
TEST_REPETITIONS
|
||||
}
|
||||
transitions {
|
||||
splitScreenApp.launchViaIntent()
|
||||
uiDevice.launchSplitScreen()
|
||||
uiDevice.pressBack()
|
||||
nonResizeableApp.launchViaIntent()
|
||||
}
|
||||
assertions {
|
||||
layersTrace {
|
||||
dockedStackDividerIsInvisible()
|
||||
end("appsEndingBounds", enabled = false) {
|
||||
val displayBounds = WindowUtils.getDisplayBounds(rotation)
|
||||
this.hasVisibleRegion(nonResizeableApp.defaultWindowName, displayBounds)
|
||||
}
|
||||
visibleLayersShownMoreThanOneConsecutiveEntry(
|
||||
listOf(launcherPackageName, splitScreenApp.defaultWindowName,
|
||||
nonResizeableApp.defaultWindowName, letterBox)
|
||||
)
|
||||
}
|
||||
windowManagerTrace {
|
||||
end {
|
||||
showsAppWindow(nonResizeableApp.defaultWindowName)
|
||||
hidesAppWindow(splitScreenApp.defaultWindowName)
|
||||
}
|
||||
visibleWindowsShownMoreThanOneConsecutiveEntry(listOf(LAUNCHER_PACKAGE_NAME))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,16 +22,20 @@ import androidx.test.platform.app.InstrumentationRegistry
|
||||
import com.android.server.wm.flicker.Flicker
|
||||
import com.android.server.wm.flicker.FlickerTestRunner
|
||||
import com.android.server.wm.flicker.FlickerTestRunnerFactory
|
||||
import com.android.server.wm.flicker.helpers.StandardAppHelper
|
||||
import com.android.server.wm.flicker.endRotation
|
||||
import com.android.server.wm.flicker.helpers.buildTestTag
|
||||
import com.android.server.wm.flicker.helpers.exitSplitScreen
|
||||
import com.android.server.wm.flicker.helpers.exitSplitScreenFromBottom
|
||||
import com.android.server.wm.flicker.helpers.isInSplitScreen
|
||||
import com.android.server.wm.flicker.helpers.launchSplitScreen
|
||||
import com.android.server.wm.flicker.helpers.openQuickStepAndClearRecentAppsFromOverview
|
||||
import com.android.server.wm.flicker.helpers.setRotation
|
||||
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
|
||||
|
||||
import com.android.server.wm.flicker.repetitions
|
||||
import com.android.wm.shell.flicker.TEST_APP_SPLITSCREEN_PRIMARY_LABEL
|
||||
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
|
||||
import com.android.wm.shell.flicker.testapp.Components
|
||||
import org.junit.FixMethodOrder
|
||||
import org.junit.runner.RunWith
|
||||
import org.junit.runners.MethodSorters
|
||||
@@ -53,23 +57,24 @@ class ExitLegacySplitScreenFromBottomTest(
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<Array<Any>> {
|
||||
val instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
val testApp = StandardAppHelper(instrumentation,
|
||||
"com.android.wm.shell.flicker.testapp", "SimpleApp")
|
||||
val splitScreenApp = SplitScreenHelper(instrumentation,
|
||||
TEST_APP_SPLITSCREEN_PRIMARY_LABEL,
|
||||
Components.SplitScreenActivity())
|
||||
|
||||
// b/161435597 causes the test not to work on 90 degrees
|
||||
return FlickerTestRunnerFactory(instrumentation, listOf(Surface.ROTATION_0))
|
||||
// TODO(b/162923992) Use of multiple segments of flicker spec for testing
|
||||
return FlickerTestRunnerFactory(instrumentation,
|
||||
listOf(Surface.ROTATION_0, Surface.ROTATION_90))
|
||||
.buildTest { configuration ->
|
||||
withTestName {
|
||||
buildTestTag("exitSplitScreenFromBottom", testApp,
|
||||
buildTestTag("exitSplitScreenFromBottom", splitScreenApp,
|
||||
configuration)
|
||||
}
|
||||
repeat { configuration.repetitions }
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
}
|
||||
eachRun {
|
||||
testApp.open()
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
device.openQuickStepAndClearRecentAppsFromOverview()
|
||||
splitScreenApp.launchViaIntent()
|
||||
device.launchSplitScreen()
|
||||
device.waitForIdle()
|
||||
this.setRotation(configuration.endRotation)
|
||||
@@ -77,12 +82,10 @@ class ExitLegacySplitScreenFromBottomTest(
|
||||
}
|
||||
teardown {
|
||||
eachRun {
|
||||
testApp.exit()
|
||||
}
|
||||
test {
|
||||
if (device.isInSplitScreen()) {
|
||||
device.exitSplitScreen()
|
||||
}
|
||||
splitScreenApp.exit()
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
|
||||
@@ -82,7 +82,7 @@ class ExitLegacySplitScreenTest(
|
||||
}
|
||||
layersTrace {
|
||||
visibleLayersShownMoreThanOneConsecutiveEntry(
|
||||
listOf(launcherPackageName))
|
||||
listOf(LAUNCHER_PACKAGE_NAME))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.wm.shell.flicker.legacysplitscreen
|
||||
|
||||
import android.view.Surface
|
||||
import androidx.test.filters.RequiresDevice
|
||||
import com.android.server.wm.flicker.dsl.runWithFlicker
|
||||
import com.android.server.wm.flicker.helpers.WindowUtils
|
||||
import com.android.server.wm.flicker.helpers.launchSplitScreen
|
||||
import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry
|
||||
import com.android.wm.shell.flicker.dockedStackDividerIsInvisible
|
||||
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
|
||||
import org.junit.FixMethodOrder
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.junit.runners.MethodSorters
|
||||
import org.junit.runners.Parameterized
|
||||
|
||||
/**
|
||||
* Test open app to split screen.
|
||||
* To run this test: `atest WMShellFlickerTests:NonResizableDismissInLegacySplitScreenTest`
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
class NonResizableDismissInLegacySplitScreenTest(
|
||||
rotationName: String,
|
||||
rotation: Int
|
||||
) : SplitScreenTestBase(rotationName, rotation) {
|
||||
|
||||
@Test
|
||||
fun testNonResizableDismissInLegacySplitScreenTest() {
|
||||
val testTag = "testNonResizableDismissInLegacySplitScreenTest"
|
||||
|
||||
runWithFlicker(transitionSetup) {
|
||||
withTestName { testTag }
|
||||
repeat { SplitScreenHelper.TEST_REPETITIONS }
|
||||
transitions {
|
||||
nonResizeableApp.launchViaIntent()
|
||||
splitScreenApp.launchViaIntent()
|
||||
device.launchSplitScreen()
|
||||
nonResizeableApp.reopenAppFromOverview()
|
||||
}
|
||||
assertions {
|
||||
layersTrace {
|
||||
dockedStackDividerIsInvisible()
|
||||
end("appsEndingBounds", enabled = false) {
|
||||
val displayBounds = WindowUtils.getDisplayBounds(rotation)
|
||||
this.hasVisibleRegion(nonResizeableApp.defaultWindowName, displayBounds)
|
||||
}
|
||||
visibleLayersShownMoreThanOneConsecutiveEntry(
|
||||
listOf(LAUNCHER_PACKAGE_NAME, splitScreenApp.defaultWindowName,
|
||||
nonResizeableApp.defaultWindowName, LETTER_BOX_NAME)
|
||||
)
|
||||
}
|
||||
windowManagerTrace {
|
||||
end {
|
||||
showsAppWindow(nonResizeableApp.defaultWindowName)
|
||||
hidesAppWindow(splitScreenApp.defaultWindowName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<Array<Any>> {
|
||||
val supportedRotations = intArrayOf(Surface.ROTATION_0, Surface.ROTATION_90)
|
||||
return supportedRotations.map { arrayOf(Surface.rotationToString(it), it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.wm.shell.flicker.legacysplitscreen
|
||||
|
||||
import android.view.Surface
|
||||
import androidx.test.filters.RequiresDevice
|
||||
import com.android.server.wm.flicker.dsl.runWithFlicker
|
||||
import com.android.server.wm.flicker.helpers.WindowUtils
|
||||
import com.android.server.wm.flicker.helpers.launchSplitScreen
|
||||
import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry
|
||||
import com.android.wm.shell.flicker.dockedStackDividerIsInvisible
|
||||
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
|
||||
import org.junit.FixMethodOrder
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.junit.runners.MethodSorters
|
||||
import org.junit.runners.Parameterized
|
||||
|
||||
/**
|
||||
* Test open app to split screen.
|
||||
* To run this test: `atest WMShellFlickerTests:NonResizableLaunchInLegacySplitScreenTest`
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
class NonResizableLaunchInLegacySplitScreenTest(
|
||||
rotationName: String,
|
||||
rotation: Int
|
||||
) : SplitScreenTestBase(rotationName, rotation) {
|
||||
|
||||
@Test
|
||||
fun testNonResizableLaunchInLegacySplitScreenTest() {
|
||||
val testTag = "NonResizableLaunchInLegacySplitScreenTest"
|
||||
|
||||
runWithFlicker(transitionSetup) {
|
||||
withTestName { testTag }
|
||||
repeat { SplitScreenHelper.TEST_REPETITIONS }
|
||||
transitions {
|
||||
nonResizeableApp.launchViaIntent()
|
||||
splitScreenApp.launchViaIntent()
|
||||
device.launchSplitScreen()
|
||||
nonResizeableApp.reopenAppFromOverview()
|
||||
}
|
||||
assertions {
|
||||
layersTrace {
|
||||
dockedStackDividerIsInvisible()
|
||||
end("appsEndingBounds", enabled = false) {
|
||||
val displayBounds = WindowUtils.getDisplayBounds(rotation)
|
||||
this.hasVisibleRegion(nonResizeableApp.defaultWindowName, displayBounds)
|
||||
}
|
||||
visibleLayersShownMoreThanOneConsecutiveEntry(
|
||||
listOf(LAUNCHER_PACKAGE_NAME, splitScreenApp.defaultWindowName,
|
||||
nonResizeableApp.defaultWindowName, LETTER_BOX_NAME)
|
||||
)
|
||||
}
|
||||
windowManagerTrace {
|
||||
end {
|
||||
showsAppWindow(nonResizeableApp.defaultWindowName)
|
||||
hidesAppWindow(splitScreenApp.defaultWindowName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<Array<Any>> {
|
||||
val supportedRotations = intArrayOf(Surface.ROTATION_0, Surface.ROTATION_90)
|
||||
return supportedRotations.map { arrayOf(Surface.rotationToString(it), it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,37 +17,22 @@
|
||||
package com.android.wm.shell.flicker.legacysplitscreen
|
||||
|
||||
import android.platform.test.annotations.Presubmit
|
||||
import android.support.test.launcherhelper.LauncherStrategyFactory
|
||||
import android.view.Surface
|
||||
import androidx.test.filters.RequiresDevice
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import com.android.server.wm.flicker.Flicker
|
||||
import com.android.server.wm.flicker.FlickerTestRunner
|
||||
import com.android.server.wm.flicker.FlickerTestRunnerFactory
|
||||
import com.android.server.wm.flicker.helpers.StandardAppHelper
|
||||
import com.android.server.wm.flicker.endRotation
|
||||
import com.android.server.wm.flicker.focusChanges
|
||||
import com.android.server.wm.flicker.helpers.buildTestTag
|
||||
import com.android.server.wm.flicker.helpers.exitSplitScreen
|
||||
import com.android.server.wm.flicker.helpers.isInSplitScreen
|
||||
import com.android.server.wm.flicker.helpers.launchSplitScreen
|
||||
import com.android.server.wm.flicker.helpers.openQuickStepAndClearRecentAppsFromOverview
|
||||
import com.android.server.wm.flicker.helpers.setRotation
|
||||
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
|
||||
import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
|
||||
import com.android.server.wm.flicker.appWindowBecomesVisible
|
||||
import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry
|
||||
import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry
|
||||
import com.android.server.wm.flicker.layerBecomesVisible
|
||||
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.focusChanges
|
||||
import com.android.server.wm.flicker.helpers.launchSplitScreen
|
||||
import com.android.server.wm.flicker.dsl.runWithFlicker
|
||||
import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.noUncoveredRegions
|
||||
import com.android.server.wm.flicker.repetitions
|
||||
import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.statusBarLayerRotatesScales
|
||||
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
|
||||
import com.android.wm.shell.flicker.dockedStackDividerBecomesVisible
|
||||
import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry
|
||||
import com.android.wm.shell.flicker.appPairsDividerBecomesVisible
|
||||
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
|
||||
import org.junit.FixMethodOrder
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.junit.runners.MethodSorters
|
||||
import org.junit.runners.Parameterized
|
||||
@@ -56,85 +41,59 @@ import org.junit.runners.Parameterized
|
||||
* Test open app to split screen.
|
||||
* To run this test: `atest WMShellFlickerTests:OpenAppToLegacySplitScreenTest`
|
||||
*/
|
||||
@Presubmit
|
||||
// TODO: Add back to pre-submit when stable.
|
||||
//@Presubmit
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
class OpenAppToLegacySplitScreenTest(
|
||||
testName: String,
|
||||
flickerSpec: Flicker
|
||||
) : FlickerTestRunner(testName, flickerSpec) {
|
||||
rotationName: String,
|
||||
rotation: Int
|
||||
) : SplitScreenTestBase(rotationName, rotation) {
|
||||
@Test
|
||||
fun OpenAppToLegacySplitScreenTest() {
|
||||
val testTag = "OpenAppToLegacySplitScreenTest"
|
||||
|
||||
runWithFlicker(transitionSetup) {
|
||||
withTestName { testTag }
|
||||
repeat { SplitScreenHelper.TEST_REPETITIONS }
|
||||
transitions {
|
||||
splitScreenApp.launchViaIntent()
|
||||
device.pressHome()
|
||||
this.setRotation(rotation)
|
||||
device.launchSplitScreen()
|
||||
}
|
||||
assertions {
|
||||
windowManagerTrace {
|
||||
visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||
appWindowBecomesVisible(splitScreenApp.getPackage())
|
||||
}
|
||||
|
||||
layersTrace {
|
||||
navBarLayerIsAlwaysVisible(bugId = 140855415)
|
||||
noUncoveredRegions(rotation, enabled = false)
|
||||
statusBarLayerIsAlwaysVisible(bugId = 140855415)
|
||||
visibleLayersShownMoreThanOneConsecutiveEntry(
|
||||
listOf(LAUNCHER_PACKAGE_NAME))
|
||||
appPairsDividerBecomesVisible()
|
||||
layerBecomesVisible(splitScreenApp.getPackage())
|
||||
}
|
||||
|
||||
eventLog {
|
||||
focusChanges(splitScreenApp.`package`,
|
||||
"recents_animation_input_consumer", "NexusLauncherActivity",
|
||||
bugId = 151179149)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<Array<Any>> {
|
||||
val instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
val launcherPackageName = LauncherStrategyFactory.getInstance(instrumentation)
|
||||
.launcherStrategy.supportedLauncherPackage
|
||||
val testApp = StandardAppHelper(instrumentation,
|
||||
"com.android.wm.shell.flicker.testapp", "SimpleApp")
|
||||
|
||||
// b/161435597 causes the test not to work on 90 degrees
|
||||
return FlickerTestRunnerFactory(instrumentation, listOf(Surface.ROTATION_0))
|
||||
.buildTest { configuration ->
|
||||
withTestName {
|
||||
buildTestTag("appToSplitScreen", testApp, configuration)
|
||||
}
|
||||
repeat { configuration.repetitions }
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
device.openQuickStepAndClearRecentAppsFromOverview()
|
||||
}
|
||||
eachRun {
|
||||
testApp.open()
|
||||
device.pressHome()
|
||||
this.setRotation(configuration.endRotation)
|
||||
}
|
||||
}
|
||||
teardown {
|
||||
eachRun {
|
||||
if (device.isInSplitScreen()) {
|
||||
device.exitSplitScreen()
|
||||
}
|
||||
}
|
||||
test {
|
||||
testApp.exit()
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
device.launchSplitScreen()
|
||||
}
|
||||
assertions {
|
||||
windowManagerTrace {
|
||||
navBarWindowIsAlwaysVisible()
|
||||
statusBarWindowIsAlwaysVisible()
|
||||
visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
appWindowBecomesVisible(testApp.getPackage())
|
||||
}
|
||||
|
||||
layersTrace {
|
||||
navBarLayerIsAlwaysVisible(bugId = 140855415)
|
||||
statusBarLayerIsAlwaysVisible()
|
||||
noUncoveredRegions(configuration.endRotation, enabled = false)
|
||||
navBarLayerRotatesAndScales(configuration.endRotation,
|
||||
bugId = 140855415)
|
||||
statusBarLayerRotatesScales(configuration.endRotation)
|
||||
visibleLayersShownMoreThanOneConsecutiveEntry(
|
||||
listOf(launcherPackageName))
|
||||
|
||||
dockedStackDividerBecomesVisible()
|
||||
layerBecomesVisible(testApp.getPackage())
|
||||
}
|
||||
|
||||
eventLog {
|
||||
focusChanges(testApp.`package`,
|
||||
"recents_animation_input_consumer", "NexusLauncherActivity",
|
||||
bugId = 151179149)
|
||||
}
|
||||
}
|
||||
}
|
||||
val supportedRotations = intArrayOf(Surface.ROTATION_0, Surface.ROTATION_90)
|
||||
return supportedRotations.map { arrayOf(Surface.rotationToString(it), it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,15 @@
|
||||
package com.android.wm.shell.flicker.legacysplitscreen
|
||||
|
||||
import android.support.test.launcherhelper.LauncherStrategyFactory
|
||||
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.wakeUpAndGoToHomeScreen
|
||||
import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
|
||||
import com.android.wm.shell.flicker.NonRotationTestBase
|
||||
import com.android.wm.shell.flicker.TEST_APP_NONRESIZEABLE_LABEL
|
||||
import com.android.wm.shell.flicker.TEST_APP_SPLITSCREEN_PRIMARY_LABEL
|
||||
@@ -37,6 +46,39 @@ abstract class SplitScreenTestBase(
|
||||
protected val nonResizeableApp = SplitScreenHelper(instrumentation,
|
||||
TEST_APP_NONRESIZEABLE_LABEL,
|
||||
Components.NonResizeableActivity())
|
||||
protected val launcherPackageName = LauncherStrategyFactory.getInstance(instrumentation)
|
||||
|
||||
protected val LAUNCHER_PACKAGE_NAME = LauncherStrategyFactory.getInstance(instrumentation)
|
||||
.launcherStrategy.supportedLauncherPackage
|
||||
protected val LIVE_WALLPAPER_PACKAGE_NAME =
|
||||
"com.breel.wallpapers18.soundviz.wallpaper.variations.SoundVizWallpaperV2"
|
||||
protected val LETTER_BOX_NAME = "Letterbox"
|
||||
|
||||
protected val transitionSetup: FlickerBuilder
|
||||
get() = FlickerBuilder(instrumentation).apply {
|
||||
setup {
|
||||
eachRun {
|
||||
uiDevice.wakeUpAndGoToHomeScreen()
|
||||
uiDevice.openQuickStepAndClearRecentAppsFromOverview()
|
||||
}
|
||||
}
|
||||
teardown {
|
||||
eachRun {
|
||||
if (uiDevice.isInSplitScreen()) {
|
||||
uiDevice.exitSplitScreen()
|
||||
}
|
||||
splitScreenApp.exit()
|
||||
nonResizeableApp.exit()
|
||||
}
|
||||
}
|
||||
assertions {
|
||||
layersTrace {
|
||||
navBarLayerIsAlwaysVisible()
|
||||
statusBarLayerIsAlwaysVisible()
|
||||
}
|
||||
windowManagerTrace {
|
||||
navBarWindowIsAlwaysVisible()
|
||||
statusBarWindowIsAlwaysVisible()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user