From 60ae7ac35b8a6fc20298d57d86c6393f9301f1b0 Mon Sep 17 00:00:00 2001 From: Bill Lin Date: Fri, 4 Dec 2020 10:39:43 +0800 Subject: [PATCH] 6-1/ Integrate SplitScreen rotation flicker tests Enable the rotation tests and aling the structure of WMShell Flicker test cases Bug: 169271943 Test: atest WMShellFlickerTests:RotateOneLaunchedAppTest Test: atest WMShellFlickerTests:RotateTwoLaunchedAppTest Change-Id: Ieeafc42562e99c5aa26547625b13ec2af35871c1 --- .../wm/shell/flicker/CommonAssertions.kt | 46 +++++ .../flicker/helpers/SplitScreenHelper.kt | 16 -- .../splitscreen/EnterSplitScreenTest.kt | 26 +-- .../splitscreen/RotateOneLaunchedAppTest.kt | 146 ++++++++++++++++ .../splitscreen/RotateTwoLaunchedAppTest.kt | 157 ++++++++++++++++++ .../SplitScreenRotateOneLaunchedAppTest.kt | 95 ----------- .../SplitScreenRotateTwoLaunchedAppTest.kt | 104 ------------ 7 files changed, 357 insertions(+), 233 deletions(-) create mode 100644 libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/RotateOneLaunchedAppTest.kt create mode 100644 libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/RotateTwoLaunchedAppTest.kt delete mode 100644 libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SplitScreenRotateOneLaunchedAppTest.kt delete mode 100644 libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SplitScreenRotateTwoLaunchedAppTest.kt diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/CommonAssertions.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/CommonAssertions.kt index 1638d72f99140..c5b54bc4abcbe 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/CommonAssertions.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/CommonAssertions.kt @@ -16,8 +16,10 @@ package com.android.wm.shell.flicker +import android.graphics.Region import com.android.server.wm.flicker.dsl.EventLogAssertion import com.android.server.wm.flicker.dsl.LayersAssertion +import com.android.server.wm.flicker.helpers.WindowUtils @JvmOverloads fun LayersAssertion.appPairsDividerIsVisible( @@ -59,6 +61,50 @@ fun LayersAssertion.dockedStackDividerIsInvisible( } } +@JvmOverloads +fun LayersAssertion.dockedStackPrimaryBoundsIsVisible( + rotation: Int, + primaryLayerName: String, + bugId: Int = 0, + enabled: Boolean = bugId == 0 +) { + end("PrimaryAppBounds", bugId, enabled) { + val entry = this.trace.entries.firstOrNull() + ?: throw IllegalStateException("Trace is empty") + val dividerRegion = entry.getVisibleBounds(FlickerTestBase.DOCKED_STACK_DIVIDER) + this.hasVisibleRegion(primaryLayerName, getPrimaryRegion(dividerRegion, rotation)) + } +} + +@JvmOverloads +fun LayersAssertion.dockedStackSecondaryBoundsIsVisible( + rotation: Int, + secondaryLayerName: String, + bugId: Int = 0, + enabled: Boolean = bugId == 0 +) { + end("SecondaryAppBounds", bugId, enabled) { + val entry = this.trace.entries.firstOrNull() + ?: throw IllegalStateException("Trace is empty") + val dividerRegion = entry.getVisibleBounds(FlickerTestBase.DOCKED_STACK_DIVIDER) + this.hasVisibleRegion(secondaryLayerName, getSecondaryRegion(dividerRegion, rotation)) + } +} + +fun getPrimaryRegion(dividerRegion: Region, rotation: Int): Region { + val displayBounds = WindowUtils.getDisplayBounds(rotation) + return Region(0, 0, displayBounds.getBounds().right, + dividerRegion.getBounds().bottom - WindowUtils.dockedStackDividerInset) +} + +fun getSecondaryRegion(dividerRegion: Region, rotation: Int): Region { + val displayBounds = WindowUtils.getDisplayBounds(rotation) + return Region(0, + dividerRegion.getBounds().bottom - WindowUtils.dockedStackDividerInset, + displayBounds.getBounds().right, + displayBounds.getBounds().bottom - WindowUtils.navigationBarHeight) +} + fun EventLogAssertion.focusChanges( vararg windows: String, bugId: Int = 0, diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/SplitScreenHelper.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/SplitScreenHelper.kt index e67fc97dad2ee..fb795c72b1060 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/SplitScreenHelper.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/SplitScreenHelper.kt @@ -17,9 +17,7 @@ package com.android.wm.shell.flicker.helpers import android.app.Instrumentation -import android.graphics.Region import android.os.SystemClock -import com.android.server.wm.flicker.helpers.WindowUtils import com.android.wm.shell.flicker.testapp.Components class SplitScreenHelper( @@ -43,20 +41,6 @@ class SplitScreenHelper( SystemClock.sleep(TIMEOUT_MS) } - fun getPrimaryBounds(dividerBounds: Region): android.graphics.Region { - val primaryAppBounds = Region(0, 0, dividerBounds.bounds.right, - dividerBounds.bounds.bottom + WindowUtils.dockedStackDividerInset) - return primaryAppBounds - } - - fun getSecondaryBounds(dividerBounds: Region): android.graphics.Region { - val displayBounds = WindowUtils.displayBounds - val secondaryAppBounds = Region(0, - dividerBounds.bounds.bottom - WindowUtils.dockedStackDividerInset, - displayBounds.right, displayBounds.bottom - WindowUtils.navigationBarHeight) - return secondaryAppBounds - } - companion object { const val TEST_REPETITIONS = 1 const val TIMEOUT_MS = 3_000L diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/EnterSplitScreenTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/EnterSplitScreenTest.kt index d36ad930a13b4..3486761895243 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/EnterSplitScreenTest.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/EnterSplitScreenTest.kt @@ -35,6 +35,8 @@ 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 import org.junit.FixMethodOrder import org.junit.Test @@ -102,13 +104,8 @@ class EnterSplitScreenTest( assertions { layersTrace { dockedStackDividerIsVisible() - end("appsEndingBounds", enabled = false) { - val entry = this.trace.entries.firstOrNull() - ?: throw IllegalStateException("Trace is empty") - this.hasVisibleRegion(splitScreenApp.defaultWindowName, - splitScreenApp.getPrimaryBounds( - entry.getVisibleBounds(DOCKED_STACK_DIVIDER))) - } + dockedStackPrimaryBoundsIsVisible( + rotation, splitScreenApp.defaultWindowName, 169271943) } windowManagerTrace { end { @@ -136,17 +133,10 @@ class EnterSplitScreenTest( assertions { layersTrace { dockedStackDividerIsVisible() - end("appsEndingBounds", enabled = false) { - val entry = this.trace.entries.firstOrNull() - ?: throw IllegalStateException("Trace is empty") - this.hasVisibleRegion(splitScreenApp.defaultWindowName, - splitScreenApp.getPrimaryBounds( - entry.getVisibleBounds(DOCKED_STACK_DIVIDER))) - .and() - .hasVisibleRegion(secondaryApp.defaultWindowName, - splitScreenApp.getSecondaryBounds( - entry.getVisibleBounds(DOCKED_STACK_DIVIDER))) - } + dockedStackPrimaryBoundsIsVisible( + rotation, splitScreenApp.defaultWindowName, 169271943) + dockedStackSecondaryBoundsIsVisible( + rotation, secondaryApp.defaultWindowName, 169271943) } windowManagerTrace { end { diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/RotateOneLaunchedAppTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/RotateOneLaunchedAppTest.kt new file mode 100644 index 0000000000000..be8f9bcdedb63 --- /dev/null +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/RotateOneLaunchedAppTest.kt @@ -0,0 +1,146 @@ +/* + * Copyright (C) 2020 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.splitscreen + +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.exitSplitScreen +import com.android.server.wm.flicker.helpers.isInSplitScreen +import com.android.server.wm.flicker.helpers.launchSplitScreen +import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen +import com.android.server.wm.flicker.navBarLayerRotatesAndScales +import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible +import com.android.server.wm.flicker.statusBarLayerRotatesScales +import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible +import com.android.wm.shell.flicker.dockedStackDividerIsVisible +import com.android.wm.shell.flicker.dockedStackPrimaryBoundsIsVisible +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:RotateOneLaunchedAppTest` + */ +@RequiresDevice +@RunWith(Parameterized::class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +class RotateOneLaunchedAppTest( + rotationName: String, + rotation: Int +) : SplitScreenTestBase(rotationName, rotation) { + private val splitScreenRotationSetup: FlickerBuilder + get() = FlickerBuilder(instrumentation).apply { + val testSetupRotation = "testSetupRotation" + withTestName { + testSetupRotation + } + setup { + test { + device.wakeUpAndGoToHomeScreen() + } + } + teardown { + eachRun { + if (uiDevice.isInSplitScreen()) { + uiDevice.exitSplitScreen() + } + setRotation(Surface.ROTATION_0) + splitScreenApp.exit() + secondaryApp.exit() + } + } + } + + @Test + fun testRotateInSplitScreenMode() { + val testTag = "testEnterSplitScreen_launchToSide" + runWithFlicker(splitScreenRotationSetup) { + withTestName { testTag } + repeat { + SplitScreenHelper.TEST_REPETITIONS + } + transitions { + splitScreenApp.launchViaIntent() + device.launchSplitScreen() + setRotation(rotation) + } + assertions { + layersTrace { + navBarLayerRotatesAndScales(Surface.ROTATION_0, rotation, 169271943) + statusBarLayerRotatesScales(Surface.ROTATION_0, rotation, 169271943) + dockedStackDividerIsVisible() + dockedStackPrimaryBoundsIsVisible( + rotation, splitScreenApp.defaultWindowName, 169271943) + } + windowManagerTrace { + navBarWindowIsAlwaysVisible() + statusBarWindowIsAlwaysVisible() + end { + showsAppWindow(splitScreenApp.defaultWindowName) + } + } + } + } + } + + @Test + fun testRotateAndEnterSplitScreenMode() { + val testTag = "testRotateAndEnterSplitScreenMode" + runWithFlicker(splitScreenRotationSetup) { + withTestName { testTag } + repeat { + SplitScreenHelper.TEST_REPETITIONS + } + transitions { + splitScreenApp.launchViaIntent() + setRotation(rotation) + device.launchSplitScreen() + } + assertions { + layersTrace { + navBarLayerRotatesAndScales(Surface.ROTATION_0, rotation, 169271943) + statusBarLayerRotatesScales(Surface.ROTATION_0, rotation, 169271943) + dockedStackDividerIsVisible() + dockedStackPrimaryBoundsIsVisible( + rotation, splitScreenApp.defaultWindowName, 169271943) + } + windowManagerTrace { + navBarWindowIsAlwaysVisible() + statusBarWindowIsAlwaysVisible() + end { + showsAppWindow(splitScreenApp.defaultWindowName) + } + } + } + } + } + + companion object { + @Parameterized.Parameters(name = "{0}") + @JvmStatic + fun getParams(): Collection> { + val supportedRotations = intArrayOf(Surface.ROTATION_90, Surface.ROTATION_270) + return supportedRotations.map { arrayOf(Surface.rotationToString(it), it) } + } + } +} \ No newline at end of file diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/RotateTwoLaunchedAppTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/RotateTwoLaunchedAppTest.kt new file mode 100644 index 0000000000000..2e05c2a99273f --- /dev/null +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/RotateTwoLaunchedAppTest.kt @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2020 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.splitscreen + +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.exitSplitScreen +import com.android.server.wm.flicker.helpers.isInSplitScreen +import com.android.server.wm.flicker.helpers.launchSplitScreen +import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen +import com.android.server.wm.flicker.navBarLayerRotatesAndScales +import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible +import com.android.server.wm.flicker.statusBarLayerRotatesScales +import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible +import com.android.wm.shell.flicker.dockedStackDividerIsVisible +import com.android.wm.shell.flicker.dockedStackPrimaryBoundsIsVisible +import com.android.wm.shell.flicker.dockedStackSecondaryBoundsIsVisible +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:RotateTwoLaunchedAppTest` + */ +@RequiresDevice +@RunWith(Parameterized::class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +class RotateTwoLaunchedAppTest( + rotationName: String, + rotation: Int +) : SplitScreenTestBase(rotationName, rotation) { + private val splitScreenRotationSetup: FlickerBuilder + get() = FlickerBuilder(instrumentation).apply { + val testSetupRotation = "testSetupRotation" + withTestName { + testSetupRotation + } + setup { + test { + device.wakeUpAndGoToHomeScreen() + } + } + teardown { + eachRun { + if (uiDevice.isInSplitScreen()) { + uiDevice.exitSplitScreen() + } + setRotation(Surface.ROTATION_0) + splitScreenApp.exit() + secondaryApp.exit() + } + } + } + + @Test + fun testRotateInSplitScreenMode() { + val testTag = "testRotateInSplitScreenMode" + runWithFlicker(splitScreenRotationSetup) { + withTestName { testTag } + repeat { + SplitScreenHelper.TEST_REPETITIONS + } + transitions { + secondaryApp.launchViaIntent() + splitScreenApp.launchViaIntent() + device.launchSplitScreen() + splitScreenApp.reopenAppFromOverview() + setRotation(rotation) + } + assertions { + layersTrace { + navBarLayerRotatesAndScales(Surface.ROTATION_0, rotation, 169271943) + statusBarLayerRotatesScales(Surface.ROTATION_0, rotation, 169271943) + dockedStackDividerIsVisible() + dockedStackPrimaryBoundsIsVisible( + rotation, splitScreenApp.defaultWindowName, 169271943) + dockedStackSecondaryBoundsIsVisible( + rotation, secondaryApp.defaultWindowName, 169271943) + } + windowManagerTrace { + navBarWindowIsAlwaysVisible() + statusBarWindowIsAlwaysVisible() + end { + showsAppWindow(splitScreenApp.defaultWindowName) + .and().showsAppWindow(secondaryApp.defaultWindowName) + } + } + } + } + } + + @Test + fun testRotateAndEnterSplitScreenMode() { + val testTag = "testRotateAndEnterSplitScreenMode" + runWithFlicker(splitScreenRotationSetup) { + withTestName { testTag } + repeat { + SplitScreenHelper.TEST_REPETITIONS + } + transitions { + secondaryApp.launchViaIntent() + splitScreenApp.launchViaIntent() + setRotation(rotation) + device.launchSplitScreen() + splitScreenApp.reopenAppFromOverview() + } + assertions { + layersTrace { + navBarLayerRotatesAndScales(Surface.ROTATION_0, rotation, 169271943) + statusBarLayerRotatesScales(Surface.ROTATION_0, rotation, 169271943) + dockedStackDividerIsVisible() + dockedStackPrimaryBoundsIsVisible( + rotation, splitScreenApp.defaultWindowName, 169271943) + dockedStackSecondaryBoundsIsVisible( + rotation, secondaryApp.defaultWindowName, 169271943) + } + windowManagerTrace { + navBarWindowIsAlwaysVisible() + statusBarWindowIsAlwaysVisible() + end { + showsAppWindow(splitScreenApp.defaultWindowName) + .and().showsAppWindow(secondaryApp.defaultWindowName) + } + } + } + } + } + + companion object { + @Parameterized.Parameters(name = "{0}") + @JvmStatic + fun getParams(): Collection> { + val supportedRotations = intArrayOf(Surface.ROTATION_90, Surface.ROTATION_270) + return supportedRotations.map { arrayOf(Surface.rotationToString(it), it) } + } + } +} \ No newline at end of file diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SplitScreenRotateOneLaunchedAppTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SplitScreenRotateOneLaunchedAppTest.kt deleted file mode 100644 index d2371bd766f59..0000000000000 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SplitScreenRotateOneLaunchedAppTest.kt +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (C) 2020 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.splitscreen - -import androidx.test.filters.FlakyTest -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.startRotation -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.isInSplitScreen -import com.android.server.wm.flicker.helpers.launchSplitScreen -import com.android.server.wm.flicker.helpers.setRotation -import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen -import com.android.server.wm.flicker.repetitions -import org.junit.FixMethodOrder -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:SplitScreenRotateOneLaunchedAppTest` - */ -@RequiresDevice -@RunWith(Parameterized::class) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -@FlakyTest -class SplitScreenRotateOneLaunchedAppTest( - testName: String, - flickerSpec: Flicker -) : FlickerTestRunner(testName, flickerSpec) { - companion object { - @Parameterized.Parameters(name = "{0}") - @JvmStatic - fun getParams(): Collection> { - val instrumentation = InstrumentationRegistry.getInstrumentation() - val testApp = StandardAppHelper(instrumentation, - "com.android.wm.shell.flicker.testapp", "SimpleApp") - - return FlickerTestRunnerFactory(instrumentation, repetitions = 3) - .buildTest { configuration -> - withTestName { - buildTestTag("splitScreenRotateOneApp", testApp, configuration) - } - repeat { configuration.repetitions } - setup { - test { - device.wakeUpAndGoToHomeScreen() - testApp.open() - device.launchSplitScreen() - device.waitForIdle() - } - eachRun { - this.setRotation(configuration.startRotation) - } - } - teardown { - eachRun { - setRotation(Surface.ROTATION_0) - } - test { - testApp.exit() - if (device.isInSplitScreen()) { - device.exitSplitScreen() - } - } - } - transitions { - this.setRotation(configuration.endRotation) - } - } - } - } -} \ No newline at end of file diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SplitScreenRotateTwoLaunchedAppTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SplitScreenRotateTwoLaunchedAppTest.kt deleted file mode 100644 index 67346424acd22..0000000000000 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SplitScreenRotateTwoLaunchedAppTest.kt +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (C) 2020 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.splitscreen - -import androidx.test.filters.FlakyTest -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.startRotation -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.reopenAppFromOverview -import com.android.server.wm.flicker.helpers.isInSplitScreen -import com.android.server.wm.flicker.helpers.launchSplitScreen -import com.android.server.wm.flicker.helpers.setRotation -import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen -import com.android.server.wm.flicker.repetitions -import org.junit.FixMethodOrder -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:SplitScreenRotateTwoLaunchedAppTest` - */ -@RequiresDevice -@RunWith(Parameterized::class) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -@FlakyTest -class SplitScreenRotateTwoLaunchedAppTest( - testName: String, - flickerSpec: Flicker -) : FlickerTestRunner(testName, flickerSpec) { - companion object { - @Parameterized.Parameters(name = "{0}") - @JvmStatic - fun getParams(): Collection> { - val instrumentation = InstrumentationRegistry.getInstrumentation() - val testApp = StandardAppHelper(instrumentation, - "com.android.wm.shell.flicker.testapp", "SimpleApp") - val secondaryApp = StandardAppHelper(instrumentation, - "com.android.wm.shell.flicker.testapp", - "SplitScreenSecondaryApp") - - return FlickerTestRunnerFactory(instrumentation, repetitions = 3) - .buildTest { configuration -> - withTestName { - buildTestTag("splitScreenRotateTwoApps", testApp, configuration) - } - repeat { configuration.repetitions } - setup { - test { - device.wakeUpAndGoToHomeScreen() - testApp.open() - device.pressHome() - secondaryApp.open() - device.pressHome() - device.launchSplitScreen() - device.reopenAppFromOverview() - device.waitForIdle() - } - eachRun { - this.setRotation(configuration.startRotation) - } - } - teardown { - eachRun { - setRotation(Surface.ROTATION_0) - } - test { - testApp.exit() - secondaryApp.exit() - if (device.isInSplitScreen()) { - device.exitSplitScreen() - } - } - } - transitions { - this.setRotation(configuration.endRotation) - } - } - } - } -} \ No newline at end of file