diff options
| author | 2020-11-24 11:03:06 +0000 | |
|---|---|---|
| committer | 2020-11-24 11:03:06 +0000 | |
| commit | ba500e9603d116d2a1c9d96dbccb03dd282eaa72 (patch) | |
| tree | 943e71105b57365055c2b426ef93abcbccea0b39 | |
| parent | ed7b77e88da2fd7faf85bc92379cac3cd011c446 (diff) | |
| parent | 941c3b8ac3c4540a02a47c518e9b67056b1a10cd (diff) | |
Merge "Move tests from FlickerTests to WMShell"
15 files changed, 144 insertions, 306 deletions
diff --git a/libs/WindowManager/Shell/tests/flicker/Android.bp b/libs/WindowManager/Shell/tests/flicker/Android.bp index d7afa0e166b3..1bbe6884a48c 100644 --- a/libs/WindowManager/Shell/tests/flicker/Android.bp +++ b/libs/WindowManager/Shell/tests/flicker/Android.bp @@ -29,7 +29,10 @@ android_test { "truth-prebuilt", "app-helpers-core", "launcher-helper-lib", - "launcher-aosp-tapl" + "launcher-aosp-tapl", + "wm-flicker-common-assertions", + "wm-flicker-common-app-helpers", + "platform-test-annotations", ], } @@ -47,6 +50,9 @@ android_test { "truth-prebuilt", "app-helpers-core", "launcher-helper-lib", - "launcher-aosp-tapl" + "launcher-aosp-tapl", + "wm-flicker-common-assertions", + "wm-flicker-common-app-helpers", + "platform-test-annotations", ], } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/pip/CommonAssertions.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/CommonAssertions.kt index 6bc9dcb5d96c..2a660747bc1d 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/pip/CommonAssertions.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/CommonAssertions.kt @@ -14,6 +14,6 @@ * limitations under the License. */ -package com.android.server.wm.flicker.pip +package com.android.wm.shell.flicker.pip internal const val PIP_WINDOW_TITLE = "PipMenuActivity" diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterPipTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterPipTest.kt index a1da7c939f60..cb1fe4e2981d 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterPipTest.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterPipTest.kt @@ -19,104 +19,113 @@ package com.android.wm.shell.flicker.pip import android.view.Surface import androidx.test.filters.FlakyTest import androidx.test.filters.RequiresDevice -import com.android.server.wm.flicker.dsl.flicker +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.buildTestTag import com.android.server.wm.flicker.helpers.closePipWindow import com.android.server.wm.flicker.helpers.expandPipWindow import com.android.server.wm.flicker.helpers.hasPipWindow +import com.android.server.wm.flicker.helpers.setRotation import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen -import com.android.wm.shell.flicker.navBarLayerIsAlwaysVisible -import com.android.wm.shell.flicker.navBarLayerRotatesAndScales -import com.android.wm.shell.flicker.navBarWindowIsAlwaysVisible -import com.android.wm.shell.flicker.noUncoveredRegions -import com.android.wm.shell.flicker.statusBarLayerIsAlwaysVisible -import com.android.wm.shell.flicker.statusBarLayerRotatesScales -import com.android.wm.shell.flicker.statusBarWindowIsAlwaysVisible -import com.android.wm.shell.flicker.PIP_WINDOW_NAME +import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.navBarLayerRotatesAndScales +import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.statusBarLayerRotatesScales +import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible +import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible +import com.android.server.wm.flicker.noUncoveredRegions +import com.android.server.wm.flicker.repetitions +import com.android.server.wm.flicker.startRotation +import com.android.wm.shell.flicker.helpers.PipAppHelper import org.junit.FixMethodOrder -import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.MethodSorters import org.junit.runners.Parameterized /** * Test Pip launch. - * To run this test: `atest WMShellFlickerTests:PipToAppTest` + * To run this test: `atest WMShellFlickerTests:EnterPipTest` */ @RequiresDevice @RunWith(Parameterized::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) @FlakyTest(bugId = 152738416) class EnterPipTest( - rotationName: String, - rotation: Int -) : PipTestBase(rotationName, rotation) { - @Test - fun test() { - flicker(instrumentation) { - withTag { buildTestTag("enterPip", testApp, rotation) } - repeat { 1 } - setup { - test { - device.wakeUpAndGoToHomeScreen() - } - eachRun { - device.pressHome() - testApp.open() - this.setRotation(rotation) - } - } - teardown { - eachRun { - if (device.hasPipWindow()) { - device.closePipWindow() + testName: String, + flickerSpec: Flicker +) : FlickerTestRunner(testName, flickerSpec) { + companion object { + @Parameterized.Parameters(name = "{0}") + @JvmStatic + fun getParams(): List<Array<Any>> { + val instrumentation = InstrumentationRegistry.getInstrumentation() + val testApp = PipAppHelper(instrumentation) + return FlickerTestRunnerFactory(instrumentation, listOf(Surface.ROTATION_0)) + .buildTest { configuration -> + withTestName { buildTestTag("enterPip", testApp, configuration) } + repeat { configuration.repetitions } + setup { + test { + device.wakeUpAndGoToHomeScreen() + } + eachRun { + device.pressHome() + testApp.open() + this.setRotation(configuration.startRotation) + } } - testApp.exit() - this.setRotation(Surface.ROTATION_0) - } - test { - if (device.hasPipWindow()) { - device.closePipWindow() + teardown { + eachRun { + if (device.hasPipWindow()) { + device.closePipWindow() + } + testApp.exit() + this.setRotation(Surface.ROTATION_0) + } + test { + if (device.hasPipWindow()) { + device.closePipWindow() + } + } } - } - } - transitions { - testApp.clickEnterPipButton() - device.expandPipWindow() - } - assertions { - windowManagerTrace { - navBarWindowIsAlwaysVisible() - statusBarWindowIsAlwaysVisible() - all("pipWindowBecomesVisible") { - this.showsAppWindow(testApp.`package`) - .then() - .showsAppWindow(PIP_WINDOW_NAME) + transitions { + testApp.clickEnterPipButton() + device.expandPipWindow() } - } + assertions { + windowManagerTrace { + navBarWindowIsAlwaysVisible() + statusBarWindowIsAlwaysVisible() - layersTrace { - navBarLayerIsAlwaysVisible() - statusBarLayerIsAlwaysVisible() - noUncoveredRegions(rotation, Surface.ROTATION_0, allStates = false) - navBarLayerRotatesAndScales(rotation, Surface.ROTATION_0) - statusBarLayerRotatesScales(rotation, Surface.ROTATION_0) + all("pipWindowBecomesVisible") { + this.showsAppWindow(testApp.`package`) + .then() + .showsAppWindow(PIP_WINDOW_TITLE) + } + } - all("pipLayerBecomesVisible") { - this.showsLayer(testApp.launcherName) - .then() - .showsLayer(PIP_WINDOW_NAME) + layersTrace { + navBarLayerIsAlwaysVisible(bugId = 140855415) + statusBarLayerIsAlwaysVisible() + noUncoveredRegions(configuration.startRotation, Surface.ROTATION_0, + enabled = false) + navBarLayerRotatesAndScales(configuration.startRotation, + Surface.ROTATION_0, bugId = 140855415) + statusBarLayerRotatesScales(configuration.startRotation, + Surface.ROTATION_0) + } + + layersTrace { + all("pipLayerBecomesVisible") { + this.showsLayer(testApp.launcherName) + .then() + .showsLayer(PIP_WINDOW_TITLE) + } + } } } - } - } - } - - companion object { - @Parameterized.Parameters(name = "{0}") - @JvmStatic - fun getParams(): Collection<Array<Any>> { - val supportedRotations = intArrayOf(Surface.ROTATION_0) - return supportedRotations.map { arrayOf(Surface.rotationToString(it), it) } } } -} +}
\ No newline at end of file diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/pip/PipToAppTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipToAppTest.kt index ac54a0a29350..e1fa6578e552 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/pip/PipToAppTest.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipToAppTest.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.server.wm.flicker.pip +package com.android.wm.shell.flicker.pip import android.view.Surface import androidx.test.filters.FlakyTest @@ -24,7 +24,6 @@ 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.focusChanges -import com.android.server.wm.flicker.helpers.PipAppHelper import com.android.server.wm.flicker.helpers.buildTestTag import com.android.server.wm.flicker.helpers.closePipWindow import com.android.server.wm.flicker.helpers.expandPipWindow @@ -40,6 +39,7 @@ import com.android.server.wm.flicker.startRotation 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.helpers.PipAppHelper import org.junit.FixMethodOrder import org.junit.runner.RunWith import org.junit.runners.MethodSorters @@ -47,7 +47,7 @@ import org.junit.runners.Parameterized /** * Test Pip launch. - * To run this test: `atest FlickerTests:PipToAppTest` + * To run this test: `atest WMShellFlickerTests:PipToAppTest` */ @RequiresDevice @RunWith(Parameterized::class) @@ -75,7 +75,7 @@ class PipToAppTest( } eachRun { this.setRotation(configuration.startRotation) - testApp.clickEnterPipButton(device) + testApp.clickEnterPipButton() device.hasPipWindow() } } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/pip/PipToHomeTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipToHomeTest.kt index f14a27d31ad1..bf1193786a59 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/pip/PipToHomeTest.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipToHomeTest.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.server.wm.flicker.pip +package com.android.wm.shell.flicker.pip import android.view.Surface import androidx.test.filters.FlakyTest @@ -24,7 +24,6 @@ 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.focusChanges -import com.android.server.wm.flicker.helpers.PipAppHelper import com.android.server.wm.flicker.helpers.buildTestTag import com.android.server.wm.flicker.helpers.closePipWindow import com.android.server.wm.flicker.helpers.hasPipWindow @@ -39,6 +38,7 @@ import com.android.server.wm.flicker.startRotation 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.helpers.PipAppHelper import org.junit.FixMethodOrder import org.junit.runner.RunWith import org.junit.runners.MethodSorters @@ -46,7 +46,7 @@ import org.junit.runners.Parameterized /** * Test Pip launch. - * To run this test: `atest FlickerTests:PipToHomeTest` + * To run this test: `atest WMShellFlickerTests:PipToHomeTest` */ @RequiresDevice @RunWith(Parameterized::class) @@ -74,7 +74,7 @@ class PipToHomeTest( eachRun { testApp.open() this.setRotation(configuration.startRotation) - testApp.clickEnterPipButton(device) + testApp.clickEnterPipButton() device.hasPipWindow() } } @@ -93,7 +93,7 @@ class PipToHomeTest( } } transitions { - testApp.closePipWindow(device) + testApp.closePipWindow() } assertions { windowManagerTrace { diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/splitscreen/OpenAppToSplitScreenTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/OpenAppToSplitScreenTest.kt index ae9fcf9a3b6e..1e328a8dae40 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/splitscreen/OpenAppToSplitScreenTest.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/OpenAppToSplitScreenTest.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.server.wm.flicker.splitscreen +package com.android.wm.shell.flicker.splitscreen import android.platform.test.annotations.Presubmit import androidx.test.filters.FlakyTest @@ -48,7 +48,7 @@ import org.junit.runners.Parameterized /** * Test open app to split screen. - * To run this test: `atest FlickerTests:OpenAppToSplitScreenTest` + * To run this test: `atest WMShellFlickerTests:OpenAppToSplitScreenTest` */ @Presubmit @RequiresDevice @@ -65,7 +65,7 @@ class OpenAppToSplitScreenTest( fun getParams(): Collection<Array<Any>> { val instrumentation = InstrumentationRegistry.getInstrumentation() val testApp = StandardAppHelper(instrumentation, - "com.android.server.wm.flicker.testapp", "SimpleApp") + "com.android.wm.shell.flicker.testapp", "SimpleApp") return FlickerTestRunnerFactory(instrumentation) .buildTest { configuration -> diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/splitscreen/ResizeSplitScreenTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/ResizeSplitScreenTest.kt index 4b9f02412f2a..7c83846621de 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/splitscreen/ResizeSplitScreenTest.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/ResizeSplitScreenTest.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.server.wm.flicker.splitscreen +package com.android.wm.shell.flicker.splitscreen import android.graphics.Region import android.util.Rational @@ -29,8 +29,8 @@ import com.android.server.wm.flicker.FlickerTestRunner import com.android.server.wm.flicker.FlickerTestRunnerFactory import com.android.server.wm.flicker.endRotation import com.android.server.wm.flicker.helpers.StandardAppHelper -import com.android.server.wm.flicker.focusDoesNotChange import com.android.server.wm.flicker.helpers.ImeAppHelper +import com.android.server.wm.flicker.focusDoesNotChange import com.android.server.wm.flicker.helpers.WindowUtils import com.android.server.wm.flicker.helpers.buildTestTag import com.android.server.wm.flicker.helpers.exitSplitScreen @@ -55,7 +55,7 @@ import org.junit.runners.Parameterized /** * Test split screen resizing window transitions. - * To run this test: `atest FlickerTests:ResizeSplitScreenTest` + * To run this test: `atest WMShellFlickerTests:ResizeSplitScreenTest` * * Currently it runs only in 0 degrees because of b/156100803 */ @@ -78,7 +78,7 @@ class ResizeSplitScreenTest( fun getParams(): Collection<Array<Any>> { val instrumentation = InstrumentationRegistry.getInstrumentation() val testAppTop = StandardAppHelper(instrumentation, - "com.android.server.wm.flicker.testapp", "SimpleApp") + "com.android.wm.shell.flicker.testapp", "SimpleApp") val testAppBottom = ImeAppHelper(instrumentation) return FlickerTestRunnerFactory(instrumentation, listOf(Surface.ROTATION_0)) diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/splitscreen/SplitScreenToLauncherTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SplitScreenToLauncherTest.kt index f966a66aa0a1..00979fa9fac0 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/splitscreen/SplitScreenToLauncherTest.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SplitScreenToLauncherTest.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.server.wm.flicker.splitscreen +package com.android.wm.shell.flicker.splitscreen import android.platform.test.annotations.Presubmit import android.view.Surface @@ -48,7 +48,7 @@ import org.junit.runners.Parameterized /** * Test open app to split screen. - * To run this test: `atest FlickerTests:SplitScreenToLauncherTest` + * To run this test: `atest WMShellFlickerTests:SplitScreenToLauncherTest` */ @Presubmit @RequiresDevice @@ -64,7 +64,7 @@ class SplitScreenToLauncherTest( fun getParams(): Collection<Array<Any>> { val instrumentation = InstrumentationRegistry.getInstrumentation() val testApp = StandardAppHelper(instrumentation, - "com.android.server.wm.flicker.testapp", "SimpleApp") + "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)) diff --git a/libs/WindowManager/Shell/tests/flicker/test-apps/flickerapp/AndroidManifest.xml b/libs/WindowManager/Shell/tests/flicker/test-apps/flickerapp/AndroidManifest.xml index 2ce120448ac4..628926a97bf5 100644 --- a/libs/WindowManager/Shell/tests/flicker/test-apps/flickerapp/AndroidManifest.xml +++ b/libs/WindowManager/Shell/tests/flicker/test-apps/flickerapp/AndroidManifest.xml @@ -73,5 +73,15 @@ <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> + + <activity android:name=".SimpleActivity" + android:taskAffinity="com.android.wm.shell.flicker.testapp.SimpleActivity" + android:label="SimpleApp" + android:exported="true"> + <intent-filter> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> + </intent-filter> + </activity> </application> </manifest> diff --git a/tests/FlickerTests/test-apps/flickerapp/res/layout/activity_pip.xml b/libs/WindowManager/Shell/tests/flicker/test-apps/flickerapp/res/layout/activity_simple.xml index 2c58d91e34fe..5d94e5177dcc 100644 --- a/tests/FlickerTests/test-apps/flickerapp/res/layout/activity_pip.xml +++ b/libs/WindowManager/Shell/tests/flicker/test-apps/flickerapp/res/layout/activity_simple.xml @@ -18,9 +18,6 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@android:color/holo_blue_bright"> - <Button android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:id="@+id/enter_pip" - android:text="Enter PIP"/> + android:background="@android:color/holo_orange_light"> + </LinearLayout> diff --git a/tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/PipActivity.java b/libs/WindowManager/Shell/tests/flicker/test-apps/flickerapp/src/com/android/wm/shell/flicker/testapp/SimpleActivity.java index 9a8f39907877..5343c1893d4e 100644 --- a/tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/PipActivity.java +++ b/libs/WindowManager/Shell/tests/flicker/test-apps/flickerapp/src/com/android/wm/shell/flicker/testapp/SimpleActivity.java @@ -14,17 +14,13 @@ * limitations under the License. */ -package com.android.server.wm.flicker.testapp; +package com.android.wm.shell.flicker.testapp; import android.app.Activity; -import android.app.PictureInPictureParams; -import android.graphics.Rect; import android.os.Bundle; -import android.util.Rational; import android.view.WindowManager; -import android.widget.Button; -public class PipActivity extends Activity { +public class SimpleActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -32,14 +28,6 @@ public class PipActivity extends Activity { p.layoutInDisplayCutoutMode = WindowManager.LayoutParams .LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; getWindow().setAttributes(p); - setContentView(R.layout.activity_pip); - Button enterPip = (Button) findViewById(R.id.enter_pip); - - PictureInPictureParams params = new PictureInPictureParams.Builder() - .setAspectRatio(new Rational(1, 1)) - .setSourceRectHint(new Rect(0, 0, 100, 100)) - .build(); - - enterPip.setOnClickListener((v) -> enterPictureInPictureMode(params)); + setContentView(R.layout.activity_simple); } } diff --git a/tests/FlickerTests/Android.bp b/tests/FlickerTests/Android.bp index 3b9bec9ad0a7..1a83655ed8d3 100644 --- a/tests/FlickerTests/Android.bp +++ b/tests/FlickerTests/Android.bp @@ -59,7 +59,10 @@ android_test { java_library { name: "wm-flicker-common-assertions", platform_apis: true, - srcs: ["src/**/*Assertions.java", "src/**/*Assertions.kt"], + srcs: [ + "src/**/*Assertions.java", + "src/**/*Assertions.kt", + ], exclude_srcs: [ "**/helpers/*", ], @@ -68,4 +71,17 @@ java_library { "truth-prebuilt", "app-helpers-core" ], +} + +java_library { + name: "wm-flicker-common-app-helpers", + platform_apis: true, + srcs: [ + "**/helpers/*" + ], + static_libs: [ + "flickerlib", + "truth-prebuilt", + "app-helpers-core" + ], }
\ No newline at end of file diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.kt deleted file mode 100644 index 0572a7813819..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.kt +++ /dev/null @@ -1,43 +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.server.wm.flicker.helpers - -import android.app.Instrumentation -import android.support.test.launcherhelper.ILauncherStrategy -import android.support.test.launcherhelper.LauncherStrategyFactory -import androidx.test.uiautomator.By -import androidx.test.uiautomator.UiDevice -import org.junit.Assert - -class PipAppHelper( - instr: Instrumentation, - launcherStrategy: ILauncherStrategy = LauncherStrategyFactory - .getInstance(instr) - .launcherStrategy -) : StandardAppHelper(instr, "PipApp", launcherStrategy) { - fun clickEnterPipButton(device: UiDevice) { - val enterPipButton = device.findObject(By.res(getPackage(), "enter_pip")) - Assert.assertNotNull("Pip button not found, this usually happens when the device " + - "was left in an unknown state (e.g. in split screen)", enterPipButton) - enterPipButton.click() - device.hasPipWindow() - } - - fun closePipWindow(device: UiDevice) { - device.closePipWindow() - } -} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/pip/EnterPipTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/pip/EnterPipTest.kt deleted file mode 100644 index 89539fd1a9ec..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/pip/EnterPipTest.kt +++ /dev/null @@ -1,133 +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.server.wm.flicker.pip - -import android.platform.test.annotations.Presubmit -import android.view.Surface -import androidx.test.filters.FlakyTest -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.PipAppHelper -import com.android.server.wm.flicker.helpers.buildTestTag -import com.android.server.wm.flicker.helpers.closePipWindow -import com.android.server.wm.flicker.helpers.expandPipWindow -import com.android.server.wm.flicker.helpers.hasPipWindow -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.navBarWindowIsAlwaysVisible -import com.android.server.wm.flicker.noUncoveredRegions -import com.android.server.wm.flicker.repetitions -import com.android.server.wm.flicker.startRotation -import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible -import com.android.server.wm.flicker.statusBarLayerRotatesScales -import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible -import org.junit.FixMethodOrder -import org.junit.runner.RunWith -import org.junit.runners.MethodSorters -import org.junit.runners.Parameterized - -/** - * Test Pip launch. - * To run this test: `atest FlickerTests:PipToAppTest` - */ -@Presubmit -@RequiresDevice -@RunWith(Parameterized::class) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -@FlakyTest(bugId = 152738416) -class EnterPipTest( - testName: String, - flickerSpec: Flicker -) : FlickerTestRunner(testName, flickerSpec) { - companion object { - @Parameterized.Parameters(name = "{0}") - @JvmStatic - fun getParams(): List<Array<Any>> { - val instrumentation = InstrumentationRegistry.getInstrumentation() - val testApp = PipAppHelper(instrumentation) - return FlickerTestRunnerFactory(instrumentation, listOf(Surface.ROTATION_0)) - .buildTest { configuration -> - withTestName { buildTestTag("enterPip", testApp, configuration) } - repeat { configuration.repetitions } - setup { - test { - device.wakeUpAndGoToHomeScreen() - } - eachRun { - device.pressHome() - testApp.open() - this.setRotation(configuration.startRotation) - } - } - teardown { - eachRun { - if (device.hasPipWindow()) { - device.closePipWindow() - } - testApp.exit() - this.setRotation(Surface.ROTATION_0) - } - test { - if (device.hasPipWindow()) { - device.closePipWindow() - } - } - } - transitions { - testApp.clickEnterPipButton(device) - device.expandPipWindow() - } - assertions { - windowManagerTrace { - navBarWindowIsAlwaysVisible() - statusBarWindowIsAlwaysVisible() - - all("pipWindowBecomesVisible") { - this.showsAppWindow(testApp.`package`) - .then() - .showsAppWindow(PIP_WINDOW_TITLE) - } - } - - layersTrace { - navBarLayerIsAlwaysVisible(bugId = 140855415) - statusBarLayerIsAlwaysVisible() - noUncoveredRegions(configuration.startRotation, Surface.ROTATION_0, - enabled = false) - navBarLayerRotatesAndScales(configuration.startRotation, - Surface.ROTATION_0, bugId = 140855415) - statusBarLayerRotatesScales(configuration.startRotation, - Surface.ROTATION_0) - } - - layersTrace { - all("pipLayerBecomesVisible") { - this.showsLayer(testApp.launcherName) - .then() - .showsLayer(PIP_WINDOW_TITLE) - } - } - } - } - } - } -}
\ No newline at end of file diff --git a/tests/FlickerTests/test-apps/flickerapp/AndroidManifest.xml b/tests/FlickerTests/test-apps/flickerapp/AndroidManifest.xml index 4d2144061ad4..1599ed4b280f 100644 --- a/tests/FlickerTests/test-apps/flickerapp/AndroidManifest.xml +++ b/tests/FlickerTests/test-apps/flickerapp/AndroidManifest.xml @@ -49,18 +49,6 @@ <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name=".PipActivity" - android:resizeableActivity="true" - android:supportsPictureInPicture="true" - android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" - android:taskAffinity="com.android.server.wm.flicker.testapp.PipActivity" - android:label="PipApp" - android:exported="true"> - <intent-filter> - <action android:name="android.intent.action.MAIN"/> - <category android:name="android.intent.category.LAUNCHER"/> - </intent-filter> - </activity> <activity android:name=".SeamlessRotationActivity" android:taskAffinity="com.android.server.wm.flicker.testapp.SeamlessRotationActivity" android:configChanges="orientation|screenSize" |