Loading tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppColdTest.kt +9 −121 Original line number Diff line number Diff line Loading @@ -16,37 +16,14 @@ package com.android.server.wm.flicker.launch import android.app.Instrumentation 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.FlickerBuilderProvider import com.android.server.wm.flicker.FlickerParametersRunnerFactory import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.focusChanges 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 com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry import com.android.server.wm.flicker.wallpaperWindowBecomesInvisible import com.android.server.wm.flicker.appLayerReplacesWallpaperLayer import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.helpers.SimpleAppHelper import org.junit.Assume import org.junit.FixMethodOrder import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.MethodSorters import org.junit.runners.Parameterized Loading @@ -59,115 +36,26 @@ import org.junit.runners.Parameterized @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) class OpenAppColdTest(private val testSpec: FlickerTestParameter) { private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation() private val testApp = SimpleAppHelper(instrumentation) @FlickerBuilderProvider fun buildFlicker(): FlickerBuilder { return FlickerBuilder(instrumentation).apply { withTestName { testSpec.name } repeat { testSpec.config.repetitions } class OpenAppColdTest(testSpec: FlickerTestParameter) : OpenAppTransition(testSpec) { override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { super.transition(this, it) setup { test { device.wakeUpAndGoToHomeScreen() } eachRun { this.setRotation(testSpec.config.startRotation) } } transitions { testApp.launchViaIntent(wmHelper) // wmHelper.waitForFullScreenApp(testApp.component) } teardown { eachRun { testApp.exit() wmHelper.waitForAppTransitionIdle() this.setRotation(Surface.ROTATION_0) } } } } @Presubmit @Test fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible() @Presubmit @Test fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible() @Presubmit @Test fun visibleWindowsShownMoreThanOneConsecutiveEntry() = testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry() @Presubmit @Test fun appWindowReplacesLauncherAsTopWindow() = testSpec.appWindowReplacesLauncherAsTopWindow(testApp) @Presubmit @Test fun wallpaperWindowBecomesInvisible() = testSpec.wallpaperWindowBecomesInvisible() @Presubmit @Test // During testing the launcher is always in portrait mode fun noUncoveredRegions() = testSpec.noUncoveredRegions(testSpec.config.startRotation, Surface.ROTATION_0) @Presubmit @Test fun navBarLayerIsAlwaysVisible() = testSpec.navBarLayerIsAlwaysVisible() @Presubmit @Test fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsAlwaysVisible() @Presubmit @Test fun appLayerReplacesWallpaperLayer() = testSpec.appLayerReplacesWallpaperLayer(testApp.`package`) @Presubmit @Test fun navBarLayerRotatesAndScales() { Assume.assumeFalse(testSpec.isRotated) testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0) testApp.exit(wmHelper) } @FlakyTest @Test fun navBarLayerRotatesAndScales_Flaky() { Assume.assumeTrue(testSpec.isRotated) testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0) } @Presubmit @Test fun statusBarLayerRotatesScales() { Assume.assumeFalse(testSpec.isRotated) testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0) transitions { testApp.launchViaIntent(wmHelper) wmHelper.waitForFullScreenApp(testApp.component) } @FlakyTest @Test fun statusBarLayerRotatesScales_Flaky() { Assume.assumeTrue(testSpec.isRotated) testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0) } @Presubmit @Test fun focusChanges() = testSpec.focusChanges("NexusLauncherActivity", testApp.`package`) @FlakyTest @Test fun visibleLayersShownMoreThanOneConsecutiveEntry() = testSpec.visibleLayersShownMoreThanOneConsecutiveEntry() companion object { @Parameterized.Parameters(name = "{0}") @JvmStatic Loading tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromOverviewTest.kt +26 −75 Original line number Diff line number Diff line Loading @@ -16,36 +16,19 @@ package com.android.server.wm.flicker.launch import android.app.Instrumentation 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.FlickerBuilderProvider import com.android.server.wm.flicker.FlickerParametersRunnerFactory import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.endRotation import com.android.server.wm.flicker.focusChanges import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry import com.android.server.wm.flicker.helpers.reopenAppFromOverview 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 com.android.server.wm.flicker.wallpaperWindowBecomesInvisible import com.android.server.wm.flicker.appLayerReplacesWallpaperLayer import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.helpers.SimpleAppHelper import org.junit.Assume import org.junit.FixMethodOrder import org.junit.Test Loading @@ -61,18 +44,12 @@ import org.junit.runners.Parameterized @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) class OpenAppFromOverviewTest(private val testSpec: FlickerTestParameter) { private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation() private val testApp = SimpleAppHelper(instrumentation) @FlickerBuilderProvider fun buildFlicker(): FlickerBuilder { return FlickerBuilder(instrumentation).apply { withTestName { testSpec.name } repeat { testSpec.config.repetitions } class OpenAppFromOverviewTest(testSpec: FlickerTestParameter) : OpenAppTransition(testSpec) { override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { super.transition(this, it) setup { test { device.wakeUpAndGoToHomeScreen() testApp.launchViaIntent(wmHelper) } eachRun { Loading @@ -87,71 +64,50 @@ class OpenAppFromOverviewTest(private val testSpec: FlickerTestParameter) { device.reopenAppFromOverview(wmHelper) wmHelper.waitForFullScreenApp(testApp.component) } teardown { test { testApp.exit() } } } } @Presubmit @Test fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible() @Presubmit @Test fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible() override fun appWindowReplacesLauncherAsTopWindow() = super.appWindowReplacesLauncherAsTopWindow() @Test fun appWindowReplacesLauncherAsTopWindow() = testSpec.appWindowReplacesLauncherAsTopWindow(testApp) @Test fun wallpaperWindowBecomesInvisible() = testSpec.wallpaperWindowBecomesInvisible() @Presubmit @Test fun appLayerReplacesWallpaperLayer() = testSpec.appLayerReplacesWallpaperLayer(testApp.`package`) @Presubmit @Test fun navBarLayerRotatesAndScales() { Assume.assumeFalse(testSpec.isRotated) testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0) override fun wallpaperWindowBecomesInvisible() { testSpec.wallpaperWindowBecomesInvisible() } @Presubmit @Test fun statusBarLayerRotatesScales() { Assume.assumeFalse(testSpec.isRotated) testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0) override fun statusBarLayerIsAlwaysVisible() { Assume.assumeTrue(testSpec.isRotated) super.statusBarLayerIsAlwaysVisible() } @Presubmit @Test fun statusBarLayerIsAlwaysVisible() { override fun navBarLayerIsAlwaysVisible() { Assume.assumeTrue(testSpec.isRotated) testSpec.statusBarLayerIsAlwaysVisible() super.navBarLayerIsAlwaysVisible() } @Presubmit @FlakyTest @Test fun navBarLayerIsAlwaysVisible() { Assume.assumeTrue(testSpec.isRotated) testSpec.navBarLayerIsAlwaysVisible() fun statusBarLayerIsAlwaysVisible_Flaky() { Assume.assumeFalse(testSpec.isRotated) super.statusBarLayerIsAlwaysVisible() } @Presubmit @FlakyTest @Test fun focusChanges() = testSpec.focusChanges("NexusLauncherActivity", testApp.`package`) fun navBarLayerIsAlwaysVisible_Flaky() { Assume.assumeFalse(testSpec.isRotated) super.navBarLayerIsAlwaysVisible() } @Presubmit @Test fun visibleWindowsShownMoreThanOneConsecutiveEntry() { override fun visibleWindowsShownMoreThanOneConsecutiveEntry() { Assume.assumeFalse(testSpec.isRotated) testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry() super.visibleWindowsShownMoreThanOneConsecutiveEntry() } @FlakyTest Loading @@ -163,9 +119,9 @@ class OpenAppFromOverviewTest(private val testSpec: FlickerTestParameter) { @Presubmit @Test fun visibleLayersShownMoreThanOneConsecutiveEntry() { override fun visibleLayersShownMoreThanOneConsecutiveEntry() { Assume.assumeFalse(testSpec.isRotated) testSpec.visibleLayersShownMoreThanOneConsecutiveEntry() super.visibleLayersShownMoreThanOneConsecutiveEntry() } @FlakyTest Loading @@ -175,11 +131,6 @@ class OpenAppFromOverviewTest(private val testSpec: FlickerTestParameter) { testSpec.visibleLayersShownMoreThanOneConsecutiveEntry() } @Presubmit @Test fun noUncoveredRegions() = testSpec.noUncoveredRegions(Surface.ROTATION_0, testSpec.config.endRotation) companion object { @Parameterized.Parameters(name = "{0}") @JvmStatic Loading tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppTransition.kt 0 → 100644 +170 −0 Original line number Diff line number Diff line /* * 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.server.wm.flicker.launch import android.app.Instrumentation import android.platform.test.annotations.Presubmit import android.view.Surface import androidx.test.filters.FlakyTest import androidx.test.platform.app.InstrumentationRegistry import com.android.server.wm.flicker.FlickerBuilderProvider import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.appLayerReplacesWallpaperLayer import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.endRotation import com.android.server.wm.flicker.focusChanges import com.android.server.wm.flicker.helpers.SimpleAppHelper import com.android.server.wm.flicker.helpers.StandardAppHelper 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 com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry import com.android.server.wm.flicker.wallpaperWindowBecomesInvisible import org.junit.Assume import org.junit.Test abstract class OpenAppTransition(protected val testSpec: FlickerTestParameter) { protected val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation() protected val testApp: StandardAppHelper = SimpleAppHelper(instrumentation) protected open val transition: FlickerBuilder.(Map<String, Any?>) -> Unit = { withTestName { testSpec.name } repeat { testSpec.config.repetitions } setup { test { device.wakeUpAndGoToHomeScreen() this.setRotation(testSpec.config.startRotation) } } teardown { test { testApp.exit() } } } @FlickerBuilderProvider fun buildFlicker(): FlickerBuilder { return FlickerBuilder(instrumentation).apply { transition(testSpec.config) } } @Presubmit @Test open fun navBarWindowIsAlwaysVisible() { testSpec.navBarWindowIsAlwaysVisible() } @Presubmit @Test open fun navBarLayerIsAlwaysVisible() { testSpec.navBarLayerIsAlwaysVisible() } @Presubmit @Test open fun navBarLayerRotatesAndScales() { Assume.assumeFalse(testSpec.isRotated) testSpec.navBarLayerRotatesAndScales(Surface.ROTATION_0, testSpec.config.endRotation) } @FlakyTest @Test open fun navBarLayerRotatesAndScales_Flaky() { Assume.assumeTrue(testSpec.isRotated) testSpec.navBarLayerRotatesAndScales(Surface.ROTATION_0, testSpec.config.endRotation) } @Presubmit @Test open fun statusBarWindowIsAlwaysVisible() { testSpec.statusBarWindowIsAlwaysVisible() } @Presubmit @Test open fun statusBarLayerIsAlwaysVisible() { testSpec.statusBarLayerIsAlwaysVisible() } @Presubmit @Test open fun statusBarLayerRotatesScales() { Assume.assumeFalse(testSpec.isRotated) testSpec.statusBarLayerRotatesScales(Surface.ROTATION_0, testSpec.config.endRotation) } @FlakyTest @Test open fun statusBarLayerRotatesScales_Flaky() { Assume.assumeTrue(testSpec.isRotated) testSpec.statusBarLayerRotatesScales(Surface.ROTATION_0, testSpec.config.endRotation) } @Presubmit @Test open fun visibleWindowsShownMoreThanOneConsecutiveEntry() { testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry() } @FlakyTest @Test open fun visibleLayersShownMoreThanOneConsecutiveEntry() { testSpec.visibleLayersShownMoreThanOneConsecutiveEntry() } @Presubmit @Test // During testing the launcher is always in portrait mode open fun noUncoveredRegions() { testSpec.noUncoveredRegions(Surface.ROTATION_0, testSpec.config.endRotation) } @Presubmit @Test open fun focusChanges() { testSpec.focusChanges("NexusLauncherActivity", testApp.`package`) } @Presubmit @Test open fun appLayerReplacesWallpaperLayer() { testSpec.appLayerReplacesWallpaperLayer(testApp.`package`) } @Presubmit @Test open fun appWindowReplacesLauncherAsTopWindow() { testSpec.appWindowReplacesLauncherAsTopWindow(testApp) } @Presubmit @Test open fun wallpaperWindowBecomesInvisible() { testSpec.wallpaperWindowBecomesInvisible() } } No newline at end of file tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppWarmTest.kt +11 −110 Original line number Diff line number Diff line Loading @@ -16,34 +16,14 @@ package com.android.server.wm.flicker.launch import android.app.Instrumentation 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.FlickerBuilderProvider import com.android.server.wm.flicker.FlickerParametersRunnerFactory import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.focusChanges 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 com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry import com.android.server.wm.flicker.wallpaperWindowBecomesInvisible import com.android.server.wm.flicker.appLayerReplacesWallpaperLayer import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.helpers.SimpleAppHelper import org.junit.Assume import org.junit.FixMethodOrder import org.junit.Test import org.junit.runner.RunWith Loading @@ -58,20 +38,13 @@ import org.junit.runners.Parameterized @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) class OpenAppWarmTest(private val testSpec: FlickerTestParameter) { private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation() private val testApp = SimpleAppHelper(instrumentation) @FlickerBuilderProvider fun buildFlicker(): FlickerBuilder { return FlickerBuilder(instrumentation).apply { withTestName { testSpec.name } repeat { testSpec.config.repetitions } class OpenAppWarmTest(testSpec: FlickerTestParameter) : OpenAppTransition(testSpec) { override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { super.transition(this, it) setup { test { device.wakeUpAndGoToHomeScreen() testApp.launchViaIntent(wmHelper) // wmHelper.waitForFullScreenApp(testApp.component) } eachRun { device.pressHome() Loading @@ -79,93 +52,21 @@ class OpenAppWarmTest(private val testSpec: FlickerTestParameter) { this.setRotation(testSpec.config.startRotation) } } transitions { testApp.launchViaIntent(wmHelper) wmHelper.waitForFullScreenApp(testApp.component) } teardown { eachRun { this.setRotation(Surface.ROTATION_0) testApp.exit(wmHelper) } test { testApp.exit() } } } } @Presubmit @Test fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible() @Presubmit @Test fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible() @FlakyTest @Test fun visibleWindowsShownMoreThanOneConsecutiveEntry() = testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry() @Presubmit @Test fun appWindowReplacesLauncherAsTopWindow() = testSpec.appWindowReplacesLauncherAsTopWindow(testApp) @Presubmit @Test fun wallpaperWindowBecomesInvisible() = testSpec.wallpaperWindowBecomesInvisible() @Presubmit @Test // During testing the launcher is always in portrait mode fun noUncoveredRegions() = testSpec.noUncoveredRegions(testSpec.config.startRotation, Surface.ROTATION_0) @Presubmit @Test fun navBarLayerIsAlwaysVisible() = testSpec.navBarLayerIsAlwaysVisible() @Presubmit @Test fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsAlwaysVisible() @Presubmit @Test fun appLayerReplacesWallpaperLayer() = testSpec.appLayerReplacesWallpaperLayer(testApp.`package`) @Presubmit @Test fun navBarLayerRotatesAndScales() { Assume.assumeFalse(testSpec.isRotated) testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0) } @FlakyTest @Test fun navBarLayerRotatesAndScales_Flaky() { Assume.assumeTrue(testSpec.isRotated) testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0) transitions { testApp.launchViaIntent(wmHelper) wmHelper.waitForFullScreenApp(testApp.component) } @Presubmit @Test fun statusBarLayerRotatesScales() { Assume.assumeFalse(testSpec.isRotated) testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0) } @FlakyTest @Test fun statusBarLayerRotatesScales_Flaky() { Assume.assumeTrue(testSpec.isRotated) testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0) } @Presubmit @Test fun focusChanges() = testSpec.focusChanges("NexusLauncherActivity", testApp.`package`) override fun visibleWindowsShownMoreThanOneConsecutiveEntry() = super.visibleWindowsShownMoreThanOneConsecutiveEntry() companion object { @Parameterized.Parameters(name = "{0}") Loading Loading
tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppColdTest.kt +9 −121 Original line number Diff line number Diff line Loading @@ -16,37 +16,14 @@ package com.android.server.wm.flicker.launch import android.app.Instrumentation 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.FlickerBuilderProvider import com.android.server.wm.flicker.FlickerParametersRunnerFactory import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.focusChanges 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 com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry import com.android.server.wm.flicker.wallpaperWindowBecomesInvisible import com.android.server.wm.flicker.appLayerReplacesWallpaperLayer import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.helpers.SimpleAppHelper import org.junit.Assume import org.junit.FixMethodOrder import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.MethodSorters import org.junit.runners.Parameterized Loading @@ -59,115 +36,26 @@ import org.junit.runners.Parameterized @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) class OpenAppColdTest(private val testSpec: FlickerTestParameter) { private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation() private val testApp = SimpleAppHelper(instrumentation) @FlickerBuilderProvider fun buildFlicker(): FlickerBuilder { return FlickerBuilder(instrumentation).apply { withTestName { testSpec.name } repeat { testSpec.config.repetitions } class OpenAppColdTest(testSpec: FlickerTestParameter) : OpenAppTransition(testSpec) { override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { super.transition(this, it) setup { test { device.wakeUpAndGoToHomeScreen() } eachRun { this.setRotation(testSpec.config.startRotation) } } transitions { testApp.launchViaIntent(wmHelper) // wmHelper.waitForFullScreenApp(testApp.component) } teardown { eachRun { testApp.exit() wmHelper.waitForAppTransitionIdle() this.setRotation(Surface.ROTATION_0) } } } } @Presubmit @Test fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible() @Presubmit @Test fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible() @Presubmit @Test fun visibleWindowsShownMoreThanOneConsecutiveEntry() = testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry() @Presubmit @Test fun appWindowReplacesLauncherAsTopWindow() = testSpec.appWindowReplacesLauncherAsTopWindow(testApp) @Presubmit @Test fun wallpaperWindowBecomesInvisible() = testSpec.wallpaperWindowBecomesInvisible() @Presubmit @Test // During testing the launcher is always in portrait mode fun noUncoveredRegions() = testSpec.noUncoveredRegions(testSpec.config.startRotation, Surface.ROTATION_0) @Presubmit @Test fun navBarLayerIsAlwaysVisible() = testSpec.navBarLayerIsAlwaysVisible() @Presubmit @Test fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsAlwaysVisible() @Presubmit @Test fun appLayerReplacesWallpaperLayer() = testSpec.appLayerReplacesWallpaperLayer(testApp.`package`) @Presubmit @Test fun navBarLayerRotatesAndScales() { Assume.assumeFalse(testSpec.isRotated) testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0) testApp.exit(wmHelper) } @FlakyTest @Test fun navBarLayerRotatesAndScales_Flaky() { Assume.assumeTrue(testSpec.isRotated) testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0) } @Presubmit @Test fun statusBarLayerRotatesScales() { Assume.assumeFalse(testSpec.isRotated) testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0) transitions { testApp.launchViaIntent(wmHelper) wmHelper.waitForFullScreenApp(testApp.component) } @FlakyTest @Test fun statusBarLayerRotatesScales_Flaky() { Assume.assumeTrue(testSpec.isRotated) testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0) } @Presubmit @Test fun focusChanges() = testSpec.focusChanges("NexusLauncherActivity", testApp.`package`) @FlakyTest @Test fun visibleLayersShownMoreThanOneConsecutiveEntry() = testSpec.visibleLayersShownMoreThanOneConsecutiveEntry() companion object { @Parameterized.Parameters(name = "{0}") @JvmStatic Loading
tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromOverviewTest.kt +26 −75 Original line number Diff line number Diff line Loading @@ -16,36 +16,19 @@ package com.android.server.wm.flicker.launch import android.app.Instrumentation 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.FlickerBuilderProvider import com.android.server.wm.flicker.FlickerParametersRunnerFactory import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.endRotation import com.android.server.wm.flicker.focusChanges import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry import com.android.server.wm.flicker.helpers.reopenAppFromOverview 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 com.android.server.wm.flicker.wallpaperWindowBecomesInvisible import com.android.server.wm.flicker.appLayerReplacesWallpaperLayer import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.helpers.SimpleAppHelper import org.junit.Assume import org.junit.FixMethodOrder import org.junit.Test Loading @@ -61,18 +44,12 @@ import org.junit.runners.Parameterized @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) class OpenAppFromOverviewTest(private val testSpec: FlickerTestParameter) { private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation() private val testApp = SimpleAppHelper(instrumentation) @FlickerBuilderProvider fun buildFlicker(): FlickerBuilder { return FlickerBuilder(instrumentation).apply { withTestName { testSpec.name } repeat { testSpec.config.repetitions } class OpenAppFromOverviewTest(testSpec: FlickerTestParameter) : OpenAppTransition(testSpec) { override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { super.transition(this, it) setup { test { device.wakeUpAndGoToHomeScreen() testApp.launchViaIntent(wmHelper) } eachRun { Loading @@ -87,71 +64,50 @@ class OpenAppFromOverviewTest(private val testSpec: FlickerTestParameter) { device.reopenAppFromOverview(wmHelper) wmHelper.waitForFullScreenApp(testApp.component) } teardown { test { testApp.exit() } } } } @Presubmit @Test fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible() @Presubmit @Test fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible() override fun appWindowReplacesLauncherAsTopWindow() = super.appWindowReplacesLauncherAsTopWindow() @Test fun appWindowReplacesLauncherAsTopWindow() = testSpec.appWindowReplacesLauncherAsTopWindow(testApp) @Test fun wallpaperWindowBecomesInvisible() = testSpec.wallpaperWindowBecomesInvisible() @Presubmit @Test fun appLayerReplacesWallpaperLayer() = testSpec.appLayerReplacesWallpaperLayer(testApp.`package`) @Presubmit @Test fun navBarLayerRotatesAndScales() { Assume.assumeFalse(testSpec.isRotated) testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0) override fun wallpaperWindowBecomesInvisible() { testSpec.wallpaperWindowBecomesInvisible() } @Presubmit @Test fun statusBarLayerRotatesScales() { Assume.assumeFalse(testSpec.isRotated) testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0) override fun statusBarLayerIsAlwaysVisible() { Assume.assumeTrue(testSpec.isRotated) super.statusBarLayerIsAlwaysVisible() } @Presubmit @Test fun statusBarLayerIsAlwaysVisible() { override fun navBarLayerIsAlwaysVisible() { Assume.assumeTrue(testSpec.isRotated) testSpec.statusBarLayerIsAlwaysVisible() super.navBarLayerIsAlwaysVisible() } @Presubmit @FlakyTest @Test fun navBarLayerIsAlwaysVisible() { Assume.assumeTrue(testSpec.isRotated) testSpec.navBarLayerIsAlwaysVisible() fun statusBarLayerIsAlwaysVisible_Flaky() { Assume.assumeFalse(testSpec.isRotated) super.statusBarLayerIsAlwaysVisible() } @Presubmit @FlakyTest @Test fun focusChanges() = testSpec.focusChanges("NexusLauncherActivity", testApp.`package`) fun navBarLayerIsAlwaysVisible_Flaky() { Assume.assumeFalse(testSpec.isRotated) super.navBarLayerIsAlwaysVisible() } @Presubmit @Test fun visibleWindowsShownMoreThanOneConsecutiveEntry() { override fun visibleWindowsShownMoreThanOneConsecutiveEntry() { Assume.assumeFalse(testSpec.isRotated) testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry() super.visibleWindowsShownMoreThanOneConsecutiveEntry() } @FlakyTest Loading @@ -163,9 +119,9 @@ class OpenAppFromOverviewTest(private val testSpec: FlickerTestParameter) { @Presubmit @Test fun visibleLayersShownMoreThanOneConsecutiveEntry() { override fun visibleLayersShownMoreThanOneConsecutiveEntry() { Assume.assumeFalse(testSpec.isRotated) testSpec.visibleLayersShownMoreThanOneConsecutiveEntry() super.visibleLayersShownMoreThanOneConsecutiveEntry() } @FlakyTest Loading @@ -175,11 +131,6 @@ class OpenAppFromOverviewTest(private val testSpec: FlickerTestParameter) { testSpec.visibleLayersShownMoreThanOneConsecutiveEntry() } @Presubmit @Test fun noUncoveredRegions() = testSpec.noUncoveredRegions(Surface.ROTATION_0, testSpec.config.endRotation) companion object { @Parameterized.Parameters(name = "{0}") @JvmStatic Loading
tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppTransition.kt 0 → 100644 +170 −0 Original line number Diff line number Diff line /* * 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.server.wm.flicker.launch import android.app.Instrumentation import android.platform.test.annotations.Presubmit import android.view.Surface import androidx.test.filters.FlakyTest import androidx.test.platform.app.InstrumentationRegistry import com.android.server.wm.flicker.FlickerBuilderProvider import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.appLayerReplacesWallpaperLayer import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.endRotation import com.android.server.wm.flicker.focusChanges import com.android.server.wm.flicker.helpers.SimpleAppHelper import com.android.server.wm.flicker.helpers.StandardAppHelper 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 com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry import com.android.server.wm.flicker.wallpaperWindowBecomesInvisible import org.junit.Assume import org.junit.Test abstract class OpenAppTransition(protected val testSpec: FlickerTestParameter) { protected val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation() protected val testApp: StandardAppHelper = SimpleAppHelper(instrumentation) protected open val transition: FlickerBuilder.(Map<String, Any?>) -> Unit = { withTestName { testSpec.name } repeat { testSpec.config.repetitions } setup { test { device.wakeUpAndGoToHomeScreen() this.setRotation(testSpec.config.startRotation) } } teardown { test { testApp.exit() } } } @FlickerBuilderProvider fun buildFlicker(): FlickerBuilder { return FlickerBuilder(instrumentation).apply { transition(testSpec.config) } } @Presubmit @Test open fun navBarWindowIsAlwaysVisible() { testSpec.navBarWindowIsAlwaysVisible() } @Presubmit @Test open fun navBarLayerIsAlwaysVisible() { testSpec.navBarLayerIsAlwaysVisible() } @Presubmit @Test open fun navBarLayerRotatesAndScales() { Assume.assumeFalse(testSpec.isRotated) testSpec.navBarLayerRotatesAndScales(Surface.ROTATION_0, testSpec.config.endRotation) } @FlakyTest @Test open fun navBarLayerRotatesAndScales_Flaky() { Assume.assumeTrue(testSpec.isRotated) testSpec.navBarLayerRotatesAndScales(Surface.ROTATION_0, testSpec.config.endRotation) } @Presubmit @Test open fun statusBarWindowIsAlwaysVisible() { testSpec.statusBarWindowIsAlwaysVisible() } @Presubmit @Test open fun statusBarLayerIsAlwaysVisible() { testSpec.statusBarLayerIsAlwaysVisible() } @Presubmit @Test open fun statusBarLayerRotatesScales() { Assume.assumeFalse(testSpec.isRotated) testSpec.statusBarLayerRotatesScales(Surface.ROTATION_0, testSpec.config.endRotation) } @FlakyTest @Test open fun statusBarLayerRotatesScales_Flaky() { Assume.assumeTrue(testSpec.isRotated) testSpec.statusBarLayerRotatesScales(Surface.ROTATION_0, testSpec.config.endRotation) } @Presubmit @Test open fun visibleWindowsShownMoreThanOneConsecutiveEntry() { testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry() } @FlakyTest @Test open fun visibleLayersShownMoreThanOneConsecutiveEntry() { testSpec.visibleLayersShownMoreThanOneConsecutiveEntry() } @Presubmit @Test // During testing the launcher is always in portrait mode open fun noUncoveredRegions() { testSpec.noUncoveredRegions(Surface.ROTATION_0, testSpec.config.endRotation) } @Presubmit @Test open fun focusChanges() { testSpec.focusChanges("NexusLauncherActivity", testApp.`package`) } @Presubmit @Test open fun appLayerReplacesWallpaperLayer() { testSpec.appLayerReplacesWallpaperLayer(testApp.`package`) } @Presubmit @Test open fun appWindowReplacesLauncherAsTopWindow() { testSpec.appWindowReplacesLauncherAsTopWindow(testApp) } @Presubmit @Test open fun wallpaperWindowBecomesInvisible() { testSpec.wallpaperWindowBecomesInvisible() } } No newline at end of file
tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppWarmTest.kt +11 −110 Original line number Diff line number Diff line Loading @@ -16,34 +16,14 @@ package com.android.server.wm.flicker.launch import android.app.Instrumentation 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.FlickerBuilderProvider import com.android.server.wm.flicker.FlickerParametersRunnerFactory import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.focusChanges 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 com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry import com.android.server.wm.flicker.wallpaperWindowBecomesInvisible import com.android.server.wm.flicker.appLayerReplacesWallpaperLayer import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.helpers.SimpleAppHelper import org.junit.Assume import org.junit.FixMethodOrder import org.junit.Test import org.junit.runner.RunWith Loading @@ -58,20 +38,13 @@ import org.junit.runners.Parameterized @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) class OpenAppWarmTest(private val testSpec: FlickerTestParameter) { private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation() private val testApp = SimpleAppHelper(instrumentation) @FlickerBuilderProvider fun buildFlicker(): FlickerBuilder { return FlickerBuilder(instrumentation).apply { withTestName { testSpec.name } repeat { testSpec.config.repetitions } class OpenAppWarmTest(testSpec: FlickerTestParameter) : OpenAppTransition(testSpec) { override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { super.transition(this, it) setup { test { device.wakeUpAndGoToHomeScreen() testApp.launchViaIntent(wmHelper) // wmHelper.waitForFullScreenApp(testApp.component) } eachRun { device.pressHome() Loading @@ -79,93 +52,21 @@ class OpenAppWarmTest(private val testSpec: FlickerTestParameter) { this.setRotation(testSpec.config.startRotation) } } transitions { testApp.launchViaIntent(wmHelper) wmHelper.waitForFullScreenApp(testApp.component) } teardown { eachRun { this.setRotation(Surface.ROTATION_0) testApp.exit(wmHelper) } test { testApp.exit() } } } } @Presubmit @Test fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible() @Presubmit @Test fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible() @FlakyTest @Test fun visibleWindowsShownMoreThanOneConsecutiveEntry() = testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry() @Presubmit @Test fun appWindowReplacesLauncherAsTopWindow() = testSpec.appWindowReplacesLauncherAsTopWindow(testApp) @Presubmit @Test fun wallpaperWindowBecomesInvisible() = testSpec.wallpaperWindowBecomesInvisible() @Presubmit @Test // During testing the launcher is always in portrait mode fun noUncoveredRegions() = testSpec.noUncoveredRegions(testSpec.config.startRotation, Surface.ROTATION_0) @Presubmit @Test fun navBarLayerIsAlwaysVisible() = testSpec.navBarLayerIsAlwaysVisible() @Presubmit @Test fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsAlwaysVisible() @Presubmit @Test fun appLayerReplacesWallpaperLayer() = testSpec.appLayerReplacesWallpaperLayer(testApp.`package`) @Presubmit @Test fun navBarLayerRotatesAndScales() { Assume.assumeFalse(testSpec.isRotated) testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0) } @FlakyTest @Test fun navBarLayerRotatesAndScales_Flaky() { Assume.assumeTrue(testSpec.isRotated) testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0) transitions { testApp.launchViaIntent(wmHelper) wmHelper.waitForFullScreenApp(testApp.component) } @Presubmit @Test fun statusBarLayerRotatesScales() { Assume.assumeFalse(testSpec.isRotated) testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0) } @FlakyTest @Test fun statusBarLayerRotatesScales_Flaky() { Assume.assumeTrue(testSpec.isRotated) testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0) } @Presubmit @Test fun focusChanges() = testSpec.focusChanges("NexusLauncherActivity", testApp.`package`) override fun visibleWindowsShownMoreThanOneConsecutiveEntry() = super.visibleWindowsShownMoreThanOneConsecutiveEntry() companion object { @Parameterized.Parameters(name = "{0}") Loading