diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/ChangeAppRotationTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/ChangeAppRotationTest.kt index 11dfeb57ef070..aa6a5a0eb8316 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/ChangeAppRotationTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/ChangeAppRotationTest.kt @@ -25,9 +25,6 @@ import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.annotation.Group3 import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.helpers.SimpleAppHelper -import com.android.server.wm.flicker.statusBarLayerIsVisible -import com.android.server.wm.flicker.statusBarLayerRotatesScales -import com.android.server.wm.flicker.statusBarWindowIsVisible import com.android.server.wm.traces.common.ComponentMatcher import org.junit.FixMethodOrder import org.junit.Test @@ -126,38 +123,17 @@ class ChangeAppRotationTest( rotationLayerAppearsAndVanishesAssertion() } - /** - * Checks that the status bar window is visible and above the app windows in all WM - * trace entries - */ - @Presubmit - @Test - fun statusBarWindowIsVisible() { - testSpec.statusBarWindowIsVisible() - } - - /** - * Checks that the status bar layer is visible at the start and end of the transition - */ - @Presubmit - @Test - fun statusBarLayerIsVisible() { - testSpec.statusBarLayerIsVisible() - } - - /** - * Checks the position of the status bar at the start and end of the transition - */ + /** {@inheritDoc} */ @FlakyTest(bugId = 206753786) @Test - fun statusBarLayerRotatesScales() = testSpec.statusBarLayerRotatesScales() + override fun statusBarLayerPositionAtStartAndEnd() = + super.statusBarLayerPositionAtStartAndEnd() /** {@inheritDoc} */ @FlakyTest @Test - override fun navBarLayerRotatesAndScales() { - super.navBarLayerRotatesAndScales() - } + override fun navBarLayerPositionAtStartAndEnd() = + super.navBarLayerPositionAtStartAndEnd() /** {@inheritDoc} */ @FlakyTest diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/RotationTransition.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/RotationTransition.kt index 4b094247bdb3c..36a152117dcc1 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/RotationTransition.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/RotationTransition.kt @@ -16,30 +16,23 @@ package com.android.server.wm.flicker.rotation -import android.app.Instrumentation import android.platform.test.annotations.Presubmit -import androidx.test.platform.app.InstrumentationRegistry -import com.android.server.wm.flicker.FlickerBuilderProvider +import com.android.server.wm.flicker.BaseTest import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.dsl.FlickerBuilder -import com.android.server.wm.flicker.entireScreenCovered import com.android.server.wm.flicker.helpers.StandardAppHelper import com.android.server.wm.flicker.helpers.setRotation -import com.android.server.wm.flicker.navBarLayerIsVisible -import com.android.server.wm.flicker.navBarLayerRotatesAndScales -import com.android.server.wm.flicker.navBarWindowIsVisible import com.android.server.wm.traces.common.ComponentMatcher import org.junit.Test /** * Base class for app rotation tests */ -abstract class RotationTransition(protected val testSpec: FlickerTestParameter) { +abstract class RotationTransition(testSpec: FlickerTestParameter) : BaseTest(testSpec) { protected abstract val testApp: StandardAppHelper - protected val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation() - - protected open val transition: FlickerBuilder.() -> Unit = { + /** {@inheritDoc} */ + override val transition: FlickerBuilder.() -> Unit = { setup { eachRun { this.setRotation(testSpec.startRotation) @@ -55,53 +48,14 @@ abstract class RotationTransition(protected val testSpec: FlickerTestParameter) } } - /** - * Entry point for the test runner. It will use this method to initialize and cache - * flicker executions - */ - @FlickerBuilderProvider - fun buildFlicker(): FlickerBuilder { - return FlickerBuilder(instrumentation).apply { - transition() - } - } - - /** - * Checks that the navigation bar window is visible and above the app windows in all WM - * trace entries - */ + /** {@inheritDoc} */ @Presubmit @Test - open fun navBarWindowIsVisible() { - testSpec.navBarWindowIsVisible() - } - - /** - * Checks that the navigation bar layer is visible at the start and end of the transition - */ - @Presubmit - @Test - open fun navBarLayerIsVisible() { - testSpec.navBarLayerIsVisible() - } - - /** - * Checks the position of the navigation bar at the start and end of the transition - */ - @Presubmit - @Test - open fun navBarLayerRotatesAndScales() = testSpec.navBarLayerRotatesAndScales() - - /** - * Checks that all layers that are visible on the trace, are visible for at least 2 - * consecutive entries. - */ - @Presubmit - @Test - open fun visibleLayersShownMoreThanOneConsecutiveEntry() { + override fun visibleLayersShownMoreThanOneConsecutiveEntry() { testSpec.assertLayers { this.visibleLayersShownMoreThanOneConsecutiveEntry( - ignoreLayers = listOf(ComponentMatcher.SPLASH_SCREEN, + ignoreLayers = listOf( + ComponentMatcher.SPLASH_SCREEN, ComponentMatcher.SNAPSHOT, ComponentMatcher("", "SecondaryHomeHandle") ) @@ -109,25 +63,6 @@ abstract class RotationTransition(protected val testSpec: FlickerTestParameter) } } - /** - * Checks that all windows that are visible on the trace, are visible for at least 2 - * consecutive entries. - */ - @Presubmit - @Test - open fun visibleWindowsShownMoreThanOneConsecutiveEntry() { - testSpec.assertWm { - this.visibleWindowsShownMoreThanOneConsecutiveEntry() - } - } - - /** - * Checks that all parts of the screen are covered during the transition - */ - @Presubmit - @Test - open fun entireScreenCovered() = testSpec.entireScreenCovered() - /** * Checks that [testApp] layer covers the entire screen at the start of the transition */ diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/SeamlessAppRotationTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/SeamlessAppRotationTest.kt index 09be7eec71d1a..b2a2381c55789 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/SeamlessAppRotationTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/SeamlessAppRotationTest.kt @@ -29,6 +29,7 @@ import com.android.server.wm.flicker.helpers.SeamlessRotationAppHelper import com.android.server.wm.flicker.testapp.ActivityOptions import com.android.server.wm.traces.common.ComponentMatcher import org.junit.FixMethodOrder +import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.MethodSorters @@ -81,14 +82,18 @@ open class SeamlessAppRotationTest( ) : RotationTransition(testSpec) { override val testApp = SeamlessRotationAppHelper(instrumentation) + /** {@inheritDoc} */ override val transition: FlickerBuilder.() -> Unit get() = { super.transition(this) setup { test { - testApp.launchViaIntent(wmHelper, - stringExtras = mapOf(ActivityOptions.EXTRA_STARVE_UI_THREAD - to testSpec.starveUiThread.toString()) + testApp.launchViaIntent( + wmHelper, + stringExtras = mapOf( + ActivityOptions.EXTRA_STARVE_UI_THREAD + to testSpec.starveUiThread.toString() + ) ) } } @@ -122,8 +127,10 @@ open class SeamlessAppRotationTest( val appWindow = it.windowState(testApp.`package`) val rotationAnimation = appWindow.windowState?.attributes?.rotationAnimation ?: 0 appWindow.verify("isRotationSeamless") - .that(rotationAnimation - .and(WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLESS)) + .that( + rotationAnimation + .and(WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLESS) + ) .isGreaterThan(0) } } @@ -156,6 +163,18 @@ open class SeamlessAppRotationTest( } } + /** {@inheritDoc} */ + @Ignore("Not applicable to this CUJ. App is full screen") + override fun statusBarLayerPositionAtStartAndEnd() { } + + /** {@inheritDoc} */ + @Ignore("Not applicable to this CUJ. App is full screen") + override fun statusBarLayerIsVisibleAtStartAndEnd() { } + + /** {@inheritDoc} */ + @Ignore("Not applicable to this CUJ. App is full screen") + override fun statusBarWindowIsAlwaysVisible() { } + /** * Checks that the [ComponentMatcher.STATUS_BAR] window is invisible during the whole * transition @@ -194,7 +213,7 @@ open class SeamlessAppRotationTest( /** {@inheritDoc} */ @FlakyTest @Test - override fun navBarLayerRotatesAndScales() = super.navBarLayerRotatesAndScales() + override fun navBarLayerPositionAtStartAndEnd() = super.navBarLayerPositionAtStartAndEnd() companion object { private val FlickerTestParameter.starveUiThread