Add support for Tablets on quick switch tests
Moreover, refactor the test to reuse the base test class with general assertions and fix ktlint errors Bug: 234735502 Test: atest FlickerTests Change-Id: I536b3993621b4817efd04c781a9048f87c24b558
This commit is contained in:
@@ -16,15 +16,13 @@
|
||||
|
||||
package com.android.server.wm.flicker.quickswitch
|
||||
|
||||
import android.app.Instrumentation
|
||||
import android.platform.test.annotations.FlakyTest
|
||||
import android.platform.test.annotations.Postsubmit
|
||||
import android.platform.test.annotations.Presubmit
|
||||
import android.platform.test.annotations.RequiresDevice
|
||||
import android.view.Surface
|
||||
import android.view.WindowManagerPolicyConstants
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import com.android.launcher3.tapl.LauncherInstrumentation
|
||||
import com.android.server.wm.flicker.FlickerBuilderProvider
|
||||
import com.android.server.wm.flicker.BaseTest
|
||||
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
|
||||
import com.android.server.wm.flicker.FlickerTestParameter
|
||||
import com.android.server.wm.flicker.FlickerTestParameterFactory
|
||||
@@ -33,11 +31,6 @@ import com.android.server.wm.flicker.dsl.FlickerBuilder
|
||||
import com.android.server.wm.flicker.helpers.NonResizeableAppHelper
|
||||
import com.android.server.wm.flicker.helpers.SimpleAppHelper
|
||||
import com.android.server.wm.flicker.helpers.isShellTransitionsEnabled
|
||||
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.flicker.statusBarLayerIsVisible
|
||||
import com.android.server.wm.flicker.statusBarWindowIsVisible
|
||||
import com.android.server.wm.traces.common.ComponentMatcher
|
||||
import com.android.server.wm.traces.common.Rect
|
||||
import org.junit.Assume
|
||||
@@ -64,10 +57,9 @@ import org.junit.runners.Parameterized
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
@Group1
|
||||
open class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestParameter) {
|
||||
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
private val tapl = LauncherInstrumentation()
|
||||
|
||||
open class QuickSwitchBetweenTwoAppsBackTest(
|
||||
testSpec: FlickerTestParameter
|
||||
) : BaseTest(testSpec) {
|
||||
private val testApp1 = SimpleAppHelper(instrumentation)
|
||||
private val testApp2 = NonResizeableAppHelper(instrumentation)
|
||||
|
||||
@@ -76,32 +68,31 @@ open class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestPa
|
||||
Assume.assumeFalse(isShellTransitionsEnabled)
|
||||
}
|
||||
|
||||
@FlickerBuilderProvider
|
||||
fun buildFlicker(): FlickerBuilder {
|
||||
return FlickerBuilder(instrumentation).apply {
|
||||
setup {
|
||||
test {
|
||||
tapl.setExpectedRotation(testSpec.startRotation)
|
||||
}
|
||||
eachRun {
|
||||
testApp1.launchViaIntent(wmHelper)
|
||||
testApp2.launchViaIntent(wmHelper)
|
||||
startDisplayBounds = wmHelper.currentState.layerState
|
||||
.physicalDisplayBounds ?: error("Display not found")
|
||||
}
|
||||
/** {@inheritDoc} */
|
||||
override val transition: FlickerBuilder.() -> Unit = {
|
||||
setup {
|
||||
test {
|
||||
tapl.setExpectedRotation(testSpec.startRotation)
|
||||
}
|
||||
transitions {
|
||||
tapl.launchedAppState.quickSwitchToPreviousApp()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withNavBarStatusBarVisible()
|
||||
.waitForAndVerify()
|
||||
eachRun {
|
||||
testApp1.launchViaIntent(wmHelper)
|
||||
testApp2.launchViaIntent(wmHelper)
|
||||
startDisplayBounds = wmHelper.currentState.layerState
|
||||
.physicalDisplayBounds ?: error("Display not found")
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
tapl.launchedAppState.quickSwitchToPreviousApp()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withNavOrTaskBarVisible()
|
||||
.withStatusBarVisible()
|
||||
.waitForAndVerify()
|
||||
}
|
||||
|
||||
teardown {
|
||||
test {
|
||||
testApp1.exit(wmHelper)
|
||||
testApp2.exit(wmHelper)
|
||||
}
|
||||
teardown {
|
||||
test {
|
||||
testApp1.exit(wmHelper)
|
||||
testApp2.exit(wmHelper)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -142,8 +133,8 @@ open class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestPa
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [testApp1] windows fill the entire screen (i.e. is "fullscreen") at the end of the
|
||||
* transition once we have fully quick switched from [testApp2] back to the [testApp1].
|
||||
* Checks that [testApp1] windows fill the entire screen (i.e. is "fullscreen") at the end of
|
||||
* the transition once we have fully quick switched from [testApp2] back to the [testApp1].
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
@@ -154,8 +145,8 @@ open class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestPa
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [testApp1] layers fill the entire screen (i.e. is "fullscreen") at the end of the
|
||||
* transition once we have fully quick switched from [testApp2] back to the [testApp1].
|
||||
* Checks that [testApp1] layers fill the entire screen (i.e. is "fullscreen") at the end of
|
||||
* the transition once we have fully quick switched from [testApp2] back to the [testApp1].
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
@@ -166,8 +157,8 @@ open class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestPa
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [testApp1] is the top window at the end of the transition once we have fully quick
|
||||
* switched from [testApp2] back to the [testApp1].
|
||||
* Checks that [testApp1] is the top window at the end of the transition once we have fully
|
||||
* quick switched from [testApp2] back to the [testApp1].
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
@@ -178,60 +169,60 @@ open class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestPa
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [testApp1]'s window starts off invisible and becomes visible at some point before
|
||||
* the end of the transition and then stays visible until the end of the transition.
|
||||
* Checks that [testApp1]'s window starts off invisible and becomes visible at some point
|
||||
* before the end of the transition and then stays visible until the end of the transition.
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
fun app1WindowBecomesAndStaysVisible() {
|
||||
testSpec.assertWm {
|
||||
this.isAppWindowInvisible(testApp1)
|
||||
.then()
|
||||
.isAppWindowVisible(ComponentMatcher.SNAPSHOT, isOptional = true)
|
||||
.then()
|
||||
.isAppWindowVisible(testApp1)
|
||||
.then()
|
||||
.isAppWindowVisible(ComponentMatcher.SNAPSHOT, isOptional = true)
|
||||
.then()
|
||||
.isAppWindowVisible(testApp1)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [testApp1]'s layer starts off invisible and becomes visible at some point before
|
||||
* the end of the transition and then stays visible until the end of the transition.
|
||||
* Checks that [testApp1]'s layer starts off invisible and becomes visible at some point
|
||||
* before the end of the transition and then stays visible until the end of the transition.
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
fun app1LayerBecomesAndStaysVisible() {
|
||||
testSpec.assertLayers {
|
||||
this.isInvisible(testApp1)
|
||||
.then()
|
||||
.isVisible(testApp1)
|
||||
.then()
|
||||
.isVisible(testApp1)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [testApp2]'s window starts off visible and becomes invisible at some point before
|
||||
* the end of the transition and then stays invisible until the end of the transition.
|
||||
* Checks that [testApp2]'s window starts off visible and becomes invisible at some point
|
||||
* before the end of the transition and then stays invisible until the end of the transition.
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
fun app2WindowBecomesAndStaysInvisible() {
|
||||
testSpec.assertWm {
|
||||
this.isAppWindowVisible(testApp2)
|
||||
.then()
|
||||
.isAppWindowInvisible(testApp2)
|
||||
.then()
|
||||
.isAppWindowInvisible(testApp2)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [testApp2]'s layer starts off visible and becomes invisible at some point before
|
||||
* the end of the transition and then stays invisible until the end of the transition.
|
||||
* Checks that [testApp2]'s layer starts off visible and becomes invisible at some point
|
||||
* before the end of the transition and then stays invisible until the end of the transition.
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
fun app2LayerBecomesAndStaysInvisible() {
|
||||
testSpec.assertLayers {
|
||||
this.isVisible(testApp2)
|
||||
.then()
|
||||
.isInvisible(testApp2)
|
||||
.then()
|
||||
.isInvisible(testApp2)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,13 +236,13 @@ open class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestPa
|
||||
fun app1WindowIsVisibleOnceApp2WindowIsInvisible() {
|
||||
testSpec.assertWm {
|
||||
this.isAppWindowVisible(testApp2)
|
||||
.then()
|
||||
// TODO: Do we actually want to test this? Seems too implementation specific...
|
||||
.isAppWindowVisible(ComponentMatcher.LAUNCHER, isOptional = true)
|
||||
.then()
|
||||
.isAppWindowVisible(ComponentMatcher.SNAPSHOT, isOptional = true)
|
||||
.then()
|
||||
.isAppWindowVisible(testApp1)
|
||||
.then()
|
||||
// TODO: Do we actually want to test this? Seems too implementation specific...
|
||||
.isAppWindowVisible(ComponentMatcher.LAUNCHER, isOptional = true)
|
||||
.then()
|
||||
.isAppWindowVisible(ComponentMatcher.SNAPSHOT, isOptional = true)
|
||||
.then()
|
||||
.isAppWindowVisible(testApp1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,51 +256,25 @@ open class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestPa
|
||||
fun app1LayerIsVisibleOnceApp2LayerIsInvisible() {
|
||||
testSpec.assertLayers {
|
||||
this.isVisible(testApp2)
|
||||
.then()
|
||||
.isVisible(ComponentMatcher.LAUNCHER, isOptional = true)
|
||||
.then()
|
||||
.isVisible(ComponentMatcher.SNAPSHOT, isOptional = true)
|
||||
.then()
|
||||
.isVisible(testApp1)
|
||||
.then()
|
||||
.isVisible(ComponentMatcher.LAUNCHER, isOptional = true)
|
||||
.then()
|
||||
.isVisible(ComponentMatcher.SNAPSHOT, isOptional = true)
|
||||
.then()
|
||||
.isVisible(testApp1)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the navbar window is visible throughout the entire transition.
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsVisible()
|
||||
|
||||
/**
|
||||
* Checks that the navbar layer is visible throughout the entire transition.
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
fun navBarLayerAlwaysIsVisible() = testSpec.navBarLayerIsVisible()
|
||||
|
||||
/**
|
||||
* Checks that the navbar is always in the right position and covers the expected region.
|
||||
*
|
||||
* NOTE: This doesn't check that the navbar is visible or not.
|
||||
*/
|
||||
/** {@inheritDoc} */
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun navbarIsAlwaysInRightPosition() = testSpec.navBarLayerRotatesAndScales()
|
||||
override fun navBarLayerPositionAtStartAndEnd() = super.navBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/**
|
||||
* Checks that the status bar window is visible throughout the entire transition.
|
||||
*/
|
||||
@Presubmit
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsVisible()
|
||||
|
||||
/**
|
||||
* Checks that the status bar layer is visible throughout the entire transition.
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsVisible()
|
||||
override fun statusBarLayerIsVisibleAtStartAndEnd() =
|
||||
super.statusBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
companion object {
|
||||
private var startDisplayBounds = Rect.EMPTY
|
||||
@@ -318,13 +283,13 @@ open class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestPa
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(
|
||||
repetitions = 3,
|
||||
supportedNavigationModes = listOf(
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
|
||||
),
|
||||
supportedRotations = listOf(Surface.ROTATION_0, Surface.ROTATION_90)
|
||||
)
|
||||
.getConfigNonRotationTests(
|
||||
repetitions = 3,
|
||||
supportedNavigationModes = listOf(
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
|
||||
),
|
||||
supportedRotations = listOf(Surface.ROTATION_0, Surface.ROTATION_90)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,15 +16,13 @@
|
||||
|
||||
package com.android.server.wm.flicker.quickswitch
|
||||
|
||||
import android.app.Instrumentation
|
||||
import android.platform.test.annotations.FlakyTest
|
||||
import android.platform.test.annotations.Postsubmit
|
||||
import android.platform.test.annotations.Presubmit
|
||||
import android.platform.test.annotations.RequiresDevice
|
||||
import android.view.Surface
|
||||
import android.view.WindowManagerPolicyConstants
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import com.android.launcher3.tapl.LauncherInstrumentation
|
||||
import com.android.server.wm.flicker.FlickerBuilderProvider
|
||||
import com.android.server.wm.flicker.BaseTest
|
||||
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
|
||||
import com.android.server.wm.flicker.FlickerTestParameter
|
||||
import com.android.server.wm.flicker.FlickerTestParameterFactory
|
||||
@@ -33,11 +31,6 @@ import com.android.server.wm.flicker.dsl.FlickerBuilder
|
||||
import com.android.server.wm.flicker.helpers.NonResizeableAppHelper
|
||||
import com.android.server.wm.flicker.helpers.SimpleAppHelper
|
||||
import com.android.server.wm.flicker.helpers.isShellTransitionsEnabled
|
||||
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.flicker.statusBarLayerIsVisible
|
||||
import com.android.server.wm.flicker.statusBarWindowIsVisible
|
||||
import com.android.server.wm.traces.common.ComponentMatcher
|
||||
import com.android.server.wm.traces.common.Rect
|
||||
import org.junit.Assume
|
||||
@@ -64,10 +57,9 @@ import org.junit.runners.Parameterized
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
@Group1
|
||||
open class QuickSwitchBetweenTwoAppsForwardTest(private val testSpec: FlickerTestParameter) {
|
||||
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
private val tapl = LauncherInstrumentation()
|
||||
|
||||
open class QuickSwitchBetweenTwoAppsForwardTest(
|
||||
testSpec: FlickerTestParameter
|
||||
) : BaseTest(testSpec) {
|
||||
private val testApp1 = SimpleAppHelper(instrumentation)
|
||||
private val testApp2 = NonResizeableAppHelper(instrumentation)
|
||||
|
||||
@@ -76,36 +68,36 @@ open class QuickSwitchBetweenTwoAppsForwardTest(private val testSpec: FlickerTes
|
||||
Assume.assumeFalse(isShellTransitionsEnabled)
|
||||
}
|
||||
|
||||
@FlickerBuilderProvider
|
||||
fun buildFlicker(): FlickerBuilder {
|
||||
return FlickerBuilder(instrumentation).apply {
|
||||
setup {
|
||||
test {
|
||||
tapl.setExpectedRotation(testSpec.startRotation)
|
||||
}
|
||||
eachRun {
|
||||
testApp1.launchViaIntent(wmHelper)
|
||||
testApp2.launchViaIntent(wmHelper)
|
||||
tapl.launchedAppState.quickSwitchToPreviousApp()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withNavBarStatusBarVisible()
|
||||
.waitForAndVerify()
|
||||
startDisplayBounds = wmHelper.currentState.layerState
|
||||
.physicalDisplayBounds ?: error("Display not found")
|
||||
}
|
||||
/** {@inheritDoc} */
|
||||
override val transition: FlickerBuilder.() -> Unit = {
|
||||
setup {
|
||||
test {
|
||||
tapl.setExpectedRotation(testSpec.startRotation)
|
||||
}
|
||||
transitions {
|
||||
tapl.launchedAppState.quickSwitchToPreviousAppSwipeLeft()
|
||||
eachRun {
|
||||
testApp1.launchViaIntent(wmHelper)
|
||||
testApp2.launchViaIntent(wmHelper)
|
||||
tapl.launchedAppState.quickSwitchToPreviousApp()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withNavBarStatusBarVisible()
|
||||
.withNavOrTaskBarVisible()
|
||||
.withStatusBarVisible()
|
||||
.waitForAndVerify()
|
||||
startDisplayBounds = wmHelper.currentState.layerState
|
||||
.physicalDisplayBounds ?: error("Display not found")
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
tapl.launchedAppState.quickSwitchToPreviousAppSwipeLeft()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withNavOrTaskBarVisible()
|
||||
.withStatusBarVisible()
|
||||
.waitForAndVerify()
|
||||
}
|
||||
|
||||
teardown {
|
||||
test {
|
||||
testApp1.exit(wmHelper)
|
||||
testApp2.exit(wmHelper)
|
||||
}
|
||||
teardown {
|
||||
test {
|
||||
testApp1.exit(wmHelper)
|
||||
testApp2.exit(wmHelper)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -279,52 +271,28 @@ open class QuickSwitchBetweenTwoAppsForwardTest(private val testSpec: FlickerTes
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the navbar window is visible throughout the entire transition.
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun navBarWindowIsAlwaysVisible() {
|
||||
testSpec.navBarWindowIsVisible()
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the navbar layer is visible throughout the entire transition.
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun navBarLayerAlwaysIsVisible() {
|
||||
testSpec.navBarLayerIsVisible()
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the navbar is always in the right position and covers the expected region.
|
||||
*
|
||||
* NOTE: This doesn't check that the navbar is visible or not.
|
||||
*/
|
||||
/** {@inheritDoc} */
|
||||
@FlakyTest
|
||||
@Test
|
||||
open fun navbarIsAlwaysInRightPosition() {
|
||||
testSpec.navBarLayerRotatesAndScales()
|
||||
}
|
||||
override fun navBarLayerPositionAtStartAndEnd() = super.navBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/**
|
||||
* Checks that the status bar window is visible throughout the entire transition.
|
||||
*/
|
||||
@Presubmit
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
open fun statusBarWindowIsAlwaysVisible() {
|
||||
testSpec.statusBarWindowIsVisible()
|
||||
}
|
||||
override fun visibleLayersShownMoreThanOneConsecutiveEntry() =
|
||||
super.visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
/**
|
||||
* Checks that the status bar layer is visible throughout the entire transition.
|
||||
*/
|
||||
@Presubmit
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
open fun statusBarLayerIsAlwaysVisible() {
|
||||
testSpec.statusBarLayerIsVisible()
|
||||
}
|
||||
override fun statusBarLayerPositionAtStartAndEnd() =
|
||||
super.statusBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
|
||||
super.visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
companion object {
|
||||
private var startDisplayBounds = Rect.EMPTY
|
||||
|
||||
@@ -16,26 +16,18 @@
|
||||
|
||||
package com.android.server.wm.flicker.quickswitch
|
||||
|
||||
import android.app.Instrumentation
|
||||
import android.platform.test.annotations.Postsubmit
|
||||
import android.platform.test.annotations.Presubmit
|
||||
import android.platform.test.annotations.RequiresDevice
|
||||
import android.view.Surface
|
||||
import android.view.WindowManagerPolicyConstants
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import com.android.launcher3.tapl.LauncherInstrumentation
|
||||
import com.android.server.wm.flicker.FlickerBuilderProvider
|
||||
import com.android.server.wm.flicker.BaseTest
|
||||
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.annotation.Group1
|
||||
import com.android.server.wm.flicker.dsl.FlickerBuilder
|
||||
import com.android.server.wm.flicker.entireScreenCovered
|
||||
import com.android.server.wm.flicker.helpers.SimpleAppHelper
|
||||
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.flicker.statusBarLayerIsVisible
|
||||
import com.android.server.wm.flicker.statusBarWindowIsVisible
|
||||
import com.android.server.wm.traces.common.ComponentMatcher
|
||||
import com.android.server.wm.traces.common.Rect
|
||||
import org.junit.FixMethodOrder
|
||||
@@ -60,44 +52,40 @@ import org.junit.runners.Parameterized
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
@Group1
|
||||
class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
|
||||
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
private val taplInstrumentation = LauncherInstrumentation()
|
||||
|
||||
class QuickSwitchFromLauncherTest(testSpec: FlickerTestParameter) : BaseTest(testSpec) {
|
||||
private val testApp = SimpleAppHelper(instrumentation)
|
||||
|
||||
@FlickerBuilderProvider
|
||||
fun buildFlicker(): FlickerBuilder {
|
||||
return FlickerBuilder(instrumentation).apply {
|
||||
setup {
|
||||
test {
|
||||
taplInstrumentation.setExpectedRotation(testSpec.startRotation)
|
||||
}
|
||||
|
||||
eachRun {
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
device.pressHome()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withHomeActivityVisible()
|
||||
.withWindowSurfaceDisappeared(testApp)
|
||||
.waitForAndVerify()
|
||||
|
||||
startDisplayBounds = wmHelper.currentState.layerState
|
||||
.physicalDisplayBounds ?: error("Display not found")
|
||||
}
|
||||
/** {@inheritDoc} */
|
||||
override val transition: FlickerBuilder.() -> Unit = {
|
||||
setup {
|
||||
test {
|
||||
tapl.setExpectedRotation(testSpec.startRotation)
|
||||
}
|
||||
transitions {
|
||||
taplInstrumentation.workspace.quickSwitchToPreviousApp()
|
||||
|
||||
eachRun {
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
device.pressHome()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withFullScreenApp(testApp)
|
||||
.withNavBarStatusBarVisible()
|
||||
.withHomeActivityVisible()
|
||||
.withWindowSurfaceDisappeared(testApp)
|
||||
.waitForAndVerify()
|
||||
}
|
||||
|
||||
teardown {
|
||||
eachRun {
|
||||
testApp.exit(wmHelper)
|
||||
}
|
||||
startDisplayBounds = wmHelper.currentState.layerState
|
||||
.physicalDisplayBounds ?: error("Display not found")
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
tapl.workspace.quickSwitchToPreviousApp()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withFullScreenApp(testApp)
|
||||
.withNavOrTaskBarVisible()
|
||||
.withStatusBarVisible()
|
||||
.waitForAndVerify()
|
||||
}
|
||||
|
||||
teardown {
|
||||
eachRun {
|
||||
testApp.exit(wmHelper)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,8 +138,8 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the transition starts with the launcher windows filling/covering exactly the
|
||||
* entirety of the display.
|
||||
* Checks that the transition starts with the [ComponentMatcher.LAUNCHER] windows
|
||||
* filling/covering exactly display size
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
@@ -162,8 +150,8 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the transition starts with the launcher layers filling/covering exactly the
|
||||
* entirety of the display.
|
||||
* Checks that the transition starts with the [ComponentMatcher.LAUNCHER] layers
|
||||
* filling/covering exactly the display size.
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
@@ -174,7 +162,7 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the transition starts with the launcher being the top window.
|
||||
* Checks that the transition starts with the [ComponentMatcher.LAUNCHER] being the top window.
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
@@ -225,7 +213,8 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the launcher window starts off visible and becomes invisible at some point before
|
||||
* Checks that the [ComponentMatcher.LAUNCHER] window starts off visible and becomes invisible
|
||||
* at some point before
|
||||
* the end of the transition and then stays invisible until the end of the transition.
|
||||
*/
|
||||
@Presubmit
|
||||
@@ -239,7 +228,8 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the launcher layer starts off visible and becomes invisible at some point before
|
||||
* Checks that the [ComponentMatcher.LAUNCHER] layer starts off visible and becomes invisible
|
||||
* at some point before
|
||||
* the end of the transition and then stays invisible until the end of the transition.
|
||||
*/
|
||||
@Presubmit
|
||||
@@ -253,7 +243,8 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the launcher window is visible at least until the app window is visible. Ensures
|
||||
* Checks that the [ComponentMatcher.LAUNCHER] window is visible at least until the app window
|
||||
* is visible. Ensures
|
||||
* that at any point, either the launcher or [testApp] windows are at least partially visible.
|
||||
*/
|
||||
@Presubmit
|
||||
@@ -269,8 +260,9 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the launcher layer is visible at least until the app layer is visible. Ensures
|
||||
* that at any point, either the launcher or [testApp] layers are at least partially visible.
|
||||
* Checks that the [ComponentMatcher.LAUNCHER] layer is visible at least until the app layer
|
||||
* is visible. Ensures that at any point, either the launcher or [testApp] layers are at least
|
||||
* partially visible.
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
@@ -284,49 +276,28 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the navbar window is visible throughout the entire transition.
|
||||
*/
|
||||
@Presubmit
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsVisible()
|
||||
override fun statusBarLayerPositionAtStartAndEnd() =
|
||||
super.statusBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/**
|
||||
* Checks that the navbar layer is visible throughout the entire transition.
|
||||
*/
|
||||
@Presubmit
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun navBarLayerAlwaysIsVisible() = testSpec.navBarLayerIsVisible()
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() = super.taskBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
/**
|
||||
* Checks that the navbar is always in the right position and covers the expected region.
|
||||
*
|
||||
* NOTE: This doesn't check that the navbar is visible or not.
|
||||
*/
|
||||
@Presubmit
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun navbarIsAlwaysInRightPosition() = testSpec.navBarLayerRotatesAndScales()
|
||||
override fun visibleLayersShownMoreThanOneConsecutiveEntry() =
|
||||
super.visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
/**
|
||||
* Checks that the status bar window is visible throughout the entire transition.
|
||||
*/
|
||||
@Presubmit
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsVisible()
|
||||
|
||||
/**
|
||||
* Checks that the status bar layer is visible throughout the entire transition.
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsVisible()
|
||||
|
||||
/**
|
||||
* Checks that the screen is always fully covered by visible layers throughout the transition.
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
fun screenIsAlwaysFilled() = testSpec.entireScreenCovered()
|
||||
override fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
|
||||
super.visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
companion object {
|
||||
private var startDisplayBounds = Rect.EMPTY
|
||||
|
||||
Reference in New Issue
Block a user