Merge "Fix code formatting according to ktfmt rules"
This commit is contained in:
committed by
Android (Google) Code Review
commit
9756b369cc
@@ -38,50 +38,44 @@ import org.junit.Test
|
||||
|
||||
/**
|
||||
* Base test class containing common assertions for [ComponentMatcher.NAV_BAR],
|
||||
* [ComponentMatcher.TASK_BAR], [ComponentMatcher.STATUS_BAR], and general assertions
|
||||
* (layers visible in consecutive states, entire screen covered, etc.)
|
||||
* [ComponentMatcher.TASK_BAR], [ComponentMatcher.STATUS_BAR], and general assertions (layers
|
||||
* visible in consecutive states, entire screen covered, etc.)
|
||||
*/
|
||||
abstract class BaseTest @JvmOverloads constructor(
|
||||
abstract class BaseTest
|
||||
@JvmOverloads
|
||||
constructor(
|
||||
protected val testSpec: FlickerTestParameter,
|
||||
protected val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation(),
|
||||
protected val tapl: LauncherInstrumentation = LauncherInstrumentation()
|
||||
) {
|
||||
init {
|
||||
testSpec.setIsTablet(
|
||||
WindowManagerStateHelper(
|
||||
instrumentation,
|
||||
clearCacheAfterParsing = false
|
||||
).currentState.wmState.isTablet
|
||||
WindowManagerStateHelper(instrumentation, clearCacheAfterParsing = false)
|
||||
.currentState
|
||||
.wmState
|
||||
.isTablet
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Specification of the test transition to execute
|
||||
*/
|
||||
/** Specification of the test transition to execute */
|
||||
abstract val transition: FlickerBuilder.() -> Unit
|
||||
|
||||
/**
|
||||
* Entry point for the test runner. It will use this method to initialize and cache
|
||||
* flicker executions
|
||||
* 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 {
|
||||
setup {
|
||||
testSpec.setIsTablet(wmHelper.currentState.wmState.isTablet)
|
||||
}
|
||||
setup { testSpec.setIsTablet(wmHelper.currentState.wmState.isTablet) }
|
||||
transition()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that all parts of the screen are covered during the transition
|
||||
*/
|
||||
/** Checks that all parts of the screen are covered during the transition */
|
||||
open fun entireScreenCovered() = testSpec.entireScreenCovered()
|
||||
|
||||
/**
|
||||
* Checks that the [ComponentMatcher.NAV_BAR] layer is visible during the whole transition
|
||||
*/
|
||||
/** Checks that the [ComponentMatcher.NAV_BAR] layer is visible during the whole transition */
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun navBarLayerIsVisibleAtStartAndEnd() {
|
||||
@@ -111,9 +105,7 @@ abstract class BaseTest @JvmOverloads constructor(
|
||||
testSpec.navBarWindowIsAlwaysVisible()
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the [ComponentMatcher.TASK_BAR] layer is visible during the whole transition
|
||||
*/
|
||||
/** Checks that the [ComponentMatcher.TASK_BAR] layer is visible during the whole transition */
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun taskBarLayerIsVisibleAtStartAndEnd() {
|
||||
@@ -142,7 +134,8 @@ abstract class BaseTest @JvmOverloads constructor(
|
||||
testSpec.statusBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
/**
|
||||
* Checks the position of the [ComponentMatcher.STATUS_BAR] at the start and end of the transition
|
||||
* Checks the position of the [ComponentMatcher.STATUS_BAR] at the start and end of the
|
||||
* transition
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
@@ -156,26 +149,22 @@ abstract class BaseTest @JvmOverloads constructor(
|
||||
open fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
/**
|
||||
* Checks that all layers that are visible on the trace, are visible for at least 2
|
||||
* consecutive entries.
|
||||
* Checks that all layers that are visible on the trace, are visible for at least 2 consecutive
|
||||
* entries.
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun visibleLayersShownMoreThanOneConsecutiveEntry() {
|
||||
testSpec.assertLayers {
|
||||
this.visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
}
|
||||
testSpec.assertLayers { this.visibleLayersShownMoreThanOneConsecutiveEntry() }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that all windows that are visible on the trace, are visible for at least 2
|
||||
* consecutive entries.
|
||||
* 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()
|
||||
}
|
||||
testSpec.assertWm { this.visibleWindowsShownMoreThanOneConsecutiveEntry() }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
@file:JvmName("CommonAssertions")
|
||||
|
||||
package com.android.wm.shell.flicker
|
||||
|
||||
import android.view.Surface
|
||||
@@ -26,15 +27,11 @@ import com.android.server.wm.traces.common.IComponentMatcher
|
||||
import com.android.server.wm.traces.common.region.Region
|
||||
|
||||
fun FlickerTestParameter.appPairsDividerIsVisibleAtEnd() {
|
||||
assertLayersEnd {
|
||||
this.isVisible(APP_PAIR_SPLIT_DIVIDER_COMPONENT)
|
||||
}
|
||||
assertLayersEnd { this.isVisible(APP_PAIR_SPLIT_DIVIDER_COMPONENT) }
|
||||
}
|
||||
|
||||
fun FlickerTestParameter.appPairsDividerIsInvisibleAtEnd() {
|
||||
assertLayersEnd {
|
||||
this.notContains(APP_PAIR_SPLIT_DIVIDER_COMPONENT)
|
||||
}
|
||||
assertLayersEnd { this.notContains(APP_PAIR_SPLIT_DIVIDER_COMPONENT) }
|
||||
}
|
||||
|
||||
fun FlickerTestParameter.appPairsDividerBecomesVisible() {
|
||||
@@ -82,27 +79,19 @@ fun FlickerTestParameter.splitScreenDismissed(
|
||||
}
|
||||
|
||||
fun FlickerTestParameter.splitScreenDividerIsVisibleAtStart() {
|
||||
assertLayersStart {
|
||||
this.isVisible(SPLIT_SCREEN_DIVIDER_COMPONENT)
|
||||
}
|
||||
assertLayersStart { this.isVisible(SPLIT_SCREEN_DIVIDER_COMPONENT) }
|
||||
}
|
||||
|
||||
fun FlickerTestParameter.splitScreenDividerIsVisibleAtEnd() {
|
||||
assertLayersEnd {
|
||||
this.isVisible(SPLIT_SCREEN_DIVIDER_COMPONENT)
|
||||
}
|
||||
assertLayersEnd { this.isVisible(SPLIT_SCREEN_DIVIDER_COMPONENT) }
|
||||
}
|
||||
|
||||
fun FlickerTestParameter.splitScreenDividerIsInvisibleAtStart() {
|
||||
assertLayersStart {
|
||||
this.isInvisible(SPLIT_SCREEN_DIVIDER_COMPONENT)
|
||||
}
|
||||
assertLayersStart { this.isInvisible(SPLIT_SCREEN_DIVIDER_COMPONENT) }
|
||||
}
|
||||
|
||||
fun FlickerTestParameter.splitScreenDividerIsInvisibleAtEnd() {
|
||||
assertLayersEnd {
|
||||
this.isInvisible(SPLIT_SCREEN_DIVIDER_COMPONENT)
|
||||
}
|
||||
assertLayersEnd { this.isInvisible(SPLIT_SCREEN_DIVIDER_COMPONENT) }
|
||||
}
|
||||
|
||||
fun FlickerTestParameter.splitScreenDividerBecomesVisible() {
|
||||
@@ -117,40 +106,20 @@ fun FlickerTestParameter.splitScreenDividerBecomesInvisible() {
|
||||
}
|
||||
}
|
||||
|
||||
fun FlickerTestParameter.layerBecomesVisible(
|
||||
component: IComponentMatcher
|
||||
) {
|
||||
assertLayers {
|
||||
this.isInvisible(component)
|
||||
.then()
|
||||
.isVisible(component)
|
||||
}
|
||||
fun FlickerTestParameter.layerBecomesVisible(component: IComponentMatcher) {
|
||||
assertLayers { this.isInvisible(component).then().isVisible(component) }
|
||||
}
|
||||
|
||||
fun FlickerTestParameter.layerBecomesInvisible(
|
||||
component: IComponentMatcher
|
||||
) {
|
||||
assertLayers {
|
||||
this.isVisible(component)
|
||||
.then()
|
||||
.isInvisible(component)
|
||||
}
|
||||
fun FlickerTestParameter.layerBecomesInvisible(component: IComponentMatcher) {
|
||||
assertLayers { this.isVisible(component).then().isInvisible(component) }
|
||||
}
|
||||
|
||||
fun FlickerTestParameter.layerIsVisibleAtEnd(
|
||||
component: IComponentMatcher
|
||||
) {
|
||||
assertLayersEnd {
|
||||
this.isVisible(component)
|
||||
}
|
||||
fun FlickerTestParameter.layerIsVisibleAtEnd(component: IComponentMatcher) {
|
||||
assertLayersEnd { this.isVisible(component) }
|
||||
}
|
||||
|
||||
fun FlickerTestParameter.layerKeepVisible(
|
||||
component: IComponentMatcher
|
||||
) {
|
||||
assertLayers {
|
||||
this.isVisible(component)
|
||||
}
|
||||
fun FlickerTestParameter.layerKeepVisible(component: IComponentMatcher) {
|
||||
assertLayers { this.isVisible(component) }
|
||||
}
|
||||
|
||||
fun FlickerTestParameter.splitAppLayerBoundsBecomesVisible(
|
||||
@@ -164,13 +133,15 @@ fun FlickerTestParameter.splitAppLayerBoundsBecomesVisible(
|
||||
.isInvisible(SPLIT_SCREEN_DIVIDER_COMPONENT.or(component))
|
||||
.then()
|
||||
.splitAppLayerBoundsSnapToDivider(
|
||||
component, landscapePosLeft, portraitPosTop, endRotation)
|
||||
component,
|
||||
landscapePosLeft,
|
||||
portraitPosTop,
|
||||
endRotation
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun FlickerTestParameter.splitAppLayerBoundsBecomesVisibleByDrag(
|
||||
component: IComponentMatcher
|
||||
) {
|
||||
fun FlickerTestParameter.splitAppLayerBoundsBecomesVisibleByDrag(component: IComponentMatcher) {
|
||||
assertLayers {
|
||||
this.notContains(SPLIT_SCREEN_DIVIDER_COMPONENT.or(component), isOptional = true)
|
||||
.then()
|
||||
@@ -188,7 +159,11 @@ fun FlickerTestParameter.splitAppLayerBoundsBecomesInvisible(
|
||||
) {
|
||||
assertLayers {
|
||||
this.splitAppLayerBoundsSnapToDivider(
|
||||
component, landscapePosLeft, portraitPosTop, endRotation)
|
||||
component,
|
||||
landscapePosLeft,
|
||||
portraitPosTop,
|
||||
endRotation
|
||||
)
|
||||
.then()
|
||||
.isVisible(component, true)
|
||||
.then()
|
||||
@@ -224,15 +199,27 @@ fun FlickerTestParameter.splitAppLayerBoundsChanges(
|
||||
assertLayers {
|
||||
if (landscapePosLeft) {
|
||||
this.splitAppLayerBoundsSnapToDivider(
|
||||
component, landscapePosLeft, portraitPosTop, endRotation)
|
||||
component,
|
||||
landscapePosLeft,
|
||||
portraitPosTop,
|
||||
endRotation
|
||||
)
|
||||
} else {
|
||||
this.splitAppLayerBoundsSnapToDivider(
|
||||
component, landscapePosLeft, portraitPosTop, endRotation)
|
||||
component,
|
||||
landscapePosLeft,
|
||||
portraitPosTop,
|
||||
endRotation
|
||||
)
|
||||
.then()
|
||||
.isInvisible(component)
|
||||
.then()
|
||||
.splitAppLayerBoundsSnapToDivider(
|
||||
component, landscapePosLeft, portraitPosTop, endRotation)
|
||||
component,
|
||||
landscapePosLeft,
|
||||
portraitPosTop,
|
||||
endRotation
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -257,45 +244,46 @@ fun LayerTraceEntrySubject.splitAppLayerBoundsSnapToDivider(
|
||||
val displayBounds = WindowUtils.getDisplayBounds(rotation)
|
||||
return invoke {
|
||||
val dividerRegion = layer(SPLIT_SCREEN_DIVIDER_COMPONENT).visibleRegion.region
|
||||
visibleRegion(component).coversAtMost(
|
||||
if (displayBounds.width > displayBounds.height) {
|
||||
if (landscapePosLeft) {
|
||||
Region.from(
|
||||
0,
|
||||
0,
|
||||
(dividerRegion.bounds.left + dividerRegion.bounds.right) / 2,
|
||||
displayBounds.bounds.bottom)
|
||||
visibleRegion(component)
|
||||
.coversAtMost(
|
||||
if (displayBounds.width > displayBounds.height) {
|
||||
if (landscapePosLeft) {
|
||||
Region.from(
|
||||
0,
|
||||
0,
|
||||
(dividerRegion.bounds.left + dividerRegion.bounds.right) / 2,
|
||||
displayBounds.bounds.bottom
|
||||
)
|
||||
} else {
|
||||
Region.from(
|
||||
(dividerRegion.bounds.left + dividerRegion.bounds.right) / 2,
|
||||
0,
|
||||
displayBounds.bounds.right,
|
||||
displayBounds.bounds.bottom
|
||||
)
|
||||
}
|
||||
} else {
|
||||
Region.from(
|
||||
(dividerRegion.bounds.left + dividerRegion.bounds.right) / 2,
|
||||
0,
|
||||
displayBounds.bounds.right,
|
||||
displayBounds.bounds.bottom
|
||||
)
|
||||
if (portraitPosTop) {
|
||||
Region.from(
|
||||
0,
|
||||
0,
|
||||
displayBounds.bounds.right,
|
||||
(dividerRegion.bounds.top + dividerRegion.bounds.bottom) / 2
|
||||
)
|
||||
} else {
|
||||
Region.from(
|
||||
0,
|
||||
(dividerRegion.bounds.top + dividerRegion.bounds.bottom) / 2,
|
||||
displayBounds.bounds.right,
|
||||
displayBounds.bounds.bottom
|
||||
)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (portraitPosTop) {
|
||||
Region.from(
|
||||
0,
|
||||
0,
|
||||
displayBounds.bounds.right,
|
||||
(dividerRegion.bounds.top + dividerRegion.bounds.bottom) / 2)
|
||||
} else {
|
||||
Region.from(
|
||||
0,
|
||||
(dividerRegion.bounds.top + dividerRegion.bounds.bottom) / 2,
|
||||
displayBounds.bounds.right,
|
||||
displayBounds.bounds.bottom
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun FlickerTestParameter.appWindowBecomesVisible(
|
||||
component: IComponentMatcher
|
||||
) {
|
||||
fun FlickerTestParameter.appWindowBecomesVisible(component: IComponentMatcher) {
|
||||
assertWm {
|
||||
this.isAppWindowInvisible(component)
|
||||
.then()
|
||||
@@ -307,60 +295,32 @@ fun FlickerTestParameter.appWindowBecomesVisible(
|
||||
}
|
||||
}
|
||||
|
||||
fun FlickerTestParameter.appWindowBecomesInvisible(
|
||||
component: IComponentMatcher
|
||||
) {
|
||||
assertWm {
|
||||
this.isAppWindowVisible(component)
|
||||
.then()
|
||||
.isAppWindowInvisible(component)
|
||||
}
|
||||
fun FlickerTestParameter.appWindowBecomesInvisible(component: IComponentMatcher) {
|
||||
assertWm { this.isAppWindowVisible(component).then().isAppWindowInvisible(component) }
|
||||
}
|
||||
|
||||
fun FlickerTestParameter.appWindowIsVisibleAtStart(
|
||||
component: IComponentMatcher
|
||||
) {
|
||||
assertWmStart {
|
||||
this.isAppWindowVisible(component)
|
||||
}
|
||||
fun FlickerTestParameter.appWindowIsVisibleAtStart(component: IComponentMatcher) {
|
||||
assertWmStart { this.isAppWindowVisible(component) }
|
||||
}
|
||||
|
||||
fun FlickerTestParameter.appWindowIsVisibleAtEnd(
|
||||
component: IComponentMatcher
|
||||
) {
|
||||
assertWmEnd {
|
||||
this.isAppWindowVisible(component)
|
||||
}
|
||||
fun FlickerTestParameter.appWindowIsVisibleAtEnd(component: IComponentMatcher) {
|
||||
assertWmEnd { this.isAppWindowVisible(component) }
|
||||
}
|
||||
|
||||
fun FlickerTestParameter.appWindowIsInvisibleAtStart(
|
||||
component: IComponentMatcher
|
||||
) {
|
||||
assertWmStart {
|
||||
this.isAppWindowInvisible(component)
|
||||
}
|
||||
fun FlickerTestParameter.appWindowIsInvisibleAtStart(component: IComponentMatcher) {
|
||||
assertWmStart { this.isAppWindowInvisible(component) }
|
||||
}
|
||||
|
||||
fun FlickerTestParameter.appWindowIsInvisibleAtEnd(
|
||||
component: IComponentMatcher
|
||||
) {
|
||||
assertWmEnd {
|
||||
this.isAppWindowInvisible(component)
|
||||
}
|
||||
fun FlickerTestParameter.appWindowIsInvisibleAtEnd(component: IComponentMatcher) {
|
||||
assertWmEnd { this.isAppWindowInvisible(component) }
|
||||
}
|
||||
|
||||
fun FlickerTestParameter.appWindowKeepVisible(
|
||||
component: IComponentMatcher
|
||||
) {
|
||||
assertWm {
|
||||
this.isAppWindowVisible(component)
|
||||
}
|
||||
fun FlickerTestParameter.appWindowKeepVisible(component: IComponentMatcher) {
|
||||
assertWm { this.isAppWindowVisible(component) }
|
||||
}
|
||||
|
||||
fun FlickerTestParameter.dockedStackDividerIsVisibleAtEnd() {
|
||||
assertLayersEnd {
|
||||
this.isVisible(DOCKED_STACK_DIVIDER_COMPONENT)
|
||||
}
|
||||
assertLayersEnd { this.isVisible(DOCKED_STACK_DIVIDER_COMPONENT) }
|
||||
}
|
||||
|
||||
fun FlickerTestParameter.dockedStackDividerBecomesVisible() {
|
||||
@@ -380,9 +340,7 @@ fun FlickerTestParameter.dockedStackDividerBecomesInvisible() {
|
||||
}
|
||||
|
||||
fun FlickerTestParameter.dockedStackDividerNotExistsAtEnd() {
|
||||
assertLayersEnd {
|
||||
this.notContains(DOCKED_STACK_DIVIDER_COMPONENT)
|
||||
}
|
||||
assertLayersEnd { this.notContains(DOCKED_STACK_DIVIDER_COMPONENT) }
|
||||
}
|
||||
|
||||
fun FlickerTestParameter.appPairsPrimaryBoundsIsVisibleAtEnd(
|
||||
@@ -391,8 +349,7 @@ fun FlickerTestParameter.appPairsPrimaryBoundsIsVisibleAtEnd(
|
||||
) {
|
||||
assertLayersEnd {
|
||||
val dividerRegion = layer(APP_PAIR_SPLIT_DIVIDER_COMPONENT).visibleRegion.region
|
||||
visibleRegion(primaryComponent)
|
||||
.overlaps(getPrimaryRegion(dividerRegion, rotation))
|
||||
visibleRegion(primaryComponent).overlaps(getPrimaryRegion(dividerRegion, rotation))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,8 +359,7 @@ fun FlickerTestParameter.dockedStackPrimaryBoundsIsVisibleAtEnd(
|
||||
) {
|
||||
assertLayersEnd {
|
||||
val dividerRegion = layer(DOCKED_STACK_DIVIDER_COMPONENT).visibleRegion.region
|
||||
visibleRegion(primaryComponent)
|
||||
.overlaps(getPrimaryRegion(dividerRegion, rotation))
|
||||
visibleRegion(primaryComponent).overlaps(getPrimaryRegion(dividerRegion, rotation))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -413,8 +369,7 @@ fun FlickerTestParameter.appPairsSecondaryBoundsIsVisibleAtEnd(
|
||||
) {
|
||||
assertLayersEnd {
|
||||
val dividerRegion = layer(APP_PAIR_SPLIT_DIVIDER_COMPONENT).visibleRegion.region
|
||||
visibleRegion(secondaryComponent)
|
||||
.overlaps(getSecondaryRegion(dividerRegion, rotation))
|
||||
visibleRegion(secondaryComponent).overlaps(getSecondaryRegion(dividerRegion, rotation))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -424,8 +379,7 @@ fun FlickerTestParameter.dockedStackSecondaryBoundsIsVisibleAtEnd(
|
||||
) {
|
||||
assertLayersEnd {
|
||||
val dividerRegion = layer(DOCKED_STACK_DIVIDER_COMPONENT).visibleRegion.region
|
||||
visibleRegion(secondaryComponent)
|
||||
.overlaps(getSecondaryRegion(dividerRegion, rotation))
|
||||
visibleRegion(secondaryComponent).overlaps(getSecondaryRegion(dividerRegion, rotation))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -433,12 +387,16 @@ fun getPrimaryRegion(dividerRegion: Region, rotation: Int): Region {
|
||||
val displayBounds = WindowUtils.getDisplayBounds(rotation)
|
||||
return if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180) {
|
||||
Region.from(
|
||||
0, 0, displayBounds.bounds.right,
|
||||
0,
|
||||
0,
|
||||
displayBounds.bounds.right,
|
||||
dividerRegion.bounds.top + WindowUtils.dockedStackDividerInset
|
||||
)
|
||||
} else {
|
||||
Region.from(
|
||||
0, 0, dividerRegion.bounds.left + WindowUtils.dockedStackDividerInset,
|
||||
0,
|
||||
0,
|
||||
dividerRegion.bounds.left + WindowUtils.dockedStackDividerInset,
|
||||
displayBounds.bounds.bottom
|
||||
)
|
||||
}
|
||||
@@ -448,13 +406,17 @@ fun getSecondaryRegion(dividerRegion: Region, rotation: Int): Region {
|
||||
val displayBounds = WindowUtils.getDisplayBounds(rotation)
|
||||
return if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180) {
|
||||
Region.from(
|
||||
0, dividerRegion.bounds.bottom - WindowUtils.dockedStackDividerInset,
|
||||
displayBounds.bounds.right, displayBounds.bounds.bottom
|
||||
0,
|
||||
dividerRegion.bounds.bottom - WindowUtils.dockedStackDividerInset,
|
||||
displayBounds.bounds.right,
|
||||
displayBounds.bounds.bottom
|
||||
)
|
||||
} else {
|
||||
Region.from(
|
||||
dividerRegion.bounds.right - WindowUtils.dockedStackDividerInset, 0,
|
||||
displayBounds.bounds.right, displayBounds.bounds.bottom
|
||||
dividerRegion.bounds.right - WindowUtils.dockedStackDividerInset,
|
||||
0,
|
||||
displayBounds.bounds.right,
|
||||
displayBounds.bounds.bottom
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
@file:JvmName("CommonConstants")
|
||||
|
||||
package com.android.wm.shell.flicker
|
||||
|
||||
import com.android.server.wm.traces.common.ComponentNameMatcher
|
||||
@@ -26,5 +27,8 @@ val SPLIT_SCREEN_DIVIDER_COMPONENT = ComponentNameMatcher("", "StageCoordinatorS
|
||||
val SPLIT_DECOR_MANAGER = ComponentNameMatcher("", "SplitDecorManager#")
|
||||
|
||||
enum class Direction {
|
||||
UP, DOWN, LEFT, RIGHT
|
||||
UP,
|
||||
DOWN,
|
||||
LEFT,
|
||||
RIGHT
|
||||
}
|
||||
|
||||
@@ -33,17 +33,23 @@ object MultiWindowUtils {
|
||||
}
|
||||
|
||||
fun getDevEnableNonResizableMultiWindow(context: Context): Int =
|
||||
Settings.Global.getInt(context.contentResolver,
|
||||
Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW)
|
||||
Settings.Global.getInt(
|
||||
context.contentResolver,
|
||||
Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW
|
||||
)
|
||||
|
||||
fun setDevEnableNonResizableMultiWindow(context: Context, configValue: Int) =
|
||||
Settings.Global.putInt(context.contentResolver,
|
||||
Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW, configValue)
|
||||
Settings.Global.putInt(
|
||||
context.contentResolver,
|
||||
Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW,
|
||||
configValue
|
||||
)
|
||||
|
||||
fun setSupportsNonResizableMultiWindow(instrumentation: Instrumentation, configValue: Int) =
|
||||
executeShellCommand(
|
||||
instrumentation,
|
||||
createConfigSupportsNonResizableMultiWindowCommand(configValue))
|
||||
createConfigSupportsNonResizableMultiWindowCommand(configValue)
|
||||
)
|
||||
|
||||
fun resetMultiWindowConfig(instrumentation: Instrumentation) =
|
||||
executeShellCommand(instrumentation, resetMultiWindowConfigCommand)
|
||||
|
||||
@@ -51,7 +51,7 @@ class NotificationListener : NotificationListenerService() {
|
||||
|
||||
private const val CMD_NOTIFICATION_ALLOW_LISTENER = "cmd notification allow_listener %s"
|
||||
private const val CMD_NOTIFICATION_DISALLOW_LISTENER =
|
||||
"cmd notification disallow_listener %s"
|
||||
"cmd notification disallow_listener %s"
|
||||
private const val COMPONENT_NAME = "com.android.wm.shell.flicker/.NotificationListener"
|
||||
|
||||
private var instance: NotificationListener? = null
|
||||
@@ -79,25 +79,23 @@ class NotificationListener : NotificationListenerService() {
|
||||
): StatusBarNotification? {
|
||||
instance?.run {
|
||||
return notifications.values.firstOrNull(predicate)
|
||||
} ?: throw IllegalStateException("NotificationListenerService is not connected")
|
||||
}
|
||||
?: throw IllegalStateException("NotificationListenerService is not connected")
|
||||
}
|
||||
|
||||
fun waitForNotificationToAppear(
|
||||
predicate: (StatusBarNotification) -> Boolean
|
||||
): StatusBarNotification? {
|
||||
instance?.let {
|
||||
return waitForResult(extractor = {
|
||||
it.notifications.values.firstOrNull(predicate)
|
||||
}).second
|
||||
} ?: throw IllegalStateException("NotificationListenerService is not connected")
|
||||
return waitForResult(extractor = { it.notifications.values.firstOrNull(predicate) })
|
||||
.second
|
||||
}
|
||||
?: throw IllegalStateException("NotificationListenerService is not connected")
|
||||
}
|
||||
|
||||
fun waitForNotificationToDisappear(
|
||||
predicate: (StatusBarNotification) -> Boolean
|
||||
): Boolean {
|
||||
return instance?.let {
|
||||
wait { it.notifications.values.none(predicate) }
|
||||
} ?: throw IllegalStateException("NotificationListenerService is not connected")
|
||||
fun waitForNotificationToDisappear(predicate: (StatusBarNotification) -> Boolean): Boolean {
|
||||
return instance?.let { wait { it.notifications.values.none(predicate) } }
|
||||
?: throw IllegalStateException("NotificationListenerService is not connected")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
@file:JvmName("WaitUtils")
|
||||
|
||||
package com.android.wm.shell.flicker
|
||||
|
||||
import android.os.SystemClock
|
||||
|
||||
@@ -34,21 +34,21 @@ import com.android.server.wm.flicker.helpers.SYSTEMUI_PACKAGE
|
||||
import com.android.wm.shell.flicker.BaseTest
|
||||
import org.junit.runners.Parameterized
|
||||
|
||||
/**
|
||||
* Base configurations for Bubble flicker tests
|
||||
*/
|
||||
abstract class BaseBubbleScreen(
|
||||
testSpec: FlickerTestParameter
|
||||
) : BaseTest(testSpec) {
|
||||
/** Base configurations for Bubble flicker tests */
|
||||
abstract class BaseBubbleScreen(testSpec: FlickerTestParameter) : BaseTest(testSpec) {
|
||||
|
||||
protected val context: Context = instrumentation.context
|
||||
protected val testApp = LaunchBubbleHelper(instrumentation)
|
||||
|
||||
private val notifyManager = INotificationManager.Stub.asInterface(
|
||||
ServiceManager.getService(Context.NOTIFICATION_SERVICE))
|
||||
private val notifyManager =
|
||||
INotificationManager.Stub.asInterface(
|
||||
ServiceManager.getService(Context.NOTIFICATION_SERVICE)
|
||||
)
|
||||
|
||||
private val uid = context.packageManager.getApplicationInfo(
|
||||
testApp.`package`, PackageManager.ApplicationInfoFlags.of(0)).uid
|
||||
private val uid =
|
||||
context.packageManager
|
||||
.getApplicationInfo(testApp.`package`, PackageManager.ApplicationInfoFlags.of(0))
|
||||
.uid
|
||||
|
||||
@JvmOverloads
|
||||
protected open fun buildTransition(
|
||||
@@ -56,16 +56,22 @@ abstract class BaseBubbleScreen(
|
||||
): FlickerBuilder.() -> Unit {
|
||||
return {
|
||||
setup {
|
||||
notifyManager.setBubblesAllowed(testApp.`package`,
|
||||
uid, NotificationManager.BUBBLE_PREFERENCE_ALL)
|
||||
notifyManager.setBubblesAllowed(
|
||||
testApp.`package`,
|
||||
uid,
|
||||
NotificationManager.BUBBLE_PREFERENCE_ALL
|
||||
)
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
waitAndGetAddBubbleBtn()
|
||||
waitAndGetCancelAllBtn()
|
||||
}
|
||||
|
||||
teardown {
|
||||
notifyManager.setBubblesAllowed(testApp.`package`,
|
||||
uid, NotificationManager.BUBBLE_PREFERENCE_NONE)
|
||||
notifyManager.setBubblesAllowed(
|
||||
testApp.`package`,
|
||||
uid,
|
||||
NotificationManager.BUBBLE_PREFERENCE_NONE
|
||||
)
|
||||
testApp.exit()
|
||||
}
|
||||
|
||||
@@ -73,17 +79,17 @@ abstract class BaseBubbleScreen(
|
||||
}
|
||||
}
|
||||
|
||||
protected fun Flicker.waitAndGetAddBubbleBtn(): UiObject2? = device.wait(Until.findObject(
|
||||
By.text("Add Bubble")), FIND_OBJECT_TIMEOUT)
|
||||
protected fun Flicker.waitAndGetCancelAllBtn(): UiObject2? = device.wait(Until.findObject(
|
||||
By.text("Cancel All Bubble")), FIND_OBJECT_TIMEOUT)
|
||||
protected fun Flicker.waitAndGetAddBubbleBtn(): UiObject2? =
|
||||
device.wait(Until.findObject(By.text("Add Bubble")), FIND_OBJECT_TIMEOUT)
|
||||
protected fun Flicker.waitAndGetCancelAllBtn(): UiObject2? =
|
||||
device.wait(Until.findObject(By.text("Cancel All Bubble")), FIND_OBJECT_TIMEOUT)
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): List<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(supportedRotations = listOf(Surface.ROTATION_0))
|
||||
.getConfigNonRotationTests(supportedRotations = listOf(Surface.ROTATION_0))
|
||||
}
|
||||
|
||||
const val FIND_OBJECT_TIMEOUT = 2000L
|
||||
|
||||
@@ -38,7 +38,9 @@ import org.junit.runners.Parameterized
|
||||
* To run this test: `atest WMShellFlickerTests:DismissBubbleScreen`
|
||||
*
|
||||
* Actions:
|
||||
* ```
|
||||
* Dismiss a bubble notification
|
||||
* ```
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@@ -58,11 +60,11 @@ open class DismissBubbleScreen(testSpec: FlickerTestParameter) : BaseBubbleScree
|
||||
transitions {
|
||||
wm.run { wm.defaultDisplay.getMetrics(displaySize) }
|
||||
val dist = Point((displaySize.widthPixels / 2), displaySize.heightPixels)
|
||||
val showBubble = device.wait(
|
||||
Until.findObject(
|
||||
By.res(SYSTEM_UI_PACKAGE, BUBBLE_RES_NAME)
|
||||
), FIND_OBJECT_TIMEOUT
|
||||
)
|
||||
val showBubble =
|
||||
device.wait(
|
||||
Until.findObject(By.res(SYSTEM_UI_PACKAGE, BUBBLE_RES_NAME)),
|
||||
FIND_OBJECT_TIMEOUT
|
||||
)
|
||||
showBubble?.run { drag(dist, 1000) } ?: error("Show bubble not found")
|
||||
}
|
||||
}
|
||||
@@ -70,22 +72,18 @@ open class DismissBubbleScreen(testSpec: FlickerTestParameter) : BaseBubbleScree
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun testAppIsAlwaysVisible() {
|
||||
testSpec.assertLayers {
|
||||
this.isVisible(testApp)
|
||||
}
|
||||
testSpec.assertLayers { this.isVisible(testApp) }
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() =
|
||||
super.taskBarLayerIsVisibleAtStartAndEnd()
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() = super.taskBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun taskBarWindowIsAlwaysVisible() =
|
||||
super.taskBarWindowIsAlwaysVisible()
|
||||
override fun taskBarWindowIsAlwaysVisible() = super.taskBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
|
||||
@@ -33,9 +33,11 @@ import org.junit.runners.Parameterized
|
||||
* To run this test: `atest WMShellFlickerTests:ExpandBubbleScreen`
|
||||
*
|
||||
* Actions:
|
||||
* ```
|
||||
* Launch an app and enable app's bubble notification
|
||||
* Send a bubble notification
|
||||
* The activity for the bubble is launched
|
||||
* ```
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@@ -50,11 +52,11 @@ open class ExpandBubbleScreen(testSpec: FlickerTestParameter) : BaseBubbleScreen
|
||||
addBubbleBtn?.click() ?: error("Add Bubble not found")
|
||||
}
|
||||
transitions {
|
||||
val showBubble = device.wait(
|
||||
Until.findObject(
|
||||
By.res("com.android.systemui", "bubble_view")
|
||||
), FIND_OBJECT_TIMEOUT
|
||||
)
|
||||
val showBubble =
|
||||
device.wait(
|
||||
Until.findObject(By.res("com.android.systemui", "bubble_view")),
|
||||
FIND_OBJECT_TIMEOUT
|
||||
)
|
||||
showBubble?.run { showBubble.click() } ?: error("Bubble notify not found")
|
||||
}
|
||||
}
|
||||
@@ -62,8 +64,6 @@ open class ExpandBubbleScreen(testSpec: FlickerTestParameter) : BaseBubbleScreen
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun testAppIsAlwaysVisible() {
|
||||
testSpec.assertLayers {
|
||||
this.isVisible(testApp)
|
||||
}
|
||||
testSpec.assertLayers { this.isVisible(testApp) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,9 @@ import org.junit.runners.Parameterized
|
||||
* To run this test: `atest WMShellFlickerTests:LaunchBubbleFromLockScreen`
|
||||
*
|
||||
* Actions:
|
||||
* ```
|
||||
* Launch an bubble from notification on lock screen
|
||||
* ```
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@@ -50,36 +52,32 @@ class LaunchBubbleFromLockScreen(testSpec: FlickerTestParameter) : BaseBubbleScr
|
||||
val addBubbleBtn = waitAndGetAddBubbleBtn()
|
||||
addBubbleBtn?.click() ?: error("Bubble widget not found")
|
||||
device.sleep()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withoutTopVisibleAppWindows()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withoutTopVisibleAppWindows().waitForAndVerify()
|
||||
device.wakeUp()
|
||||
}
|
||||
transitions {
|
||||
// Swipe & wait for the notification shade to expand so all can be seen
|
||||
val wm = context.getSystemService(WindowManager::class.java)
|
||||
?: error("Unable to obtain WM service")
|
||||
val wm =
|
||||
context.getSystemService(WindowManager::class.java)
|
||||
?: error("Unable to obtain WM service")
|
||||
val metricInsets = wm.currentWindowMetrics.windowInsets
|
||||
val insets = metricInsets.getInsetsIgnoringVisibility(
|
||||
WindowInsets.Type.statusBars()
|
||||
or WindowInsets.Type.displayCutout()
|
||||
)
|
||||
val insets =
|
||||
metricInsets.getInsetsIgnoringVisibility(
|
||||
WindowInsets.Type.statusBars() or WindowInsets.Type.displayCutout()
|
||||
)
|
||||
device.swipe(100, insets.top + 100, 100, device.displayHeight / 2, 4)
|
||||
device.waitForIdle(2000)
|
||||
instrumentation.uiAutomation.syncInputTransactions()
|
||||
|
||||
val notification = device.wait(
|
||||
Until.findObject(
|
||||
By.text("BubbleChat")
|
||||
), FIND_OBJECT_TIMEOUT
|
||||
)
|
||||
val notification =
|
||||
device.wait(Until.findObject(By.text("BubbleChat")), FIND_OBJECT_TIMEOUT)
|
||||
notification?.click() ?: error("Notification not found")
|
||||
instrumentation.uiAutomation.syncInputTransactions()
|
||||
val showBubble = device.wait(
|
||||
Until.findObject(
|
||||
By.res("com.android.systemui", "bubble_view")
|
||||
), FIND_OBJECT_TIMEOUT
|
||||
)
|
||||
val showBubble =
|
||||
device.wait(
|
||||
Until.findObject(By.res("com.android.systemui", "bubble_view")),
|
||||
FIND_OBJECT_TIMEOUT
|
||||
)
|
||||
showBubble?.click() ?: error("Bubble notify not found")
|
||||
instrumentation.uiAutomation.syncInputTransactions()
|
||||
val cancelAllBtn = waitAndGetCancelAllBtn()
|
||||
@@ -90,9 +88,7 @@ class LaunchBubbleFromLockScreen(testSpec: FlickerTestParameter) : BaseBubbleScr
|
||||
@FlakyTest(bugId = 242088970)
|
||||
@Test
|
||||
fun testAppIsVisibleAtEnd() {
|
||||
testSpec.assertLayersEnd {
|
||||
this.isVisible(testApp)
|
||||
}
|
||||
testSpec.assertLayersEnd { this.isVisible(testApp) }
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@@ -104,32 +100,27 @@ class LaunchBubbleFromLockScreen(testSpec: FlickerTestParameter) : BaseBubbleScr
|
||||
/** {@inheritDoc} */
|
||||
@FlakyTest(bugId = 206753786)
|
||||
@Test
|
||||
override fun navBarLayerIsVisibleAtStartAndEnd() =
|
||||
super.navBarLayerIsVisibleAtStartAndEnd()
|
||||
override fun navBarLayerIsVisibleAtStartAndEnd() = super.navBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@FlakyTest(bugId = 206753786)
|
||||
@Test
|
||||
override fun navBarLayerPositionAtStartAndEnd() =
|
||||
super.navBarLayerPositionAtStartAndEnd()
|
||||
override fun navBarLayerPositionAtStartAndEnd() = super.navBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@FlakyTest(bugId = 206753786)
|
||||
@Test
|
||||
override fun navBarWindowIsAlwaysVisible() =
|
||||
super.navBarWindowIsAlwaysVisible()
|
||||
override fun navBarWindowIsAlwaysVisible() = super.navBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@FlakyTest(bugId = 242088970)
|
||||
@Test
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() =
|
||||
super.taskBarLayerIsVisibleAtStartAndEnd()
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() = super.taskBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun taskBarWindowIsAlwaysVisible() =
|
||||
super.taskBarWindowIsAlwaysVisible()
|
||||
override fun taskBarWindowIsAlwaysVisible() = super.taskBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@FlakyTest(bugId = 242088970)
|
||||
@@ -140,14 +131,12 @@ class LaunchBubbleFromLockScreen(testSpec: FlickerTestParameter) : BaseBubbleScr
|
||||
/** {@inheritDoc} */
|
||||
@FlakyTest(bugId = 242088970)
|
||||
@Test
|
||||
override fun statusBarLayerPositionAtStartAndEnd() =
|
||||
super.statusBarLayerPositionAtStartAndEnd()
|
||||
override fun statusBarLayerPositionAtStartAndEnd() = super.statusBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@FlakyTest(bugId = 242088970)
|
||||
@Test
|
||||
override fun statusBarWindowIsAlwaysVisible() =
|
||||
super.statusBarWindowIsAlwaysVisible()
|
||||
override fun statusBarWindowIsAlwaysVisible() = super.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@FlakyTest(bugId = 242088970)
|
||||
|
||||
@@ -32,8 +32,10 @@ import org.junit.runners.Parameterized
|
||||
* To run this test: `atest WMShellFlickerTests:LaunchBubbleScreen`
|
||||
*
|
||||
* Actions:
|
||||
* ```
|
||||
* Launch an app and enable app's bubble notification
|
||||
* Send a bubble notification
|
||||
* ```
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@@ -48,17 +50,15 @@ open class LaunchBubbleScreen(testSpec: FlickerTestParameter) : BaseBubbleScreen
|
||||
addBubbleBtn?.click() ?: error("Bubble widget not found")
|
||||
|
||||
device.wait(
|
||||
Until.findObjects(
|
||||
By.res(SYSTEM_UI_PACKAGE, BUBBLE_RES_NAME)
|
||||
), FIND_OBJECT_TIMEOUT
|
||||
) ?: error("No bubbles found")
|
||||
Until.findObjects(By.res(SYSTEM_UI_PACKAGE, BUBBLE_RES_NAME)),
|
||||
FIND_OBJECT_TIMEOUT
|
||||
)
|
||||
?: error("No bubbles found")
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
open fun testAppIsAlwaysVisible() {
|
||||
testSpec.assertLayers {
|
||||
this.isVisible(testApp)
|
||||
}
|
||||
testSpec.assertLayers { this.isVisible(testApp) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,9 @@ import org.junit.runners.Parameterized
|
||||
* To run this test: `atest WMShellFlickerTests:MultiBubblesScreen`
|
||||
*
|
||||
* Actions:
|
||||
* ```
|
||||
* Switch in different bubble notifications
|
||||
* ```
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@@ -59,20 +61,22 @@ open class MultiBubblesScreen(testSpec: FlickerTestParameter) : BaseBubbleScreen
|
||||
addBubbleBtn.click()
|
||||
SystemClock.sleep(1000)
|
||||
}
|
||||
val showBubble = device.wait(
|
||||
Until.findObject(
|
||||
By.res(SYSTEM_UI_PACKAGE, BUBBLE_RES_NAME)
|
||||
), FIND_OBJECT_TIMEOUT
|
||||
) ?: error("Show bubble not found")
|
||||
val showBubble =
|
||||
device.wait(
|
||||
Until.findObject(By.res(SYSTEM_UI_PACKAGE, BUBBLE_RES_NAME)),
|
||||
FIND_OBJECT_TIMEOUT
|
||||
)
|
||||
?: error("Show bubble not found")
|
||||
showBubble.click()
|
||||
SystemClock.sleep(1000)
|
||||
}
|
||||
transitions {
|
||||
val bubbles: List<UiObject2> = device.wait(
|
||||
Until.findObjects(
|
||||
By.res(SYSTEM_UI_PACKAGE, BUBBLE_RES_NAME)
|
||||
), FIND_OBJECT_TIMEOUT
|
||||
) ?: error("No bubbles found")
|
||||
val bubbles: List<UiObject2> =
|
||||
device.wait(
|
||||
Until.findObjects(By.res(SYSTEM_UI_PACKAGE, BUBBLE_RES_NAME)),
|
||||
FIND_OBJECT_TIMEOUT
|
||||
)
|
||||
?: error("No bubbles found")
|
||||
for (entry in bubbles) {
|
||||
entry.click()
|
||||
SystemClock.sleep(1000)
|
||||
@@ -83,8 +87,6 @@ open class MultiBubblesScreen(testSpec: FlickerTestParameter) : BaseBubbleScreen
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun testAppIsAlwaysVisible() {
|
||||
testSpec.assertLayers {
|
||||
this.isVisible(testApp)
|
||||
}
|
||||
testSpec.assertLayers { this.isVisible(testApp) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,9 +30,8 @@ import org.junit.runners.Parameterized
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FlakyTest(bugId = 217777115)
|
||||
class MultiBubblesScreenShellTransit(
|
||||
testSpec: FlickerTestParameter
|
||||
) : MultiBubblesScreen(testSpec) {
|
||||
class MultiBubblesScreenShellTransit(testSpec: FlickerTestParameter) :
|
||||
MultiBubblesScreen(testSpec) {
|
||||
@Before
|
||||
override fun before() {
|
||||
Assume.assumeTrue(isShellTransitionsEnabled)
|
||||
|
||||
@@ -40,16 +40,19 @@ import org.junit.runners.Parameterized
|
||||
* To run this test: `atest WMShellFlickerTests:AutoEnterPipOnGoToHomeTest`
|
||||
*
|
||||
* Actions:
|
||||
* ```
|
||||
* Launch an app in full screen
|
||||
* Select "Auto-enter PiP" radio button
|
||||
* Press Home button or swipe up to go Home and put [pipApp] in pip mode
|
||||
*
|
||||
* ```
|
||||
* Notes:
|
||||
* ```
|
||||
* 1. All assertions are inherited from [EnterPipTest]
|
||||
* 2. Part of the test setup occurs automatically via
|
||||
* [com.android.server.wm.flicker.TransitionRunnerWithRules],
|
||||
* including configuring navigation mode, initial orientation and ensuring no
|
||||
* apps are running before setup
|
||||
* ```
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@@ -57,9 +60,7 @@ import org.junit.runners.Parameterized
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
@FlakyTest(bugId = 238367575)
|
||||
class AutoEnterPipOnGoToHomeTest(testSpec: FlickerTestParameter) : EnterPipTest(testSpec) {
|
||||
/**
|
||||
* Defines the transition used to run the test
|
||||
*/
|
||||
/** Defines the transition used to run the test */
|
||||
override val transition: FlickerBuilder.() -> Unit
|
||||
get() = {
|
||||
setup {
|
||||
@@ -76,9 +77,7 @@ class AutoEnterPipOnGoToHomeTest(testSpec: FlickerTestParameter) : EnterPipTest(
|
||||
RemoveAllTasksButHomeRule.removeAllTasksButHome()
|
||||
pipApp.exit(wmHelper)
|
||||
}
|
||||
transitions {
|
||||
tapl.goHome()
|
||||
}
|
||||
transitions { tapl.goHome() }
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@@ -92,9 +91,7 @@ class AutoEnterPipOnGoToHomeTest(testSpec: FlickerTestParameter) : EnterPipTest(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [pipApp] window is animated towards default position in right bottom corner
|
||||
*/
|
||||
/** Checks that [pipApp] window is animated towards default position in right bottom corner */
|
||||
@Presubmit
|
||||
@Test
|
||||
fun pipLayerMovesTowardsRightBottomCorner() {
|
||||
|
||||
@@ -40,25 +40,26 @@ import org.junit.runners.Parameterized
|
||||
* To run this test: `atest WMShellFlickerTests:EnterPipOnUserLeaveHintTest`
|
||||
*
|
||||
* Actions:
|
||||
* ```
|
||||
* Launch an app in full screen
|
||||
* Select "Via code behind" radio button
|
||||
* Press Home button or swipe up to go Home and put [pipApp] in pip mode
|
||||
*
|
||||
* ```
|
||||
* Notes:
|
||||
* ```
|
||||
* 1. All assertions are inherited from [EnterPipTest]
|
||||
* 2. Part of the test setup occurs automatically via
|
||||
* [com.android.server.wm.flicker.TransitionRunnerWithRules],
|
||||
* including configuring navigation mode, initial orientation and ensuring no
|
||||
* apps are running before setup
|
||||
* ```
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
class EnterPipOnUserLeaveHintTest(testSpec: FlickerTestParameter) : EnterPipTest(testSpec) {
|
||||
/**
|
||||
* Defines the transition used to run the test
|
||||
*/
|
||||
/** Defines the transition used to run the test */
|
||||
override val transition: FlickerBuilder.() -> Unit
|
||||
get() = {
|
||||
setup {
|
||||
@@ -73,20 +74,17 @@ class EnterPipOnUserLeaveHintTest(testSpec: FlickerTestParameter) : EnterPipTest
|
||||
RemoveAllTasksButHomeRule.removeAllTasksButHome()
|
||||
pipApp.exit(wmHelper)
|
||||
}
|
||||
transitions {
|
||||
tapl.goHome()
|
||||
}
|
||||
transitions { tapl.goHome() }
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
override fun pipAppLayerAlwaysVisible() {
|
||||
if (!testSpec.isGesturalNavigation) super.pipAppLayerAlwaysVisible() else {
|
||||
if (!testSpec.isGesturalNavigation) super.pipAppLayerAlwaysVisible()
|
||||
else {
|
||||
// pip layer in gesture nav will disappear during transition
|
||||
testSpec.assertLayers {
|
||||
this.isVisible(pipApp)
|
||||
.then().isInvisible(pipApp)
|
||||
.then().isVisible(pipApp)
|
||||
this.isVisible(pipApp).then().isInvisible(pipApp).then().isVisible(pipApp)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,14 +122,11 @@ class EnterPipOnUserLeaveHintTest(testSpec: FlickerTestParameter) : EnterPipTest
|
||||
@Presubmit
|
||||
@Test
|
||||
override fun pipLayerRemainInsideVisibleBounds() {
|
||||
if (!testSpec.isGesturalNavigation) super.pipLayerRemainInsideVisibleBounds() else {
|
||||
if (!testSpec.isGesturalNavigation) super.pipLayerRemainInsideVisibleBounds()
|
||||
else {
|
||||
// pip layer in gesture nav will disappear during transition
|
||||
testSpec.assertLayersStart {
|
||||
this.visibleRegion(pipApp).coversAtMost(displayBounds)
|
||||
}
|
||||
testSpec.assertLayersEnd {
|
||||
this.visibleRegion(pipApp).coversAtMost(displayBounds)
|
||||
}
|
||||
testSpec.assertLayersStart { this.visibleRegion(pipApp).coversAtMost(displayBounds) }
|
||||
testSpec.assertLayersEnd { this.visibleRegion(pipApp).coversAtMost(displayBounds) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,16 +40,19 @@ import org.junit.runners.Parameterized
|
||||
* To run this test: `atest WMShellFlickerTests:EnterPipTest`
|
||||
*
|
||||
* Actions:
|
||||
* ```
|
||||
* Launch an app in full screen
|
||||
* Press an "enter pip" button to put [pipApp] in pip mode
|
||||
*
|
||||
* ```
|
||||
* Notes:
|
||||
* ```
|
||||
* 1. Some default assertions (e.g., nav bar, status bar and screen covered)
|
||||
* are inherited from [PipTransition]
|
||||
* 2. Part of the test setup occurs automatically via
|
||||
* [com.android.server.wm.flicker.TransitionRunnerWithRules],
|
||||
* including configuring navigation mode, initial orientation and ensuring no
|
||||
* apps are running before setup
|
||||
* ```
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@@ -57,7 +60,7 @@ import org.junit.runners.Parameterized
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
open class EnterPipTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
/** {@inheritDoc} */
|
||||
override val transition: FlickerBuilder.() -> Unit
|
||||
get() = {
|
||||
setup {
|
||||
@@ -70,31 +73,21 @@ open class EnterPipTest(testSpec: FlickerTestParameter) : PipTransition(testSpec
|
||||
RemoveAllTasksButHomeRule.removeAllTasksButHome()
|
||||
pipApp.exit(wmHelper)
|
||||
}
|
||||
transitions {
|
||||
pipApp.clickEnterPipButton(wmHelper)
|
||||
}
|
||||
transitions { pipApp.clickEnterPipButton(wmHelper) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks [pipApp] window remains visible throughout the animation
|
||||
*/
|
||||
/** Checks [pipApp] window remains visible throughout the animation */
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun pipAppWindowAlwaysVisible() {
|
||||
testSpec.assertWm {
|
||||
this.isAppWindowVisible(pipApp)
|
||||
}
|
||||
testSpec.assertWm { this.isAppWindowVisible(pipApp) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks [pipApp] layer remains visible throughout the animation
|
||||
*/
|
||||
/** Checks [pipApp] layer remains visible throughout the animation */
|
||||
@FlakyTest(bugId = 239807171)
|
||||
@Test
|
||||
open fun pipAppLayerAlwaysVisible() {
|
||||
testSpec.assertLayers {
|
||||
this.isVisible(pipApp)
|
||||
}
|
||||
testSpec.assertLayers { this.isVisible(pipApp) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,9 +97,7 @@ open class EnterPipTest(testSpec: FlickerTestParameter) : PipTransition(testSpec
|
||||
@Presubmit
|
||||
@Test
|
||||
fun pipWindowRemainInsideVisibleBounds() {
|
||||
testSpec.assertWmVisibleRegion(pipApp) {
|
||||
coversAtMost(displayBounds)
|
||||
}
|
||||
testSpec.assertWmVisibleRegion(pipApp) { coversAtMost(displayBounds) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,14 +107,10 @@ open class EnterPipTest(testSpec: FlickerTestParameter) : PipTransition(testSpec
|
||||
@FlakyTest(bugId = 239807171)
|
||||
@Test
|
||||
open fun pipLayerRemainInsideVisibleBounds() {
|
||||
testSpec.assertLayersVisibleRegion(pipApp) {
|
||||
coversAtMost(displayBounds)
|
||||
}
|
||||
testSpec.assertLayersVisibleRegion(pipApp) { coversAtMost(displayBounds) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the visible region of [pipApp] always reduces during the animation
|
||||
*/
|
||||
/** Checks that the visible region of [pipApp] always reduces during the animation */
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun pipLayerReduces() {
|
||||
@@ -135,9 +122,7 @@ open class EnterPipTest(testSpec: FlickerTestParameter) : PipTransition(testSpec
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [pipApp] window becomes pinned
|
||||
*/
|
||||
/** Checks that [pipApp] window becomes pinned */
|
||||
@Presubmit
|
||||
@Test
|
||||
fun pipWindowBecomesPinned() {
|
||||
@@ -148,9 +133,7 @@ open class EnterPipTest(testSpec: FlickerTestParameter) : PipTransition(testSpec
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks [ComponentMatcher.LAUNCHER] layer remains visible throughout the animation
|
||||
*/
|
||||
/** Checks [ComponentMatcher.LAUNCHER] layer remains visible throughout the animation */
|
||||
@Presubmit
|
||||
@Test
|
||||
fun launcherLayerBecomesVisible() {
|
||||
@@ -162,31 +145,27 @@ open class EnterPipTest(testSpec: FlickerTestParameter) : PipTransition(testSpec
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the focus changes between the [pipApp] window and the launcher when
|
||||
* closing the pip window
|
||||
* Checks that the focus changes between the [pipApp] window and the launcher when closing the
|
||||
* pip window
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun focusChanges() {
|
||||
testSpec.assertEventLog {
|
||||
this.focusChanges(pipApp.`package`, "NexusLauncherActivity")
|
||||
}
|
||||
testSpec.assertEventLog { this.focusChanges(pipApp.`package`, "NexusLauncherActivity") }
|
||||
}
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* Creates the test configurations.
|
||||
*
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
|
||||
* repetitions, screen orientation and navigation modes.
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring repetitions,
|
||||
* screen orientation and navigation modes.
|
||||
*/
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): List<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(
|
||||
supportedRotations = listOf(Surface.ROTATION_0)
|
||||
)
|
||||
.getConfigNonRotationTests(supportedRotations = listOf(Surface.ROTATION_0))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,9 +21,7 @@ import com.android.server.wm.flicker.FlickerTestParameter
|
||||
import com.android.server.wm.flicker.helpers.FixedOrientationAppHelper
|
||||
import org.junit.Test
|
||||
|
||||
/**
|
||||
* Base class for pip expand tests
|
||||
*/
|
||||
/** Base class for pip expand tests */
|
||||
abstract class ExitPipToAppTransition(testSpec: FlickerTestParameter) : PipTransition(testSpec) {
|
||||
protected val testApp = FixedOrientationAppHelper(instrumentation)
|
||||
|
||||
@@ -34,9 +32,7 @@ abstract class ExitPipToAppTransition(testSpec: FlickerTestParameter) : PipTrans
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun pipAppWindowRemainInsideVisibleBounds() {
|
||||
testSpec.assertWmVisibleRegion(pipApp) {
|
||||
coversAtMost(displayBounds)
|
||||
}
|
||||
testSpec.assertWmVisibleRegion(pipApp) { coversAtMost(displayBounds) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,9 +42,7 @@ abstract class ExitPipToAppTransition(testSpec: FlickerTestParameter) : PipTrans
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun pipAppLayerRemainInsideVisibleBounds() {
|
||||
testSpec.assertLayersVisibleRegion(pipApp) {
|
||||
coversAtMost(displayBounds)
|
||||
}
|
||||
testSpec.assertLayersVisibleRegion(pipApp) { coversAtMost(displayBounds) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,44 +72,34 @@ abstract class ExitPipToAppTransition(testSpec: FlickerTestParameter) : PipTrans
|
||||
@Test
|
||||
open fun showBothAppLayersThenHidePip() {
|
||||
testSpec.assertLayers {
|
||||
isVisible(testApp)
|
||||
.isVisible(pipApp)
|
||||
.then()
|
||||
.isInvisible(testApp)
|
||||
.isVisible(pipApp)
|
||||
isVisible(testApp).isVisible(pipApp).then().isInvisible(testApp).isVisible(pipApp)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the visible region of [testApp] plus the visible region of [pipApp]
|
||||
* cover the full display area at the start of the transition
|
||||
* Checks that the visible region of [testApp] plus the visible region of [pipApp] cover the
|
||||
* full display area at the start of the transition
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun testPlusPipAppsCoverFullScreenAtStart() {
|
||||
testSpec.assertLayersStart {
|
||||
val pipRegion = visibleRegion(pipApp).region
|
||||
visibleRegion(testApp)
|
||||
.plus(pipRegion)
|
||||
.coversExactly(displayBounds)
|
||||
visibleRegion(testApp).plus(pipRegion).coversExactly(displayBounds)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the visible region oft [pipApp] covers the full display area at the end of
|
||||
* the transition
|
||||
* Checks that the visible region oft [pipApp] covers the full display area at the end of the
|
||||
* transition
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun pipAppCoversFullScreenAtEnd() {
|
||||
testSpec.assertLayersEnd {
|
||||
visibleRegion(pipApp).coversExactly(displayBounds)
|
||||
}
|
||||
testSpec.assertLayersEnd { visibleRegion(pipApp).coversExactly(displayBounds) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the visible region of [pipApp] always expands during the animation
|
||||
*/
|
||||
/** Checks that the visible region of [pipApp] always expands during the animation */
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun pipLayerExpands() {
|
||||
@@ -127,8 +111,6 @@ abstract class ExitPipToAppTransition(testSpec: FlickerTestParameter) : PipTrans
|
||||
}
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Presubmit
|
||||
@Test
|
||||
override fun entireScreenCovered() = super.entireScreenCovered()
|
||||
/** {@inheritDoc} */
|
||||
@Presubmit @Test override fun entireScreenCovered() = super.entireScreenCovered()
|
||||
}
|
||||
|
||||
@@ -25,24 +25,18 @@ import com.android.server.wm.flicker.helpers.setRotation
|
||||
import com.android.server.wm.traces.common.ComponentNameMatcher.Companion.LAUNCHER
|
||||
import org.junit.Test
|
||||
|
||||
/**
|
||||
* Base class for exiting pip (closing pip window) without returning to the app
|
||||
*/
|
||||
/** Base class for exiting pip (closing pip window) without returning to the app */
|
||||
abstract class ExitPipTransition(testSpec: FlickerTestParameter) : PipTransition(testSpec) {
|
||||
override val transition: FlickerBuilder.() -> Unit
|
||||
get() = buildTransition {
|
||||
setup {
|
||||
this.setRotation(testSpec.startRotation)
|
||||
}
|
||||
teardown {
|
||||
this.setRotation(Surface.ROTATION_0)
|
||||
}
|
||||
setup { this.setRotation(testSpec.startRotation) }
|
||||
teardown { this.setRotation(Surface.ROTATION_0) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [pipApp] window is pinned and visible at the start and then becomes
|
||||
* unpinned and invisible at the same moment, and remains unpinned and invisible
|
||||
* until the end of the transition
|
||||
* Checks that [pipApp] window is pinned and visible at the start and then becomes unpinned and
|
||||
* invisible at the same moment, and remains unpinned and invisible until the end of the
|
||||
* transition
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
@@ -53,30 +47,24 @@ abstract class ExitPipTransition(testSpec: FlickerTestParameter) : PipTransition
|
||||
// and isAppWindowInvisible in the same assertion block.
|
||||
testSpec.assertWm {
|
||||
this.invoke("hasPipWindow") {
|
||||
it.isPinned(pipApp)
|
||||
.isAppWindowVisible(pipApp)
|
||||
.isAppWindowOnTop(pipApp)
|
||||
}.then().invoke("!hasPipWindow") {
|
||||
it.isNotPinned(pipApp)
|
||||
.isAppWindowNotOnTop(pipApp)
|
||||
}
|
||||
it.isPinned(pipApp).isAppWindowVisible(pipApp).isAppWindowOnTop(pipApp)
|
||||
}
|
||||
.then()
|
||||
.invoke("!hasPipWindow") { it.isNotPinned(pipApp).isAppWindowNotOnTop(pipApp) }
|
||||
}
|
||||
testSpec.assertWmEnd { isAppWindowInvisible(pipApp) }
|
||||
} else {
|
||||
testSpec.assertWm {
|
||||
this.invoke("hasPipWindow") {
|
||||
it.isPinned(pipApp).isAppWindowVisible(pipApp)
|
||||
}.then().invoke("!hasPipWindow") {
|
||||
it.isNotPinned(pipApp).isAppWindowInvisible(pipApp)
|
||||
}
|
||||
this.invoke("hasPipWindow") { it.isPinned(pipApp).isAppWindowVisible(pipApp) }
|
||||
.then()
|
||||
.invoke("!hasPipWindow") { it.isNotPinned(pipApp).isAppWindowInvisible(pipApp) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [pipApp] and [LAUNCHER] layers are visible at the start
|
||||
* of the transition. Then [pipApp] layer becomes invisible, and remains invisible
|
||||
* until the end of the transition
|
||||
* Checks that [pipApp] and [LAUNCHER] layers are visible at the start of the transition. Then
|
||||
* [pipApp] layer becomes invisible, and remains invisible until the end of the transition
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
|
||||
@@ -38,17 +38,20 @@ import org.junit.runners.Parameterized
|
||||
* To run this test: `atest WMShellFlickerTests:ExitPipViaIntentTest`
|
||||
*
|
||||
* Actions:
|
||||
* ```
|
||||
* Launch an app in pip mode [pipApp],
|
||||
* Launch another full screen mode [testApp]
|
||||
* Expand [pipApp] app to full screen via an intent
|
||||
*
|
||||
* ```
|
||||
* Notes:
|
||||
* ```
|
||||
* 1. Some default assertions (e.g., nav bar, status bar and screen covered)
|
||||
* are inherited from [PipTransition]
|
||||
* 2. Part of the test setup occurs automatically via
|
||||
* [com.android.server.wm.flicker.TransitionRunnerWithRules],
|
||||
* including configuring navigation mode, initial orientation and ensuring no
|
||||
* apps are running before setup
|
||||
* ```
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@@ -56,9 +59,7 @@ import org.junit.runners.Parameterized
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
class ExitPipViaIntentTest(testSpec: FlickerTestParameter) : ExitPipToAppTransition(testSpec) {
|
||||
|
||||
/**
|
||||
* Defines the transition used to run the test
|
||||
*/
|
||||
/** Defines the transition used to run the test */
|
||||
override val transition: FlickerBuilder.() -> Unit
|
||||
get() = buildTransition {
|
||||
setup {
|
||||
@@ -69,18 +70,14 @@ class ExitPipViaIntentTest(testSpec: FlickerTestParameter) : ExitPipToAppTransit
|
||||
// This will bring PipApp to fullscreen
|
||||
pipApp.exitPipToFullScreenViaIntent(wmHelper)
|
||||
// Wait until the other app is no longer visible
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withWindowSurfaceDisappeared(testApp)
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withWindowSurfaceDisappeared(testApp).waitForAndVerify()
|
||||
}
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@FlakyTest
|
||||
@Test
|
||||
override fun entireScreenCovered() = super.entireScreenCovered()
|
||||
/** {@inheritDoc} */
|
||||
@FlakyTest @Test override fun entireScreenCovered() = super.entireScreenCovered()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
/** {@inheritDoc} */
|
||||
@Presubmit
|
||||
@Test
|
||||
override fun statusBarLayerPositionAtStartAndEnd() {
|
||||
@@ -95,7 +92,7 @@ class ExitPipViaIntentTest(testSpec: FlickerTestParameter) : ExitPipToAppTransit
|
||||
super.statusBarLayerPositionAtStartAndEnd()
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
/** {@inheritDoc} */
|
||||
@FlakyTest(bugId = 197726610)
|
||||
@Test
|
||||
override fun pipLayerExpands() {
|
||||
@@ -114,14 +111,14 @@ class ExitPipViaIntentTest(testSpec: FlickerTestParameter) : ExitPipToAppTransit
|
||||
/**
|
||||
* Creates the test configurations.
|
||||
*
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
|
||||
* repetitions, screen orientation and navigation modes.
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring repetitions,
|
||||
* screen orientation and navigation modes.
|
||||
*/
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): List<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests(
|
||||
supportedRotations = listOf(Surface.ROTATION_0))
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(supportedRotations = listOf(Surface.ROTATION_0))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,17 +35,20 @@ import org.junit.runners.Parameterized
|
||||
* To run this test: `atest WMShellFlickerTests:ExitPipWithDismissButtonTest`
|
||||
*
|
||||
* Actions:
|
||||
* ```
|
||||
* Launch an app in pip mode [pipApp],
|
||||
* Click on the pip window
|
||||
* Click on dismiss button and wait window disappear
|
||||
*
|
||||
* ```
|
||||
* Notes:
|
||||
* ```
|
||||
* 1. Some default assertions (e.g., nav bar, status bar and screen covered)
|
||||
* are inherited [PipTransition]
|
||||
* 2. Part of the test setup occurs automatically via
|
||||
* [com.android.server.wm.flicker.TransitionRunnerWithRules],
|
||||
* including configuring navigation mode, initial orientation and ensuring no
|
||||
* apps are running before setup
|
||||
* ```
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@@ -56,9 +59,7 @@ class ExitPipWithDismissButtonTest(testSpec: FlickerTestParameter) : ExitPipTran
|
||||
override val transition: FlickerBuilder.() -> Unit
|
||||
get() = {
|
||||
super.transition(this)
|
||||
transitions {
|
||||
pipApp.closePipWindow(wmHelper)
|
||||
}
|
||||
transitions { pipApp.closePipWindow(wmHelper) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,23 +69,21 @@ class ExitPipWithDismissButtonTest(testSpec: FlickerTestParameter) : ExitPipTran
|
||||
@Presubmit
|
||||
@Test
|
||||
fun focusChanges() {
|
||||
testSpec.assertEventLog {
|
||||
this.focusChanges("PipMenuView", "NexusLauncherActivity")
|
||||
}
|
||||
testSpec.assertEventLog { this.focusChanges("PipMenuView", "NexusLauncherActivity") }
|
||||
}
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* Creates the test configurations.
|
||||
*
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
|
||||
* repetitions, screen orientation and navigation modes.
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring repetitions,
|
||||
* screen orientation and navigation modes.
|
||||
*/
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): List<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(supportedRotations = listOf(Surface.ROTATION_0))
|
||||
.getConfigNonRotationTests(supportedRotations = listOf(Surface.ROTATION_0))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,16 +36,19 @@ import org.junit.runners.Parameterized
|
||||
* To run this test: `atest WMShellFlickerTests:ExitPipWithSwipeDownTest`
|
||||
*
|
||||
* Actions:
|
||||
* ```
|
||||
* Launch an app in pip mode [pipApp],
|
||||
* Swipe the pip window to the bottom-center of the screen and wait it disappear
|
||||
*
|
||||
* ```
|
||||
* Notes:
|
||||
* ```
|
||||
* 1. Some default assertions (e.g., nav bar, status bar and screen covered)
|
||||
* are inherited [PipTransition]
|
||||
* 2. Part of the test setup occurs automatically via
|
||||
* [com.android.server.wm.flicker.TransitionRunnerWithRules],
|
||||
* including configuring navigation mode, initial orientation and ensuring no
|
||||
* apps are running before setup
|
||||
* ```
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@@ -60,20 +63,24 @@ class ExitPipWithSwipeDownTest(testSpec: FlickerTestParameter) : ExitPipTransiti
|
||||
val pipCenterX = pipRegion.centerX()
|
||||
val pipCenterY = pipRegion.centerY()
|
||||
val displayCenterX = device.displayWidth / 2
|
||||
val barComponent = if (testSpec.isTablet) {
|
||||
ComponentNameMatcher.TASK_BAR
|
||||
} else {
|
||||
ComponentNameMatcher.NAV_BAR
|
||||
}
|
||||
val barLayerHeight = wmHelper.currentState.layerState
|
||||
.getLayerWithBuffer(barComponent)
|
||||
?.visibleRegion
|
||||
?.height ?: error("Couldn't find Nav or Task bar layer")
|
||||
val barComponent =
|
||||
if (testSpec.isTablet) {
|
||||
ComponentNameMatcher.TASK_BAR
|
||||
} else {
|
||||
ComponentNameMatcher.NAV_BAR
|
||||
}
|
||||
val barLayerHeight =
|
||||
wmHelper.currentState.layerState
|
||||
.getLayerWithBuffer(barComponent)
|
||||
?.visibleRegion
|
||||
?.height
|
||||
?: error("Couldn't find Nav or Task bar layer")
|
||||
// The dismiss button doesn't appear at the complete bottom of the screen,
|
||||
val displayY = device.displayHeight - barLayerHeight
|
||||
device.swipe(pipCenterX, pipCenterY, displayCenterX, displayY, 50)
|
||||
// Wait until the other app is no longer visible
|
||||
wmHelper.StateSyncBuilder()
|
||||
wmHelper
|
||||
.StateSyncBuilder()
|
||||
.withPipGone()
|
||||
.withWindowSurfaceDisappeared(pipApp)
|
||||
.withAppTransitionIdle()
|
||||
@@ -81,29 +88,25 @@ class ExitPipWithSwipeDownTest(testSpec: FlickerTestParameter) : ExitPipTransiti
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the focus doesn't change between windows during the transition
|
||||
*/
|
||||
/** Checks that the focus doesn't change between windows during the transition */
|
||||
@Presubmit
|
||||
@Test
|
||||
fun focusDoesNotChange() {
|
||||
testSpec.assertEventLog {
|
||||
this.focusDoesNotChange()
|
||||
}
|
||||
testSpec.assertEventLog { this.focusDoesNotChange() }
|
||||
}
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* Creates the test configurations.
|
||||
*
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
|
||||
* repetitions, screen orientation and navigation modes.
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring repetitions,
|
||||
* screen orientation and navigation modes.
|
||||
*/
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): List<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(supportedRotations = listOf(Surface.ROTATION_0))
|
||||
.getConfigNonRotationTests(supportedRotations = listOf(Surface.ROTATION_0))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,34 +23,23 @@ import com.android.server.wm.flicker.traces.region.RegionSubject
|
||||
import com.android.wm.shell.flicker.Direction
|
||||
import org.junit.Test
|
||||
|
||||
/**
|
||||
* Base class for pip tests with Launcher shelf height change
|
||||
*/
|
||||
abstract class MovePipShelfHeightTransition(
|
||||
testSpec: FlickerTestParameter
|
||||
) : PipTransition(testSpec) {
|
||||
/** Base class for pip tests with Launcher shelf height change */
|
||||
abstract class MovePipShelfHeightTransition(testSpec: FlickerTestParameter) :
|
||||
PipTransition(testSpec) {
|
||||
protected val testApp = FixedOrientationAppHelper(instrumentation)
|
||||
|
||||
/**
|
||||
* Checks [pipApp] window remains visible throughout the animation
|
||||
*/
|
||||
/** Checks [pipApp] window remains visible throughout the animation */
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun pipWindowIsAlwaysVisible() {
|
||||
testSpec.assertWm {
|
||||
isAppWindowVisible(pipApp)
|
||||
}
|
||||
testSpec.assertWm { isAppWindowVisible(pipApp) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks [pipApp] layer remains visible throughout the animation
|
||||
*/
|
||||
/** Checks [pipApp] layer remains visible throughout the animation */
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun pipLayerIsAlwaysVisible() {
|
||||
testSpec.assertLayers {
|
||||
isVisible(pipApp)
|
||||
}
|
||||
testSpec.assertLayers { isVisible(pipApp) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,9 +49,7 @@ abstract class MovePipShelfHeightTransition(
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun pipWindowRemainInsideVisibleBounds() {
|
||||
testSpec.assertWmVisibleRegion(pipApp) {
|
||||
coversAtMost(displayBounds)
|
||||
}
|
||||
testSpec.assertWmVisibleRegion(pipApp) { coversAtMost(displayBounds) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,9 +59,7 @@ abstract class MovePipShelfHeightTransition(
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun pipLayerRemainInsideVisibleBounds() {
|
||||
testSpec.assertLayersVisibleRegion(pipApp) {
|
||||
coversAtMost(displayBounds)
|
||||
}
|
||||
testSpec.assertLayersVisibleRegion(pipApp) { coversAtMost(displayBounds) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,9 +68,8 @@ abstract class MovePipShelfHeightTransition(
|
||||
*/
|
||||
protected fun pipWindowMoves(direction: Direction) {
|
||||
testSpec.assertWm {
|
||||
val pipWindowFrameList = this.windowStates {
|
||||
pipApp.windowMatchesAnyOf(it) && it.isVisible
|
||||
}.map { it.frame }
|
||||
val pipWindowFrameList =
|
||||
this.windowStates { pipApp.windowMatchesAnyOf(it) && it.isVisible }.map { it.frame }
|
||||
when (direction) {
|
||||
Direction.UP -> assertRegionMovementUp(pipWindowFrameList)
|
||||
Direction.DOWN -> assertRegionMovementDown(pipWindowFrameList)
|
||||
@@ -100,9 +84,9 @@ abstract class MovePipShelfHeightTransition(
|
||||
*/
|
||||
protected fun pipLayerMoves(direction: Direction) {
|
||||
testSpec.assertLayers {
|
||||
val pipLayerRegionList = this.layers {
|
||||
pipApp.layerMatchesAnyOf(it) && it.isVisible
|
||||
}.map { it.visibleRegion }
|
||||
val pipLayerRegionList =
|
||||
this.layers { pipApp.layerMatchesAnyOf(it) && it.isVisible }
|
||||
.map { it.visibleRegion }
|
||||
when (direction) {
|
||||
Direction.UP -> assertRegionMovementUp(pipLayerRegionList)
|
||||
Direction.DOWN -> assertRegionMovementDown(pipLayerRegionList)
|
||||
|
||||
@@ -36,10 +36,7 @@ import org.junit.runner.RunWith
|
||||
import org.junit.runners.MethodSorters
|
||||
import org.junit.runners.Parameterized
|
||||
|
||||
/**
|
||||
* Test Pip launch.
|
||||
* To run this test: `atest WMShellFlickerTests:PipKeyboardTest`
|
||||
*/
|
||||
/** Test Pip launch. To run this test: `atest WMShellFlickerTests:PipKeyboardTest` */
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@@ -52,7 +49,7 @@ open class PipKeyboardTest(testSpec: FlickerTestParameter) : PipTransition(testS
|
||||
assumeFalse(isShellTransitionsEnabled)
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
/** {@inheritDoc} */
|
||||
override val transition: FlickerBuilder.() -> Unit
|
||||
get() = buildTransition {
|
||||
setup {
|
||||
@@ -73,9 +70,7 @@ open class PipKeyboardTest(testSpec: FlickerTestParameter) : PipTransition(testS
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure the pip window remains visible throughout any keyboard interactions
|
||||
*/
|
||||
/** Ensure the pip window remains visible throughout any keyboard interactions */
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun pipInVisibleBounds() {
|
||||
@@ -85,15 +80,11 @@ open class PipKeyboardTest(testSpec: FlickerTestParameter) : PipTransition(testS
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that the pip window does not obscure the keyboard
|
||||
*/
|
||||
/** Ensure that the pip window does not obscure the keyboard */
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun pipIsAboveAppWindow() {
|
||||
testSpec.assertWmTag(TAG_IME_VISIBLE) {
|
||||
isAboveWindow(ComponentNameMatcher.IME, pipApp)
|
||||
}
|
||||
testSpec.assertWmTag(TAG_IME_VISIBLE) { isAboveWindow(ComponentNameMatcher.IME, pipApp) }
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -42,6 +42,5 @@ class PipKeyboardTestShellTransit(testSpec: FlickerTestParameter) : PipKeyboardT
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
override fun statusBarLayerPositionAtStartAndEnd() =
|
||||
super.statusBarLayerPositionAtStartAndEnd()
|
||||
override fun statusBarLayerPositionAtStartAndEnd() = super.statusBarLayerPositionAtStartAndEnd()
|
||||
}
|
||||
|
||||
@@ -42,18 +42,21 @@ import org.junit.runners.Parameterized
|
||||
* To run this test: `atest WMShellFlickerTests:PipRotationTest`
|
||||
*
|
||||
* Actions:
|
||||
* ```
|
||||
* Launch a [pipApp] in pip mode
|
||||
* Launch another app [fixedApp] (appears below pip)
|
||||
* Rotate the screen from [testSpec.startRotation] to [testSpec.endRotation]
|
||||
* (usually, 0->90 and 90->0)
|
||||
*
|
||||
* ```
|
||||
* Notes:
|
||||
* ```
|
||||
* 1. Some default assertions (e.g., nav bar, status bar and screen covered)
|
||||
* are inherited from [PipTransition]
|
||||
* 2. Part of the test setup occurs automatically via
|
||||
* [com.android.server.wm.flicker.TransitionRunnerWithRules],
|
||||
* including configuring navigation mode, initial orientation and ensuring no
|
||||
* apps are running before setup
|
||||
* ```
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@@ -75,43 +78,31 @@ open class PipRotationTest(testSpec: FlickerTestParameter) : PipTransition(testS
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
setRotation(testSpec.startRotation)
|
||||
}
|
||||
transitions {
|
||||
setRotation(testSpec.endRotation)
|
||||
}
|
||||
transitions { setRotation(testSpec.endRotation) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the position of the navigation bar at the start and end of the transition
|
||||
*/
|
||||
/** Checks the position of the navigation bar at the start and end of the transition */
|
||||
@FlakyTest(bugId = 240499181)
|
||||
@Test
|
||||
override fun navBarLayerPositionAtStartAndEnd() = super.navBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/**
|
||||
* Checks that [testApp] layer is within [screenBoundsStart] at the start of the transition
|
||||
*/
|
||||
/** Checks that [testApp] layer is within [screenBoundsStart] at the start of the transition */
|
||||
@Presubmit
|
||||
@Test
|
||||
fun fixedAppLayer_StartingBounds() {
|
||||
testSpec.assertLayersStart {
|
||||
visibleRegion(testApp).coversAtMost(screenBoundsStart)
|
||||
}
|
||||
testSpec.assertLayersStart { visibleRegion(testApp).coversAtMost(screenBoundsStart) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [testApp] layer is within [screenBoundsEnd] at the end of the transition
|
||||
*/
|
||||
/** Checks that [testApp] layer is within [screenBoundsEnd] at the end of the transition */
|
||||
@Presubmit
|
||||
@Test
|
||||
fun fixedAppLayer_EndingBounds() {
|
||||
testSpec.assertLayersEnd {
|
||||
visibleRegion(testApp).coversAtMost(screenBoundsEnd)
|
||||
}
|
||||
testSpec.assertLayersEnd { visibleRegion(testApp).coversAtMost(screenBoundsEnd) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [testApp] plus [pipApp] layers are within [screenBoundsEnd] at the start
|
||||
* of the transition
|
||||
* Checks that [testApp] plus [pipApp] layers are within [screenBoundsEnd] at the start of the
|
||||
* transition
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
@@ -122,8 +113,8 @@ open class PipRotationTest(testSpec: FlickerTestParameter) : PipTransition(testS
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [testApp] plus [pipApp] layers are within [screenBoundsEnd] at the end
|
||||
* of the transition
|
||||
* Checks that [testApp] plus [pipApp] layers are within [screenBoundsEnd] at the end of the
|
||||
* transition
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
@@ -133,57 +124,41 @@ open class PipRotationTest(testSpec: FlickerTestParameter) : PipTransition(testS
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [pipApp] layer is within [screenBoundsStart] at the start of the transition
|
||||
*/
|
||||
/** Checks that [pipApp] layer is within [screenBoundsStart] at the start of the transition */
|
||||
private fun pipLayerRotates_StartingBounds_internal() {
|
||||
testSpec.assertLayersStart {
|
||||
visibleRegion(pipApp).coversAtMost(screenBoundsStart)
|
||||
}
|
||||
testSpec.assertLayersStart { visibleRegion(pipApp).coversAtMost(screenBoundsStart) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [pipApp] layer is within [screenBoundsStart] at the start of the transition
|
||||
*/
|
||||
/** Checks that [pipApp] layer is within [screenBoundsStart] at the start of the transition */
|
||||
@Presubmit
|
||||
@Test
|
||||
fun pipLayerRotates_StartingBounds() {
|
||||
pipLayerRotates_StartingBounds_internal()
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [pipApp] layer is within [screenBoundsEnd] at the end of the transition
|
||||
*/
|
||||
/** Checks that [pipApp] layer is within [screenBoundsEnd] at the end of the transition */
|
||||
@Presubmit
|
||||
@Test
|
||||
fun pipLayerRotates_EndingBounds() {
|
||||
testSpec.assertLayersEnd {
|
||||
visibleRegion(pipApp).coversAtMost(screenBoundsEnd)
|
||||
}
|
||||
testSpec.assertLayersEnd { visibleRegion(pipApp).coversAtMost(screenBoundsEnd) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that the [pipApp] window does not obscure the [testApp] at the start of the
|
||||
* transition
|
||||
* Ensure that the [pipApp] window does not obscure the [testApp] at the start of the transition
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
fun pipIsAboveFixedAppWindow_Start() {
|
||||
testSpec.assertWmStart {
|
||||
isAboveWindow(pipApp, testApp)
|
||||
}
|
||||
testSpec.assertWmStart { isAboveWindow(pipApp, testApp) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that the [pipApp] window does not obscure the [testApp] at the end of the
|
||||
* transition
|
||||
* Ensure that the [pipApp] window does not obscure the [testApp] at the end of the transition
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
fun pipIsAboveFixedAppWindow_End() {
|
||||
testSpec.assertWmEnd {
|
||||
isAboveWindow(pipApp, testApp)
|
||||
}
|
||||
testSpec.assertWmEnd { isAboveWindow(pipApp, testApp) }
|
||||
}
|
||||
|
||||
@FlakyTest(bugId = 240499181)
|
||||
@@ -196,15 +171,16 @@ open class PipRotationTest(testSpec: FlickerTestParameter) : PipTransition(testS
|
||||
/**
|
||||
* Creates the test configurations.
|
||||
*
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
|
||||
* repetitions, screen orientation and navigation modes.
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring repetitions,
|
||||
* screen orientation and navigation modes.
|
||||
*/
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance().getConfigRotationTests(
|
||||
supportedRotations = listOf(Surface.ROTATION_0, Surface.ROTATION_90)
|
||||
)
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigRotationTests(
|
||||
supportedRotations = listOf(Surface.ROTATION_0, Surface.ROTATION_90)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,18 +35,21 @@ import org.junit.runners.Parameterized
|
||||
* To run this test: `atest WMShellFlickerTests:PipRotationTest_ShellTransit`
|
||||
*
|
||||
* Actions:
|
||||
* ```
|
||||
* Launch a [pipApp] in pip mode
|
||||
* Launch another app [fixedApp] (appears below pip)
|
||||
* Rotate the screen from [testSpec.startRotation] to [testSpec.endRotation]
|
||||
* (usually, 0->90 and 90->0)
|
||||
*
|
||||
* ```
|
||||
* Notes:
|
||||
* ```
|
||||
* 1. Some default assertions (e.g., nav bar, status bar and screen covered)
|
||||
* are inherited from [PipTransition]
|
||||
* 2. Part of the test setup occurs automatically via
|
||||
* [com.android.server.wm.flicker.TransitionRunnerWithRules],
|
||||
* including configuring navigation mode, initial orientation and ensuring no
|
||||
* apps are running before setup
|
||||
* ```
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@@ -59,9 +62,8 @@ class PipRotationTest_ShellTransit(testSpec: FlickerTestParameter) : PipRotation
|
||||
Assume.assumeTrue(isShellTransitionsEnabled)
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
/** {@inheritDoc} */
|
||||
@FlakyTest
|
||||
@Test
|
||||
override fun navBarLayerPositionAtStartAndEnd() =
|
||||
super.navBarLayerPositionAtStartAndEnd()
|
||||
override fun navBarLayerPositionAtStartAndEnd() = super.navBarLayerPositionAtStartAndEnd()
|
||||
}
|
||||
|
||||
@@ -40,24 +40,21 @@ abstract class PipTransition(testSpec: FlickerTestParameter) : BaseTest(testSpec
|
||||
}
|
||||
|
||||
fun doAction(broadcastAction: String) {
|
||||
instrumentation.context
|
||||
.sendBroadcast(createIntentWithAction(broadcastAction))
|
||||
instrumentation.context.sendBroadcast(createIntentWithAction(broadcastAction))
|
||||
}
|
||||
|
||||
companion object {
|
||||
// Corresponds to ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
|
||||
@JvmStatic
|
||||
val ORIENTATION_LANDSCAPE = 0
|
||||
@JvmStatic val ORIENTATION_LANDSCAPE = 0
|
||||
|
||||
// Corresponds to ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
|
||||
@JvmStatic
|
||||
val ORIENTATION_PORTRAIT = 1
|
||||
@JvmStatic val ORIENTATION_PORTRAIT = 1
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a configuration that handles basic setup and teardown of pip tests and that
|
||||
* launches the Pip app for test
|
||||
* Gets a configuration that handles basic setup and teardown of pip tests and that launches the
|
||||
* Pip app for test
|
||||
*
|
||||
* @param eachRun If the pip app should be launched in each run (otherwise only 1x per test)
|
||||
* @param stringExtras Arguments to pass to the PIP launch intent
|
||||
|
||||
@@ -24,9 +24,7 @@ import androidx.test.uiautomator.Until
|
||||
import com.android.server.wm.flicker.helpers.PipAppHelper
|
||||
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
|
||||
|
||||
/**
|
||||
* Helper class for PIP app on AndroidTV
|
||||
*/
|
||||
/** Helper class for PIP app on AndroidTV */
|
||||
open class PipAppHelperTv(instrumentation: Instrumentation) : PipAppHelper(instrumentation) {
|
||||
private val appSelector = By.pkg(`package`).depth(0)
|
||||
|
||||
@@ -61,17 +59,12 @@ open class PipAppHelperTv(instrumentation: Instrumentation) : PipAppHelper(instr
|
||||
uiDevice.closeTvPipWindow()
|
||||
}
|
||||
|
||||
/**
|
||||
* Taps the pip window and dismisses it by clicking on the X button.
|
||||
*/
|
||||
/** Taps the pip window and dismisses it by clicking on the X button. */
|
||||
override fun closePipWindow(wmHelper: WindowManagerStateHelper) {
|
||||
uiDevice.closeTvPipWindow()
|
||||
|
||||
// Wait for animation to complete.
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withPipGone()
|
||||
.withHomeActivityVisible()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withPipGone().withHomeActivityVisible().waitForAndVerify()
|
||||
}
|
||||
|
||||
fun waitUntilClosed(): Boolean {
|
||||
|
||||
@@ -24,10 +24,7 @@ import androidx.test.uiautomator.UiDevice
|
||||
import org.junit.Before
|
||||
import org.junit.runners.Parameterized
|
||||
|
||||
abstract class PipTestBase(
|
||||
protected val rotationName: String,
|
||||
protected val rotation: Int
|
||||
) {
|
||||
abstract class PipTestBase(protected val rotationName: String, protected val rotation: Int) {
|
||||
val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
val uiDevice = UiDevice.getInstance(instrumentation)
|
||||
val packageManager: PackageManager = instrumentation.context.packageManager
|
||||
|
||||
@@ -25,16 +25,11 @@ import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.junit.runners.Parameterized
|
||||
|
||||
/**
|
||||
* Test Pip Menu on TV.
|
||||
* To run this test: `atest WMShellFlickerTests:TvPipBasicTest`
|
||||
*/
|
||||
/** Test Pip Menu on TV. To run this test: `atest WMShellFlickerTests:TvPipBasicTest` */
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
class TvPipBasicTest(
|
||||
private val radioButtonId: String,
|
||||
private val pipWindowRatio: Rational?
|
||||
) : TvPipTestBase() {
|
||||
class TvPipBasicTest(private val radioButtonId: String, private val pipWindowRatio: Rational?) :
|
||||
TvPipTestBase() {
|
||||
|
||||
@Test
|
||||
fun enterPip_openMenu_pressBack_closePip() {
|
||||
@@ -45,8 +40,8 @@ class TvPipBasicTest(
|
||||
testApp.clickObject(radioButtonId)
|
||||
testApp.clickEnterPipButton(wmHelper)
|
||||
|
||||
val actualRatio: Float = testApp.ui?.visibleBounds?.ratio
|
||||
?: fail("Application UI not found")
|
||||
val actualRatio: Float =
|
||||
testApp.ui?.visibleBounds?.ratio ?: fail("Application UI not found")
|
||||
pipWindowRatio?.let { expectedRatio ->
|
||||
assertEquals("Wrong Pip window ratio", expectedRatio.toFloat(), actualRatio)
|
||||
}
|
||||
@@ -62,7 +57,8 @@ class TvPipBasicTest(
|
||||
// Make sure Pip Window ration remained the same after Pip menu was closed
|
||||
testApp.ui?.visibleBounds?.let { newBounds ->
|
||||
assertEquals("Pip window ratio has changed", actualRatio, newBounds.ratio)
|
||||
} ?: fail("Application UI not found")
|
||||
}
|
||||
?: fail("Application UI not found")
|
||||
|
||||
// Close Pip
|
||||
testApp.closePipWindow()
|
||||
@@ -77,10 +73,10 @@ class TvPipBasicTest(
|
||||
fun getParams(): Collection<Array<Any?>> {
|
||||
infix fun Int.to(denominator: Int) = Rational(this, denominator)
|
||||
return listOf(
|
||||
arrayOf("ratio_default", null),
|
||||
arrayOf("ratio_square", 1 to 1),
|
||||
arrayOf("ratio_wide", 2 to 1),
|
||||
arrayOf("ratio_tall", 1 to 2)
|
||||
arrayOf("ratio_default", null),
|
||||
arrayOf("ratio_square", 1 to 1),
|
||||
arrayOf("ratio_wide", 2 to 1),
|
||||
arrayOf("ratio_tall", 1 to 2)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,28 +27,26 @@ import org.junit.Assert.assertTrue
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
/**
|
||||
* Test Pip Menu on TV.
|
||||
* To run this test: `atest WMShellFlickerTests:TvPipMenuTests`
|
||||
*/
|
||||
/** Test Pip Menu on TV. To run this test: `atest WMShellFlickerTests:TvPipMenuTests` */
|
||||
@RequiresDevice
|
||||
class TvPipMenuTests : TvPipTestBase() {
|
||||
|
||||
private val systemUiResources =
|
||||
packageManager.getResourcesForApplication(SYSTEM_UI_PACKAGE_NAME)
|
||||
private val pipBoundsWhileInMenu: Rect = systemUiResources.run {
|
||||
val bounds = getString(getIdentifier("pip_menu_bounds", "string",
|
||||
SYSTEM_UI_PACKAGE_NAME))
|
||||
Rect.unflattenFromString(bounds) ?: error("Could not retrieve PiP menu bounds")
|
||||
}
|
||||
private val playButtonDescription = systemUiResources.run {
|
||||
getString(getIdentifier("pip_play", "string",
|
||||
SYSTEM_UI_PACKAGE_NAME))
|
||||
}
|
||||
private val pauseButtonDescription = systemUiResources.run {
|
||||
getString(getIdentifier("pip_pause", "string",
|
||||
SYSTEM_UI_PACKAGE_NAME))
|
||||
}
|
||||
packageManager.getResourcesForApplication(SYSTEM_UI_PACKAGE_NAME)
|
||||
private val pipBoundsWhileInMenu: Rect =
|
||||
systemUiResources.run {
|
||||
val bounds =
|
||||
getString(getIdentifier("pip_menu_bounds", "string", SYSTEM_UI_PACKAGE_NAME))
|
||||
Rect.unflattenFromString(bounds) ?: error("Could not retrieve PiP menu bounds")
|
||||
}
|
||||
private val playButtonDescription =
|
||||
systemUiResources.run {
|
||||
getString(getIdentifier("pip_play", "string", SYSTEM_UI_PACKAGE_NAME))
|
||||
}
|
||||
private val pauseButtonDescription =
|
||||
systemUiResources.run {
|
||||
getString(getIdentifier("pip_pause", "string", SYSTEM_UI_PACKAGE_NAME))
|
||||
}
|
||||
|
||||
@Before
|
||||
fun tvPipMenuTestsTestUp() {
|
||||
@@ -61,20 +59,29 @@ class TvPipMenuTests : TvPipTestBase() {
|
||||
enterPip_openMenu_assertShown()
|
||||
|
||||
// Make sure the PiP task is positioned where it should be.
|
||||
val activityBounds: Rect = testApp.ui?.visibleBounds
|
||||
?: error("Could not retrieve Pip Activity bounds")
|
||||
assertTrue("Pip Activity is positioned correctly while Pip menu is shown",
|
||||
pipBoundsWhileInMenu == activityBounds)
|
||||
val activityBounds: Rect =
|
||||
testApp.ui?.visibleBounds ?: error("Could not retrieve Pip Activity bounds")
|
||||
assertTrue(
|
||||
"Pip Activity is positioned correctly while Pip menu is shown",
|
||||
pipBoundsWhileInMenu == activityBounds
|
||||
)
|
||||
|
||||
// Make sure the Pip Menu Actions are positioned correctly.
|
||||
uiDevice.findTvPipMenuControls()?.visibleBounds?.run {
|
||||
assertTrue("Pip Menu Actions should be positioned below the Activity in Pip",
|
||||
top >= activityBounds.bottom)
|
||||
assertTrue("Pip Menu Actions should be positioned central horizontally",
|
||||
centerX() == uiDevice.displayWidth / 2)
|
||||
assertTrue("Pip Menu Actions should be fully shown on the screen",
|
||||
left >= 0 && right <= uiDevice.displayWidth && bottom <= uiDevice.displayHeight)
|
||||
} ?: error("Could not retrieve Pip Menu Actions bounds")
|
||||
assertTrue(
|
||||
"Pip Menu Actions should be positioned below the Activity in Pip",
|
||||
top >= activityBounds.bottom
|
||||
)
|
||||
assertTrue(
|
||||
"Pip Menu Actions should be positioned central horizontally",
|
||||
centerX() == uiDevice.displayWidth / 2
|
||||
)
|
||||
assertTrue(
|
||||
"Pip Menu Actions should be fully shown on the screen",
|
||||
left >= 0 && right <= uiDevice.displayWidth && bottom <= uiDevice.displayHeight
|
||||
)
|
||||
}
|
||||
?: error("Could not retrieve Pip Menu Actions bounds")
|
||||
|
||||
testApp.closePipWindow()
|
||||
}
|
||||
@@ -107,7 +114,7 @@ class TvPipMenuTests : TvPipTestBase() {
|
||||
|
||||
// PiP menu should contain the Close button
|
||||
uiDevice.findTvPipMenuCloseButton()
|
||||
?: fail("\"Close PIP\" button should be shown in Pip menu")
|
||||
?: fail("\"Close PIP\" button should be shown in Pip menu")
|
||||
|
||||
// Clicking on the Close button should close the app
|
||||
uiDevice.clickTvPipMenuCloseButton()
|
||||
@@ -120,13 +127,15 @@ class TvPipMenuTests : TvPipTestBase() {
|
||||
|
||||
// PiP menu should contain the Fullscreen button
|
||||
uiDevice.findTvPipMenuFullscreenButton()
|
||||
?: fail("\"Full screen\" button should be shown in Pip menu")
|
||||
?: fail("\"Full screen\" button should be shown in Pip menu")
|
||||
|
||||
// Clicking on the fullscreen button should return app to the fullscreen mode.
|
||||
// Click, wait for the app to go fullscreen
|
||||
uiDevice.clickTvPipMenuFullscreenButton()
|
||||
assertTrue("\"Full screen\" button should open the app fullscreen",
|
||||
wait { testApp.ui?.isFullscreen(uiDevice) ?: false })
|
||||
assertTrue(
|
||||
"\"Full screen\" button should open the app fullscreen",
|
||||
wait { testApp.ui?.isFullscreen(uiDevice) ?: false }
|
||||
)
|
||||
|
||||
// Close the app
|
||||
uiDevice.pressBack()
|
||||
@@ -143,8 +152,10 @@ class TvPipMenuTests : TvPipTestBase() {
|
||||
|
||||
// PiP menu should contain the Pause button
|
||||
uiDevice.findTvPipMenuElementWithDescription(pauseButtonDescription)
|
||||
?: fail("\"Pause\" button should be shown in Pip menu if there is an active " +
|
||||
"playing media session.")
|
||||
?: fail(
|
||||
"\"Pause\" button should be shown in Pip menu if there is an active " +
|
||||
"playing media session."
|
||||
)
|
||||
|
||||
// When we pause media, the button should change from Pause to Play
|
||||
uiDevice.clickTvPipMenuElementWithDescription(pauseButtonDescription)
|
||||
@@ -152,8 +163,10 @@ class TvPipMenuTests : TvPipTestBase() {
|
||||
assertFullscreenAndCloseButtonsAreShown()
|
||||
// PiP menu should contain the Play button now
|
||||
uiDevice.waitForTvPipMenuElementWithDescription(playButtonDescription)
|
||||
?: fail("\"Play\" button should be shown in Pip menu if there is an active " +
|
||||
"paused media session.")
|
||||
?: fail(
|
||||
"\"Play\" button should be shown in Pip menu if there is an active " +
|
||||
"paused media session."
|
||||
)
|
||||
|
||||
testApp.closePipWindow()
|
||||
}
|
||||
@@ -166,11 +179,11 @@ class TvPipMenuTests : TvPipTestBase() {
|
||||
|
||||
// PiP menu should contain "No-Op", "Off" and "Clear" buttons...
|
||||
uiDevice.findTvPipMenuElementWithDescription(ActivityOptions.Pip.MENU_ACTION_NO_OP)
|
||||
?: fail("\"No-Op\" button should be shown in Pip menu")
|
||||
?: fail("\"No-Op\" button should be shown in Pip menu")
|
||||
uiDevice.findTvPipMenuElementWithDescription(ActivityOptions.Pip.MENU_ACTION_OFF)
|
||||
?: fail("\"Off\" button should be shown in Pip menu")
|
||||
?: fail("\"Off\" button should be shown in Pip menu")
|
||||
uiDevice.findTvPipMenuElementWithDescription(ActivityOptions.Pip.MENU_ACTION_CLEAR)
|
||||
?: fail("\"Clear\" button should be shown in Pip menu")
|
||||
?: fail("\"Clear\" button should be shown in Pip menu")
|
||||
// ... and should also contain the "Full screen" and "Close" buttons.
|
||||
assertFullscreenAndCloseButtonsAreShown()
|
||||
|
||||
@@ -178,31 +191,34 @@ class TvPipMenuTests : TvPipTestBase() {
|
||||
// Invoking the "Off" action should replace it with the "On" action/button and should
|
||||
// remove the "No-Op" action/button. "Clear" action/button should remain in the menu ...
|
||||
uiDevice.waitForTvPipMenuElementWithDescription(ActivityOptions.Pip.MENU_ACTION_ON)
|
||||
?: fail("\"On\" button should be shown in Pip for a corresponding custom action")
|
||||
assertNull("\"No-Op\" button should not be shown in Pip menu",
|
||||
uiDevice.findTvPipMenuElementWithDescription(
|
||||
ActivityOptions.Pip.MENU_ACTION_NO_OP))
|
||||
?: fail("\"On\" button should be shown in Pip for a corresponding custom action")
|
||||
assertNull(
|
||||
"\"No-Op\" button should not be shown in Pip menu",
|
||||
uiDevice.findTvPipMenuElementWithDescription(ActivityOptions.Pip.MENU_ACTION_NO_OP)
|
||||
)
|
||||
uiDevice.findTvPipMenuElementWithDescription(ActivityOptions.Pip.MENU_ACTION_CLEAR)
|
||||
?: fail("\"Clear\" button should be shown in Pip menu")
|
||||
?: fail("\"Clear\" button should be shown in Pip menu")
|
||||
// ... as well as the "Full screen" and "Close" buttons.
|
||||
assertFullscreenAndCloseButtonsAreShown()
|
||||
|
||||
uiDevice.clickTvPipMenuElementWithDescription(ActivityOptions.Pip.MENU_ACTION_CLEAR)
|
||||
// Invoking the "Clear" action should remove all the custom actions and their corresponding
|
||||
// buttons, ...
|
||||
uiDevice.waitUntilTvPipMenuElementWithDescriptionIsGone(
|
||||
ActivityOptions.Pip.MENU_ACTION_ON)?.also {
|
||||
isGone -> if (!isGone) fail("\"On\" button should not be shown in Pip menu")
|
||||
}
|
||||
assertNull("\"Off\" button should not be shown in Pip menu",
|
||||
uiDevice.findTvPipMenuElementWithDescription(
|
||||
ActivityOptions.Pip.MENU_ACTION_OFF))
|
||||
assertNull("\"Clear\" button should not be shown in Pip menu",
|
||||
uiDevice.findTvPipMenuElementWithDescription(
|
||||
ActivityOptions.Pip.MENU_ACTION_CLEAR))
|
||||
assertNull("\"No-Op\" button should not be shown in Pip menu",
|
||||
uiDevice.findTvPipMenuElementWithDescription(
|
||||
ActivityOptions.Pip.MENU_ACTION_NO_OP))
|
||||
uiDevice
|
||||
.waitUntilTvPipMenuElementWithDescriptionIsGone(ActivityOptions.Pip.MENU_ACTION_ON)
|
||||
?.also { isGone -> if (!isGone) fail("\"On\" button should not be shown in Pip menu") }
|
||||
assertNull(
|
||||
"\"Off\" button should not be shown in Pip menu",
|
||||
uiDevice.findTvPipMenuElementWithDescription(ActivityOptions.Pip.MENU_ACTION_OFF)
|
||||
)
|
||||
assertNull(
|
||||
"\"Clear\" button should not be shown in Pip menu",
|
||||
uiDevice.findTvPipMenuElementWithDescription(ActivityOptions.Pip.MENU_ACTION_CLEAR)
|
||||
)
|
||||
assertNull(
|
||||
"\"No-Op\" button should not be shown in Pip menu",
|
||||
uiDevice.findTvPipMenuElementWithDescription(ActivityOptions.Pip.MENU_ACTION_NO_OP)
|
||||
)
|
||||
// ... but the menu should still contain the "Full screen" and "Close" buttons.
|
||||
assertFullscreenAndCloseButtonsAreShown()
|
||||
|
||||
@@ -218,25 +234,31 @@ class TvPipMenuTests : TvPipTestBase() {
|
||||
|
||||
// PiP menu should contain "No-Op", "Off" and "Clear" buttons for the custom actions...
|
||||
uiDevice.findTvPipMenuElementWithDescription(ActivityOptions.Pip.MENU_ACTION_NO_OP)
|
||||
?: fail("\"No-Op\" button should be shown in Pip menu")
|
||||
?: fail("\"No-Op\" button should be shown in Pip menu")
|
||||
uiDevice.findTvPipMenuElementWithDescription(ActivityOptions.Pip.MENU_ACTION_OFF)
|
||||
?: fail("\"Off\" button should be shown in Pip menu")
|
||||
?: fail("\"Off\" button should be shown in Pip menu")
|
||||
uiDevice.findTvPipMenuElementWithDescription(ActivityOptions.Pip.MENU_ACTION_CLEAR)
|
||||
?: fail("\"Clear\" button should be shown in Pip menu")
|
||||
?: fail("\"Clear\" button should be shown in Pip menu")
|
||||
// ... should also contain the "Full screen" and "Close" buttons, ...
|
||||
assertFullscreenAndCloseButtonsAreShown()
|
||||
// ... but should not contain media buttons.
|
||||
assertNull("\"Play\" button should not be shown in menu when there are custom actions",
|
||||
uiDevice.findTvPipMenuElementWithDescription(playButtonDescription))
|
||||
assertNull("\"Pause\" button should not be shown in menu when there are custom actions",
|
||||
uiDevice.findTvPipMenuElementWithDescription(pauseButtonDescription))
|
||||
assertNull(
|
||||
"\"Play\" button should not be shown in menu when there are custom actions",
|
||||
uiDevice.findTvPipMenuElementWithDescription(playButtonDescription)
|
||||
)
|
||||
assertNull(
|
||||
"\"Pause\" button should not be shown in menu when there are custom actions",
|
||||
uiDevice.findTvPipMenuElementWithDescription(pauseButtonDescription)
|
||||
)
|
||||
|
||||
uiDevice.clickTvPipMenuElementWithDescription(ActivityOptions.Pip.MENU_ACTION_CLEAR)
|
||||
// Invoking the "Clear" action should remove all the custom actions, which should bring up
|
||||
// media buttons...
|
||||
uiDevice.waitForTvPipMenuElementWithDescription(pauseButtonDescription)
|
||||
?: fail("\"Pause\" button should be shown in Pip menu if there is an active " +
|
||||
"playing media session.")
|
||||
?: fail(
|
||||
"\"Pause\" button should be shown in Pip menu if there is an active " +
|
||||
"playing media session."
|
||||
)
|
||||
// ... while the "Full screen" and "Close" buttons should remain in the menu.
|
||||
assertFullscreenAndCloseButtonsAreShown()
|
||||
|
||||
@@ -252,8 +274,8 @@ class TvPipMenuTests : TvPipTestBase() {
|
||||
|
||||
private fun assertFullscreenAndCloseButtonsAreShown() {
|
||||
uiDevice.findTvPipMenuCloseButton()
|
||||
?: fail("\"Close PIP\" button should be shown in Pip menu")
|
||||
?: fail("\"Close PIP\" button should be shown in Pip menu")
|
||||
uiDevice.findTvPipMenuFullscreenButton()
|
||||
?: fail("\"Full screen\" button should be shown in Pip menu")
|
||||
?: fail("\"Full screen\" button should be shown in Pip menu")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,8 +34,8 @@ import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
/**
|
||||
* Test Pip Notifications on TV.
|
||||
* To run this test: `atest WMShellFlickerTests:TvPipNotificationTests`
|
||||
* Test Pip Notifications on TV. To run this test: `atest
|
||||
* WMShellFlickerTests:TvPipNotificationTests`
|
||||
*/
|
||||
@RequiresDevice
|
||||
class TvPipNotificationTests : TvPipTestBase() {
|
||||
@@ -58,13 +58,17 @@ class TvPipNotificationTests : TvPipTestBase() {
|
||||
testApp.launchViaIntent()
|
||||
testApp.clickEnterPipButton(wmHelper)
|
||||
|
||||
assertNotNull("Pip notification should have been posted",
|
||||
waitForNotificationToAppear { it.isPipNotificationWithTitle(testApp.appName) })
|
||||
assertNotNull(
|
||||
"Pip notification should have been posted",
|
||||
waitForNotificationToAppear { it.isPipNotificationWithTitle(testApp.appName) }
|
||||
)
|
||||
|
||||
testApp.closePipWindow()
|
||||
|
||||
assertTrue("Pip notification should have been dismissed",
|
||||
waitForNotificationToDisappear { it.isPipNotificationWithTitle(testApp.appName) })
|
||||
assertTrue(
|
||||
"Pip notification should have been dismissed",
|
||||
waitForNotificationToDisappear { it.isPipNotificationWithTitle(testApp.appName) }
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -72,17 +76,20 @@ class TvPipNotificationTests : TvPipTestBase() {
|
||||
testApp.launchViaIntent()
|
||||
testApp.clickEnterPipButton(wmHelper)
|
||||
|
||||
val notification: StatusBarNotification = waitForNotificationToAppear {
|
||||
it.isPipNotificationWithTitle(testApp.appName)
|
||||
} ?: fail("Pip notification should have been posted")
|
||||
val notification: StatusBarNotification =
|
||||
waitForNotificationToAppear { it.isPipNotificationWithTitle(testApp.appName) }
|
||||
?: fail("Pip notification should have been posted")
|
||||
|
||||
notification.deleteIntent?.send()
|
||||
?: fail("Pip notification should contain `delete_intent`")
|
||||
notification.deleteIntent?.send() ?: fail("Pip notification should contain `delete_intent`")
|
||||
|
||||
assertTrue("Pip should have closed by sending the `delete_intent`",
|
||||
testApp.waitUntilClosed())
|
||||
assertTrue("Pip notification should have been dismissed",
|
||||
waitForNotificationToDisappear { it.isPipNotificationWithTitle(testApp.appName) })
|
||||
assertTrue(
|
||||
"Pip should have closed by sending the `delete_intent`",
|
||||
testApp.waitUntilClosed()
|
||||
)
|
||||
assertTrue(
|
||||
"Pip notification should have been dismissed",
|
||||
waitForNotificationToDisappear { it.isPipNotificationWithTitle(testApp.appName) }
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -90,15 +97,17 @@ class TvPipNotificationTests : TvPipTestBase() {
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
testApp.clickEnterPipButton(wmHelper)
|
||||
|
||||
val notification: StatusBarNotification = waitForNotificationToAppear {
|
||||
it.isPipNotificationWithTitle(testApp.appName)
|
||||
} ?: fail("Pip notification should have been posted")
|
||||
val notification: StatusBarNotification =
|
||||
waitForNotificationToAppear { it.isPipNotificationWithTitle(testApp.appName) }
|
||||
?: fail("Pip notification should have been posted")
|
||||
|
||||
notification.contentIntent?.send()
|
||||
?: fail("Pip notification should contain `content_intent`")
|
||||
|
||||
assertNotNull("Pip menu should have been shown after sending `content_intent`",
|
||||
uiDevice.waitForTvPipMenu())
|
||||
assertNotNull(
|
||||
"Pip menu should have been shown after sending `content_intent`",
|
||||
uiDevice.waitForTvPipMenu()
|
||||
)
|
||||
|
||||
uiDevice.pressBack()
|
||||
testApp.closePipWindow()
|
||||
@@ -112,35 +121,38 @@ class TvPipNotificationTests : TvPipTestBase() {
|
||||
testApp.clickEnterPipButton(wmHelper)
|
||||
|
||||
// Wait for the correct notification to show up...
|
||||
waitForNotificationToAppear {
|
||||
it.isPipNotificationWithTitle(TITLE_MEDIA_SESSION_PLAYING)
|
||||
} ?: fail("Pip notification with media session title should have been posted")
|
||||
waitForNotificationToAppear { it.isPipNotificationWithTitle(TITLE_MEDIA_SESSION_PLAYING) }
|
||||
?: fail("Pip notification with media session title should have been posted")
|
||||
// ... and make sure "regular" PiP notification is now shown
|
||||
assertNull("Regular notification should not have been posted",
|
||||
findNotification { it.isPipNotificationWithTitle(testApp.appName) })
|
||||
assertNull(
|
||||
"Regular notification should not have been posted",
|
||||
findNotification { it.isPipNotificationWithTitle(testApp.appName) }
|
||||
)
|
||||
|
||||
// Pause the media session. When paused the application updates the title for the media
|
||||
// session. This change should be reflected in the notification.
|
||||
testApp.pauseMedia()
|
||||
|
||||
// Wait for the "paused" notification to show up...
|
||||
waitForNotificationToAppear {
|
||||
it.isPipNotificationWithTitle(TITLE_MEDIA_SESSION_PAUSED)
|
||||
} ?: fail("Pip notification with media session title should have been posted")
|
||||
waitForNotificationToAppear { it.isPipNotificationWithTitle(TITLE_MEDIA_SESSION_PAUSED) }
|
||||
?: fail("Pip notification with media session title should have been posted")
|
||||
// ... and make sure "playing" PiP notification is gone
|
||||
assertNull("Regular notification should not have been posted",
|
||||
findNotification { it.isPipNotificationWithTitle(TITLE_MEDIA_SESSION_PLAYING) })
|
||||
assertNull(
|
||||
"Regular notification should not have been posted",
|
||||
findNotification { it.isPipNotificationWithTitle(TITLE_MEDIA_SESSION_PLAYING) }
|
||||
)
|
||||
|
||||
// Now stop the media session, which should revert the title to the "default" one.
|
||||
testApp.stopMedia()
|
||||
|
||||
// Wait for the "regular" notification to show up...
|
||||
waitForNotificationToAppear {
|
||||
it.isPipNotificationWithTitle(testApp.appName)
|
||||
} ?: fail("Pip notification with media session title should have been posted")
|
||||
waitForNotificationToAppear { it.isPipNotificationWithTitle(testApp.appName) }
|
||||
?: fail("Pip notification with media session title should have been posted")
|
||||
// ... and make sure previous ("paused") notification is gone
|
||||
assertNull("Regular notification should not have been posted",
|
||||
findNotification { it.isPipNotificationWithTitle(TITLE_MEDIA_SESSION_PAUSED) })
|
||||
assertNull(
|
||||
"Regular notification should not have been posted",
|
||||
findNotification { it.isPipNotificationWithTitle(TITLE_MEDIA_SESSION_PAUSED) }
|
||||
)
|
||||
|
||||
testApp.closePipWindow()
|
||||
}
|
||||
|
||||
@@ -68,7 +68,8 @@ abstract class TvPipTestBase : PipTestBase(rotationToString(ROTATION_0), ROTATIO
|
||||
fun start() {
|
||||
hasDied = false
|
||||
uiAutomation.adoptShellPermissionIdentity(
|
||||
android.Manifest.permission.SET_ACTIVITY_WATCHER)
|
||||
android.Manifest.permission.SET_ACTIVITY_WATCHER
|
||||
)
|
||||
activityManager.registerProcessObserver(this)
|
||||
}
|
||||
|
||||
|
||||
@@ -33,32 +33,31 @@ private const val TV_PIP_MENU_FULLSCREEN_BUTTON_ID = "tv_pip_menu_fullscreen_but
|
||||
private const val FOCUS_ATTEMPTS = 10
|
||||
private const val WAIT_TIME_MS = 3_000L
|
||||
|
||||
private val TV_PIP_MENU_SELECTOR =
|
||||
By.res(SYSTEM_UI_PACKAGE_NAME, TV_PIP_MENU_ROOT_ID)
|
||||
private val TV_PIP_MENU_SELECTOR = By.res(SYSTEM_UI_PACKAGE_NAME, TV_PIP_MENU_ROOT_ID)
|
||||
private val TV_PIP_MENU_BUTTONS_CONTAINER_SELECTOR =
|
||||
By.res(SYSTEM_UI_PACKAGE_NAME, TV_PIP_MENU_BUTTONS_CONTAINER_ID)
|
||||
By.res(SYSTEM_UI_PACKAGE_NAME, TV_PIP_MENU_BUTTONS_CONTAINER_ID)
|
||||
private val TV_PIP_MENU_CLOSE_BUTTON_SELECTOR =
|
||||
By.res(SYSTEM_UI_PACKAGE_NAME, TV_PIP_MENU_CLOSE_BUTTON_ID)
|
||||
By.res(SYSTEM_UI_PACKAGE_NAME, TV_PIP_MENU_CLOSE_BUTTON_ID)
|
||||
private val TV_PIP_MENU_FULLSCREEN_BUTTON_SELECTOR =
|
||||
By.res(SYSTEM_UI_PACKAGE_NAME, TV_PIP_MENU_FULLSCREEN_BUTTON_ID)
|
||||
By.res(SYSTEM_UI_PACKAGE_NAME, TV_PIP_MENU_FULLSCREEN_BUTTON_ID)
|
||||
|
||||
fun UiDevice.waitForTvPipMenu(): UiObject2? =
|
||||
wait(Until.findObject(TV_PIP_MENU_SELECTOR), WAIT_TIME_MS)
|
||||
wait(Until.findObject(TV_PIP_MENU_SELECTOR), WAIT_TIME_MS)
|
||||
|
||||
fun UiDevice.waitForTvPipMenuToClose(): Boolean =
|
||||
wait(Until.gone(TV_PIP_MENU_SELECTOR), WAIT_TIME_MS)
|
||||
wait(Until.gone(TV_PIP_MENU_SELECTOR), WAIT_TIME_MS)
|
||||
|
||||
fun UiDevice.findTvPipMenuControls(): UiObject2? =
|
||||
findTvPipMenuElement(TV_PIP_MENU_BUTTONS_CONTAINER_SELECTOR)
|
||||
findTvPipMenuElement(TV_PIP_MENU_BUTTONS_CONTAINER_SELECTOR)
|
||||
|
||||
fun UiDevice.findTvPipMenuCloseButton(): UiObject2? =
|
||||
findTvPipMenuElement(TV_PIP_MENU_CLOSE_BUTTON_SELECTOR)
|
||||
findTvPipMenuElement(TV_PIP_MENU_CLOSE_BUTTON_SELECTOR)
|
||||
|
||||
fun UiDevice.findTvPipMenuFullscreenButton(): UiObject2? =
|
||||
findTvPipMenuElement(TV_PIP_MENU_FULLSCREEN_BUTTON_SELECTOR)
|
||||
findTvPipMenuElement(TV_PIP_MENU_FULLSCREEN_BUTTON_SELECTOR)
|
||||
|
||||
fun UiDevice.findTvPipMenuElementWithDescription(desc: String): UiObject2? =
|
||||
findTvPipMenuElement(By.desc(desc))
|
||||
findTvPipMenuElement(By.desc(desc))
|
||||
|
||||
private fun UiDevice.findTvPipMenuElement(selector: BySelector): UiObject2? =
|
||||
findObject(TV_PIP_MENU_SELECTOR)?.findObject(selector)
|
||||
@@ -70,11 +69,10 @@ fun UiDevice.waitForTvPipMenuElementWithDescription(desc: String): UiObject2? {
|
||||
// descendant and then retrieve the element from the menu and return to the caller of this
|
||||
// method.
|
||||
val elementSelector = By.desc(desc)
|
||||
val menuContainingElementSelector = By.copy(TV_PIP_MENU_SELECTOR)
|
||||
.hasDescendant(elementSelector)
|
||||
val menuContainingElementSelector = By.copy(TV_PIP_MENU_SELECTOR).hasDescendant(elementSelector)
|
||||
|
||||
return wait(Until.findObject(menuContainingElementSelector), WAIT_TIME_MS)
|
||||
?.findObject(elementSelector)
|
||||
?.findObject(elementSelector)
|
||||
}
|
||||
|
||||
fun UiDevice.waitUntilTvPipMenuElementWithDescriptionIsGone(desc: String): Boolean? {
|
||||
@@ -86,18 +84,17 @@ fun UiDevice.waitUntilTvPipMenuElementWithDescriptionIsGone(desc: String): Boole
|
||||
|
||||
fun UiDevice.clickTvPipMenuCloseButton() {
|
||||
focusOnAndClickTvPipMenuElement(TV_PIP_MENU_CLOSE_BUTTON_SELECTOR) ||
|
||||
error("Could not focus on the Close button")
|
||||
error("Could not focus on the Close button")
|
||||
}
|
||||
|
||||
fun UiDevice.clickTvPipMenuFullscreenButton() {
|
||||
focusOnAndClickTvPipMenuElement(TV_PIP_MENU_FULLSCREEN_BUTTON_SELECTOR) ||
|
||||
error("Could not focus on the Fullscreen button")
|
||||
error("Could not focus on the Fullscreen button")
|
||||
}
|
||||
|
||||
fun UiDevice.clickTvPipMenuElementWithDescription(desc: String) {
|
||||
focusOnAndClickTvPipMenuElement(By.desc(desc)
|
||||
.pkg(SYSTEM_UI_PACKAGE_NAME)) ||
|
||||
error("Could not focus on the Pip menu object with \"$desc\" description")
|
||||
focusOnAndClickTvPipMenuElement(By.desc(desc).pkg(SYSTEM_UI_PACKAGE_NAME)) ||
|
||||
error("Could not focus on the Pip menu object with \"$desc\" description")
|
||||
// So apparently Accessibility framework on TV is not very reliable and sometimes the state of
|
||||
// the tree of accessibility nodes as seen by the accessibility clients kind of lags behind of
|
||||
// the "real" state of the "UI tree". It seems, however, that moving focus around the tree
|
||||
@@ -110,7 +107,8 @@ fun UiDevice.clickTvPipMenuElementWithDescription(desc: String) {
|
||||
|
||||
private fun UiDevice.focusOnAndClickTvPipMenuElement(selector: BySelector): Boolean {
|
||||
repeat(FOCUS_ATTEMPTS) {
|
||||
val element = findTvPipMenuElement(selector)
|
||||
val element =
|
||||
findTvPipMenuElement(selector)
|
||||
?: error("The Pip Menu element we try to focus on is gone.")
|
||||
|
||||
if (element.isFocusedOrHasFocusedChild) {
|
||||
@@ -119,10 +117,11 @@ private fun UiDevice.focusOnAndClickTvPipMenuElement(selector: BySelector): Bool
|
||||
}
|
||||
|
||||
findTvPipMenuElement(By.focused(true))?.let { focused ->
|
||||
if (element.visibleCenter.x < focused.visibleCenter.x)
|
||||
pressDPadLeft() else pressDPadRight()
|
||||
if (element.visibleCenter.x < focused.visibleCenter.x) pressDPadLeft()
|
||||
else pressDPadRight()
|
||||
waitForIdle()
|
||||
} ?: error("Pip menu does not contain a focused element")
|
||||
}
|
||||
?: error("Pip menu does not contain a focused element")
|
||||
}
|
||||
|
||||
return false
|
||||
@@ -155,9 +154,8 @@ private fun UiDevice.moveFocus() {
|
||||
|
||||
fun UiDevice.pressWindowKey() = pressKeyCode(KeyEvent.KEYCODE_WINDOW)
|
||||
|
||||
fun UiObject2.isFullscreen(uiDevice: UiDevice): Boolean = visibleBounds.run {
|
||||
height() == uiDevice.displayHeight && width() == uiDevice.displayWidth
|
||||
}
|
||||
fun UiObject2.isFullscreen(uiDevice: UiDevice): Boolean =
|
||||
visibleBounds.run { height() == uiDevice.displayHeight && width() == uiDevice.displayWidth }
|
||||
|
||||
val UiObject2.isFocusedOrHasFocusedChild: Boolean
|
||||
get() = isFocused || findObject(By.focused(true)) != null
|
||||
|
||||
@@ -54,12 +54,14 @@ class CopyContentInSplit(testSpec: FlickerTestParameter) : SplitScreenBase(testS
|
||||
override val transition: FlickerBuilder.() -> Unit
|
||||
get() = {
|
||||
super.transition(this)
|
||||
setup {
|
||||
SplitScreenUtils.enterSplit(wmHelper, tapl, primaryApp, textEditApp)
|
||||
}
|
||||
setup { SplitScreenUtils.enterSplit(wmHelper, tapl, primaryApp, textEditApp) }
|
||||
transitions {
|
||||
SplitScreenUtils.copyContentInSplit(
|
||||
instrumentation, device, primaryApp, textEditApp)
|
||||
instrumentation,
|
||||
device,
|
||||
primaryApp,
|
||||
textEditApp
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,55 +84,49 @@ class CopyContentInSplit(testSpec: FlickerTestParameter) : SplitScreenBase(testS
|
||||
@Test
|
||||
fun splitScreenDividerKeepVisible() = testSpec.layerKeepVisible(SPLIT_SCREEN_DIVIDER_COMPONENT)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun primaryAppLayerKeepVisible() = testSpec.layerKeepVisible(primaryApp)
|
||||
@Presubmit @Test fun primaryAppLayerKeepVisible() = testSpec.layerKeepVisible(primaryApp)
|
||||
|
||||
@Presubmit @Test fun textEditAppLayerKeepVisible() = testSpec.layerKeepVisible(textEditApp)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun textEditAppLayerKeepVisible() = testSpec.layerKeepVisible(textEditApp)
|
||||
fun primaryAppBoundsKeepVisible() =
|
||||
testSpec.splitAppLayerBoundsKeepVisible(
|
||||
primaryApp,
|
||||
landscapePosLeft = tapl.isTablet,
|
||||
portraitPosTop = false
|
||||
)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun primaryAppBoundsKeepVisible() = testSpec.splitAppLayerBoundsKeepVisible(
|
||||
primaryApp, landscapePosLeft = tapl.isTablet, portraitPosTop = false)
|
||||
fun textEditAppBoundsKeepVisible() =
|
||||
testSpec.splitAppLayerBoundsKeepVisible(
|
||||
textEditApp,
|
||||
landscapePosLeft = !tapl.isTablet,
|
||||
portraitPosTop = true
|
||||
)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun textEditAppBoundsKeepVisible() = testSpec.splitAppLayerBoundsKeepVisible(
|
||||
textEditApp, landscapePosLeft = !tapl.isTablet, portraitPosTop = true)
|
||||
@Presubmit @Test fun primaryAppWindowKeepVisible() = testSpec.appWindowKeepVisible(primaryApp)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun primaryAppWindowKeepVisible() = testSpec.appWindowKeepVisible(primaryApp)
|
||||
@Presubmit @Test fun textEditAppWindowKeepVisible() = testSpec.appWindowKeepVisible(textEditApp)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun textEditAppWindowKeepVisible() = testSpec.appWindowKeepVisible(textEditApp)
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit @Test override fun entireScreenCovered() = super.entireScreenCovered()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun entireScreenCovered() =
|
||||
super.entireScreenCovered()
|
||||
override fun navBarLayerIsVisibleAtStartAndEnd() = super.navBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun navBarLayerIsVisibleAtStartAndEnd() =
|
||||
super.navBarLayerIsVisibleAtStartAndEnd()
|
||||
override fun navBarLayerPositionAtStartAndEnd() = super.navBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun navBarLayerPositionAtStartAndEnd() =
|
||||
super.navBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun navBarWindowIsAlwaysVisible() =
|
||||
super.navBarWindowIsAlwaysVisible()
|
||||
override fun navBarWindowIsAlwaysVisible() = super.navBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@@ -141,26 +137,22 @@ class CopyContentInSplit(testSpec: FlickerTestParameter) : SplitScreenBase(testS
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun statusBarLayerPositionAtStartAndEnd() =
|
||||
super.statusBarLayerPositionAtStartAndEnd()
|
||||
override fun statusBarLayerPositionAtStartAndEnd() = super.statusBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun statusBarWindowIsAlwaysVisible() =
|
||||
super.statusBarWindowIsAlwaysVisible()
|
||||
override fun statusBarWindowIsAlwaysVisible() = super.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() =
|
||||
super.taskBarLayerIsVisibleAtStartAndEnd()
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() = super.taskBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun taskBarWindowIsAlwaysVisible() =
|
||||
super.taskBarWindowIsAlwaysVisible()
|
||||
override fun taskBarWindowIsAlwaysVisible() = super.taskBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@@ -178,10 +170,12 @@ class CopyContentInSplit(testSpec: FlickerTestParameter) : SplitScreenBase(testS
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): List<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests(
|
||||
// TODO(b/176061063):The 3 buttons of nav bar do not exist in the hierarchy.
|
||||
supportedNavigationModes =
|
||||
listOf(WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY))
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(
|
||||
// TODO(b/176061063):The 3 buttons of nav bar do not exist in the hierarchy.
|
||||
supportedNavigationModes =
|
||||
listOf(WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,15 +76,15 @@ internal object SplitScreenUtils {
|
||||
fun getSendNotification(instrumentation: Instrumentation): NotificationAppHelper =
|
||||
NotificationAppHelper(instrumentation)
|
||||
|
||||
fun getIme(instrumentation: Instrumentation): ImeAppHelper =
|
||||
ImeAppHelper(instrumentation)
|
||||
fun getIme(instrumentation: Instrumentation): ImeAppHelper = ImeAppHelper(instrumentation)
|
||||
|
||||
fun waitForSplitComplete(
|
||||
wmHelper: WindowManagerStateHelper,
|
||||
primaryApp: IComponentMatcher,
|
||||
secondaryApp: IComponentMatcher,
|
||||
) {
|
||||
wmHelper.StateSyncBuilder()
|
||||
wmHelper
|
||||
.StateSyncBuilder()
|
||||
.withWindowSurfaceAppeared(primaryApp)
|
||||
.withWindowSurfaceAppeared(secondaryApp)
|
||||
.withSplitDividerVisible()
|
||||
@@ -101,9 +101,7 @@ internal object SplitScreenUtils {
|
||||
primaryApp.launchViaIntent(wmHelper)
|
||||
secondaryApp.launchViaIntent(wmHelper)
|
||||
tapl.goHome()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withHomeActivityVisible()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withHomeActivityVisible().waitForAndVerify()
|
||||
splitFromOverview(tapl)
|
||||
waitForSplitComplete(wmHelper, primaryApp, secondaryApp)
|
||||
}
|
||||
@@ -113,12 +111,11 @@ internal object SplitScreenUtils {
|
||||
// In landscape, tablet will let the first app split to right side, and phone will
|
||||
// split to left side.
|
||||
if (tapl.isTablet) {
|
||||
tapl.workspace.switchToOverview().overviewActions
|
||||
.clickSplit()
|
||||
.currentTask
|
||||
.open()
|
||||
tapl.workspace.switchToOverview().overviewActions.clickSplit().currentTask.open()
|
||||
} else {
|
||||
tapl.workspace.switchToOverview().currentTask
|
||||
tapl.workspace
|
||||
.switchToOverview()
|
||||
.currentTask
|
||||
.tapMenu()
|
||||
.tapSplitMenuItem()
|
||||
.currentTask
|
||||
@@ -132,28 +129,33 @@ internal object SplitScreenUtils {
|
||||
device: UiDevice,
|
||||
wmHelper: WindowManagerStateHelper
|
||||
) {
|
||||
val displayBounds = wmHelper.currentState.layerState
|
||||
.displays.firstOrNull { !it.isVirtual }
|
||||
?.layerStackSpace
|
||||
?: error("Display not found")
|
||||
val displayBounds =
|
||||
wmHelper.currentState.layerState.displays.firstOrNull { !it.isVirtual }?.layerStackSpace
|
||||
?: error("Display not found")
|
||||
|
||||
// Pull down the notifications
|
||||
device.swipe(
|
||||
displayBounds.centerX(), 5,
|
||||
displayBounds.centerX(), displayBounds.bottom, 50 /* steps */
|
||||
displayBounds.centerX(),
|
||||
5,
|
||||
displayBounds.centerX(),
|
||||
displayBounds.bottom,
|
||||
50 /* steps */
|
||||
)
|
||||
SystemClock.sleep(TIMEOUT_MS)
|
||||
|
||||
// Find the target notification
|
||||
val notificationScroller = device.wait(
|
||||
Until.findObject(notificationScrollerSelector), TIMEOUT_MS
|
||||
) ?: error ("Unable to find view $notificationScrollerSelector")
|
||||
val notificationScroller =
|
||||
device.wait(Until.findObject(notificationScrollerSelector), TIMEOUT_MS)
|
||||
?: error("Unable to find view $notificationScrollerSelector")
|
||||
var notificationContent = notificationScroller.findObject(notificationContentSelector)
|
||||
|
||||
while (notificationContent == null) {
|
||||
device.swipe(
|
||||
displayBounds.centerX(), displayBounds.centerY(),
|
||||
displayBounds.centerX(), displayBounds.centerY() - 150, 20 /* steps */
|
||||
displayBounds.centerX(),
|
||||
displayBounds.centerY(),
|
||||
displayBounds.centerX(),
|
||||
displayBounds.centerY() - 150,
|
||||
20 /* steps */
|
||||
)
|
||||
notificationContent = notificationScroller.findObject(notificationContentSelector)
|
||||
}
|
||||
@@ -164,24 +166,33 @@ internal object SplitScreenUtils {
|
||||
val dragEnd = Point(displayBounds.width / 4, displayBounds.width / 4)
|
||||
val downTime = SystemClock.uptimeMillis()
|
||||
|
||||
touch(
|
||||
instrumentation, MotionEvent.ACTION_DOWN, downTime, downTime,
|
||||
TIMEOUT_MS, dragStart
|
||||
)
|
||||
touch(instrumentation, MotionEvent.ACTION_DOWN, downTime, downTime, TIMEOUT_MS, dragStart)
|
||||
// It needs a horizontal movement to trigger the drag
|
||||
touchMove(
|
||||
instrumentation, downTime, SystemClock.uptimeMillis(),
|
||||
DRAG_DURATION_MS, dragStart, dragMiddle
|
||||
instrumentation,
|
||||
downTime,
|
||||
SystemClock.uptimeMillis(),
|
||||
DRAG_DURATION_MS,
|
||||
dragStart,
|
||||
dragMiddle
|
||||
)
|
||||
touchMove(
|
||||
instrumentation, downTime, SystemClock.uptimeMillis(),
|
||||
DRAG_DURATION_MS, dragMiddle, dragEnd
|
||||
instrumentation,
|
||||
downTime,
|
||||
SystemClock.uptimeMillis(),
|
||||
DRAG_DURATION_MS,
|
||||
dragMiddle,
|
||||
dragEnd
|
||||
)
|
||||
// Wait for a while to start splitting
|
||||
SystemClock.sleep(TIMEOUT_MS)
|
||||
touch(
|
||||
instrumentation, MotionEvent.ACTION_UP, downTime, SystemClock.uptimeMillis(),
|
||||
GESTURE_STEP_MS, dragEnd
|
||||
instrumentation,
|
||||
MotionEvent.ACTION_UP,
|
||||
downTime,
|
||||
SystemClock.uptimeMillis(),
|
||||
GESTURE_STEP_MS,
|
||||
dragEnd
|
||||
)
|
||||
SystemClock.sleep(TIMEOUT_MS)
|
||||
}
|
||||
@@ -194,9 +205,8 @@ internal object SplitScreenUtils {
|
||||
duration: Long,
|
||||
point: Point
|
||||
) {
|
||||
val motionEvent = MotionEvent.obtain(
|
||||
downTime, eventTime, action, point.x.toFloat(), point.y.toFloat(), 0
|
||||
)
|
||||
val motionEvent =
|
||||
MotionEvent.obtain(downTime, eventTime, action, point.x.toFloat(), point.y.toFloat(), 0)
|
||||
motionEvent.source = InputDevice.SOURCE_TOUCHSCREEN
|
||||
instrumentation.uiAutomation.injectInputEvent(motionEvent, true)
|
||||
motionEvent.recycle()
|
||||
@@ -219,9 +229,15 @@ internal object SplitScreenUtils {
|
||||
val stepY = (to.y.toFloat() - from.y.toFloat()) / steps.toFloat()
|
||||
|
||||
for (i in 1..steps) {
|
||||
val motionMove = MotionEvent.obtain(
|
||||
downTime, currentTime, MotionEvent.ACTION_MOVE, currentX, currentY, 0
|
||||
)
|
||||
val motionMove =
|
||||
MotionEvent.obtain(
|
||||
downTime,
|
||||
currentTime,
|
||||
MotionEvent.ACTION_MOVE,
|
||||
currentX,
|
||||
currentY,
|
||||
0
|
||||
)
|
||||
motionMove.source = InputDevice.SOURCE_TOUCHSCREEN
|
||||
instrumentation.uiAutomation.injectInputEvent(motionMove, true)
|
||||
motionMove.recycle()
|
||||
@@ -238,20 +254,14 @@ internal object SplitScreenUtils {
|
||||
}
|
||||
}
|
||||
|
||||
fun longPress(
|
||||
instrumentation: Instrumentation,
|
||||
point: Point
|
||||
) {
|
||||
fun longPress(instrumentation: Instrumentation, point: Point) {
|
||||
val downTime = SystemClock.uptimeMillis()
|
||||
touch(instrumentation, MotionEvent.ACTION_DOWN, downTime, downTime, TIMEOUT_MS, point)
|
||||
SystemClock.sleep(LONG_PRESS_TIME_MS)
|
||||
touch(instrumentation, MotionEvent.ACTION_UP, downTime, downTime, TIMEOUT_MS, point)
|
||||
}
|
||||
|
||||
fun createShortcutOnHotseatIfNotExist(
|
||||
tapl: LauncherInstrumentation,
|
||||
appName: String
|
||||
) {
|
||||
fun createShortcutOnHotseatIfNotExist(tapl: LauncherInstrumentation, appName: String) {
|
||||
tapl.workspace.deleteAppIcon(tapl.workspace.getHotseatAppIcon(0))
|
||||
val allApps = tapl.workspace.switchToAllApps()
|
||||
allApps.freeze()
|
||||
@@ -262,18 +272,15 @@ internal object SplitScreenUtils {
|
||||
}
|
||||
}
|
||||
|
||||
fun dragDividerToResizeAndWait(
|
||||
device: UiDevice,
|
||||
wmHelper: WindowManagerStateHelper
|
||||
) {
|
||||
val displayBounds = wmHelper.currentState.layerState
|
||||
.displays.firstOrNull { !it.isVirtual }
|
||||
?.layerStackSpace
|
||||
?: error("Display not found")
|
||||
fun dragDividerToResizeAndWait(device: UiDevice, wmHelper: WindowManagerStateHelper) {
|
||||
val displayBounds =
|
||||
wmHelper.currentState.layerState.displays.firstOrNull { !it.isVirtual }?.layerStackSpace
|
||||
?: error("Display not found")
|
||||
val dividerBar = device.wait(Until.findObject(dividerBarSelector), TIMEOUT_MS)
|
||||
dividerBar.drag(Point(displayBounds.width * 1 / 3, displayBounds.height * 2 / 3))
|
||||
|
||||
wmHelper.StateSyncBuilder()
|
||||
wmHelper
|
||||
.StateSyncBuilder()
|
||||
.withWindowSurfaceDisappeared(SPLIT_DECOR_MANAGER)
|
||||
.waitForAndVerify()
|
||||
}
|
||||
@@ -284,28 +291,30 @@ internal object SplitScreenUtils {
|
||||
dragToRight: Boolean,
|
||||
dragToBottom: Boolean
|
||||
) {
|
||||
val displayBounds = wmHelper.currentState.layerState
|
||||
.displays.firstOrNull { !it.isVirtual }
|
||||
?.layerStackSpace
|
||||
?: error("Display not found")
|
||||
val displayBounds =
|
||||
wmHelper.currentState.layerState.displays.firstOrNull { !it.isVirtual }?.layerStackSpace
|
||||
?: error("Display not found")
|
||||
val dividerBar = device.wait(Until.findObject(dividerBarSelector), TIMEOUT_MS)
|
||||
dividerBar.drag(Point(
|
||||
if (dragToRight) {
|
||||
displayBounds.width * 4 / 5
|
||||
} else {
|
||||
displayBounds.width * 1 / 5
|
||||
},
|
||||
if (dragToBottom) {
|
||||
displayBounds.height * 4 / 5
|
||||
} else {
|
||||
displayBounds.height * 1 / 5
|
||||
}))
|
||||
dividerBar.drag(
|
||||
Point(
|
||||
if (dragToRight) {
|
||||
displayBounds.width * 4 / 5
|
||||
} else {
|
||||
displayBounds.width * 1 / 5
|
||||
},
|
||||
if (dragToBottom) {
|
||||
displayBounds.height * 4 / 5
|
||||
} else {
|
||||
displayBounds.height * 1 / 5
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
fun doubleTapDividerToSwitch(device: UiDevice) {
|
||||
val dividerBar = device.wait(Until.findObject(dividerBarSelector), TIMEOUT_MS)
|
||||
val interval = (ViewConfiguration.getDoubleTapTimeout() +
|
||||
ViewConfiguration.getDoubleTapMinTime()) / 2
|
||||
val interval =
|
||||
(ViewConfiguration.getDoubleTapTimeout() + ViewConfiguration.getDoubleTapMinTime()) / 2
|
||||
dividerBar.click()
|
||||
SystemClock.sleep(interval.toLong())
|
||||
dividerBar.click()
|
||||
@@ -318,16 +327,22 @@ internal object SplitScreenUtils {
|
||||
destinationApp: IComponentNameMatcher,
|
||||
) {
|
||||
// Copy text from sourceApp
|
||||
val textView = device.wait(Until.findObject(
|
||||
By.res(sourceApp.packageName, "SplitScreenTest")), TIMEOUT_MS)
|
||||
val textView =
|
||||
device.wait(
|
||||
Until.findObject(By.res(sourceApp.packageName, "SplitScreenTest")),
|
||||
TIMEOUT_MS
|
||||
)
|
||||
longPress(instrumentation, textView.visibleCenter)
|
||||
|
||||
val copyBtn = device.wait(Until.findObject(By.text("Copy")), TIMEOUT_MS)
|
||||
copyBtn.click()
|
||||
|
||||
// Paste text to destinationApp
|
||||
val editText = device.wait(Until.findObject(
|
||||
By.res(destinationApp.packageName, "plain_text_input")), TIMEOUT_MS)
|
||||
val editText =
|
||||
device.wait(
|
||||
Until.findObject(By.res(destinationApp.packageName, "plain_text_input")),
|
||||
TIMEOUT_MS
|
||||
)
|
||||
longPress(instrumentation, editText.visibleCenter)
|
||||
|
||||
val pasteBtn = device.wait(Until.findObject(By.text("Paste")), TIMEOUT_MS)
|
||||
|
||||
@@ -55,9 +55,7 @@ class SwitchBackToSplitFromAnotherApp(testSpec: FlickerTestParameter) : SplitScr
|
||||
SplitScreenUtils.enterSplit(wmHelper, tapl, primaryApp, secondaryApp)
|
||||
|
||||
thirdApp.launchViaIntent(wmHelper)
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withWindowSurfaceAppeared(thirdApp)
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withWindowSurfaceAppeared(thirdApp).waitForAndVerify()
|
||||
}
|
||||
transitions {
|
||||
tapl.launchedAppState.quickSwitchToPreviousApp()
|
||||
@@ -74,9 +72,7 @@ class SwitchBackToSplitFromAnotherApp(testSpec: FlickerTestParameter) : SplitScr
|
||||
@Test
|
||||
fun splitScreenDividerBecomesVisible() = testSpec.splitScreenDividerBecomesVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun primaryAppLayerBecomesVisible() = testSpec.layerBecomesVisible(primaryApp)
|
||||
@Presubmit @Test fun primaryAppLayerBecomesVisible() = testSpec.layerBecomesVisible(primaryApp)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
@@ -84,13 +80,21 @@ class SwitchBackToSplitFromAnotherApp(testSpec: FlickerTestParameter) : SplitScr
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun primaryAppBoundsIsVisibleAtEnd() = testSpec.splitAppLayerBoundsIsVisibleAtEnd(
|
||||
primaryApp, landscapePosLeft = tapl.isTablet, portraitPosTop = false)
|
||||
fun primaryAppBoundsIsVisibleAtEnd() =
|
||||
testSpec.splitAppLayerBoundsIsVisibleAtEnd(
|
||||
primaryApp,
|
||||
landscapePosLeft = tapl.isTablet,
|
||||
portraitPosTop = false
|
||||
)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun secondaryAppBoundsIsVisibleAtEnd() = testSpec.splitAppLayerBoundsIsVisibleAtEnd(
|
||||
secondaryApp, landscapePosLeft = !tapl.isTablet, portraitPosTop = true)
|
||||
fun secondaryAppBoundsIsVisibleAtEnd() =
|
||||
testSpec.splitAppLayerBoundsIsVisibleAtEnd(
|
||||
secondaryApp,
|
||||
landscapePosLeft = !tapl.isTablet,
|
||||
portraitPosTop = true
|
||||
)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
@@ -101,28 +105,22 @@ class SwitchBackToSplitFromAnotherApp(testSpec: FlickerTestParameter) : SplitScr
|
||||
fun secondaryAppWindowBecomesVisible() = testSpec.appWindowBecomesVisible(secondaryApp)
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun entireScreenCovered() =
|
||||
super.entireScreenCovered()
|
||||
@Postsubmit @Test override fun entireScreenCovered() = super.entireScreenCovered()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun navBarLayerIsVisibleAtStartAndEnd() =
|
||||
super.navBarLayerIsVisibleAtStartAndEnd()
|
||||
override fun navBarLayerIsVisibleAtStartAndEnd() = super.navBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun navBarLayerPositionAtStartAndEnd() =
|
||||
super.navBarLayerPositionAtStartAndEnd()
|
||||
override fun navBarLayerPositionAtStartAndEnd() = super.navBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun navBarWindowIsAlwaysVisible() =
|
||||
super.navBarWindowIsAlwaysVisible()
|
||||
override fun navBarWindowIsAlwaysVisible() = super.navBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@@ -133,26 +131,22 @@ class SwitchBackToSplitFromAnotherApp(testSpec: FlickerTestParameter) : SplitScr
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun statusBarLayerPositionAtStartAndEnd() =
|
||||
super.statusBarLayerPositionAtStartAndEnd()
|
||||
override fun statusBarLayerPositionAtStartAndEnd() = super.statusBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun statusBarWindowIsAlwaysVisible() =
|
||||
super.statusBarWindowIsAlwaysVisible()
|
||||
override fun statusBarWindowIsAlwaysVisible() = super.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() =
|
||||
super.taskBarLayerIsVisibleAtStartAndEnd()
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() = super.taskBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun taskBarWindowIsAlwaysVisible() =
|
||||
super.taskBarWindowIsAlwaysVisible()
|
||||
override fun taskBarWindowIsAlwaysVisible() = super.taskBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@@ -170,10 +164,12 @@ class SwitchBackToSplitFromAnotherApp(testSpec: FlickerTestParameter) : SplitScr
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): List<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests(
|
||||
// TODO(b/176061063):The 3 buttons of nav bar do not exist in the hierarchy.
|
||||
supportedNavigationModes =
|
||||
listOf(WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY))
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(
|
||||
// TODO(b/176061063):The 3 buttons of nav bar do not exist in the hierarchy.
|
||||
supportedNavigationModes =
|
||||
listOf(WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,9 +54,7 @@ class SwitchBackToSplitFromHome(testSpec: FlickerTestParameter) : SplitScreenBas
|
||||
SplitScreenUtils.enterSplit(wmHelper, tapl, primaryApp, secondaryApp)
|
||||
|
||||
tapl.goHome()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withHomeActivityVisible()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withHomeActivityVisible().waitForAndVerify()
|
||||
}
|
||||
transitions {
|
||||
tapl.workspace.quickSwitchToPreviousApp()
|
||||
@@ -73,9 +71,7 @@ class SwitchBackToSplitFromHome(testSpec: FlickerTestParameter) : SplitScreenBas
|
||||
@Test
|
||||
fun splitScreenDividerBecomesVisible() = testSpec.splitScreenDividerBecomesVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun primaryAppLayerBecomesVisible() = testSpec.layerBecomesVisible(primaryApp)
|
||||
@Presubmit @Test fun primaryAppLayerBecomesVisible() = testSpec.layerBecomesVisible(primaryApp)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
@@ -83,13 +79,21 @@ class SwitchBackToSplitFromHome(testSpec: FlickerTestParameter) : SplitScreenBas
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun primaryAppBoundsIsVisibleAtEnd() = testSpec.splitAppLayerBoundsIsVisibleAtEnd(
|
||||
primaryApp, landscapePosLeft = tapl.isTablet, portraitPosTop = false)
|
||||
fun primaryAppBoundsIsVisibleAtEnd() =
|
||||
testSpec.splitAppLayerBoundsIsVisibleAtEnd(
|
||||
primaryApp,
|
||||
landscapePosLeft = tapl.isTablet,
|
||||
portraitPosTop = false
|
||||
)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun secondaryAppBoundsIsVisibleAtEnd() = testSpec.splitAppLayerBoundsIsVisibleAtEnd(
|
||||
secondaryApp, landscapePosLeft = !tapl.isTablet, portraitPosTop = true)
|
||||
fun secondaryAppBoundsIsVisibleAtEnd() =
|
||||
testSpec.splitAppLayerBoundsIsVisibleAtEnd(
|
||||
secondaryApp,
|
||||
landscapePosLeft = !tapl.isTablet,
|
||||
portraitPosTop = true
|
||||
)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
@@ -100,28 +104,22 @@ class SwitchBackToSplitFromHome(testSpec: FlickerTestParameter) : SplitScreenBas
|
||||
fun secondaryAppWindowBecomesVisible() = testSpec.appWindowBecomesVisible(secondaryApp)
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun entireScreenCovered() =
|
||||
super.entireScreenCovered()
|
||||
@Postsubmit @Test override fun entireScreenCovered() = super.entireScreenCovered()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun navBarLayerIsVisibleAtStartAndEnd() =
|
||||
super.navBarLayerIsVisibleAtStartAndEnd()
|
||||
override fun navBarLayerIsVisibleAtStartAndEnd() = super.navBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun navBarLayerPositionAtStartAndEnd() =
|
||||
super.navBarLayerPositionAtStartAndEnd()
|
||||
override fun navBarLayerPositionAtStartAndEnd() = super.navBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun navBarWindowIsAlwaysVisible() =
|
||||
super.navBarWindowIsAlwaysVisible()
|
||||
override fun navBarWindowIsAlwaysVisible() = super.navBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@@ -132,26 +130,22 @@ class SwitchBackToSplitFromHome(testSpec: FlickerTestParameter) : SplitScreenBas
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun statusBarLayerPositionAtStartAndEnd() =
|
||||
super.statusBarLayerPositionAtStartAndEnd()
|
||||
override fun statusBarLayerPositionAtStartAndEnd() = super.statusBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun statusBarWindowIsAlwaysVisible() =
|
||||
super.statusBarWindowIsAlwaysVisible()
|
||||
override fun statusBarWindowIsAlwaysVisible() = super.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() =
|
||||
super.taskBarLayerIsVisibleAtStartAndEnd()
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() = super.taskBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun taskBarWindowIsAlwaysVisible() =
|
||||
super.taskBarWindowIsAlwaysVisible()
|
||||
override fun taskBarWindowIsAlwaysVisible() = super.taskBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@@ -169,10 +163,12 @@ class SwitchBackToSplitFromHome(testSpec: FlickerTestParameter) : SplitScreenBas
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): List<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests(
|
||||
// TODO(b/176061063):The 3 buttons of nav bar do not exist in the hierarchy.
|
||||
supportedNavigationModes =
|
||||
listOf(WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY))
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(
|
||||
// TODO(b/176061063):The 3 buttons of nav bar do not exist in the hierarchy.
|
||||
supportedNavigationModes =
|
||||
listOf(WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,14 +54,10 @@ class SwitchBackToSplitFromRecent(testSpec: FlickerTestParameter) : SplitScreenB
|
||||
SplitScreenUtils.enterSplit(wmHelper, tapl, primaryApp, secondaryApp)
|
||||
|
||||
tapl.goHome()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withHomeActivityVisible()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withHomeActivityVisible().waitForAndVerify()
|
||||
}
|
||||
transitions {
|
||||
tapl.workspace.switchToOverview()
|
||||
.currentTask
|
||||
.open()
|
||||
tapl.workspace.switchToOverview().currentTask.open()
|
||||
SplitScreenUtils.waitForSplitComplete(wmHelper, primaryApp, secondaryApp)
|
||||
}
|
||||
}
|
||||
@@ -75,9 +71,7 @@ class SwitchBackToSplitFromRecent(testSpec: FlickerTestParameter) : SplitScreenB
|
||||
@Test
|
||||
fun splitScreenDividerBecomesVisible() = testSpec.splitScreenDividerBecomesVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun primaryAppLayerBecomesVisible() = testSpec.layerBecomesVisible(primaryApp)
|
||||
@Presubmit @Test fun primaryAppLayerBecomesVisible() = testSpec.layerBecomesVisible(primaryApp)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
@@ -85,13 +79,21 @@ class SwitchBackToSplitFromRecent(testSpec: FlickerTestParameter) : SplitScreenB
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun primaryAppBoundsIsVisibleAtEnd() = testSpec.splitAppLayerBoundsIsVisibleAtEnd(
|
||||
primaryApp, landscapePosLeft = tapl.isTablet, portraitPosTop = false)
|
||||
fun primaryAppBoundsIsVisibleAtEnd() =
|
||||
testSpec.splitAppLayerBoundsIsVisibleAtEnd(
|
||||
primaryApp,
|
||||
landscapePosLeft = tapl.isTablet,
|
||||
portraitPosTop = false
|
||||
)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun secondaryAppBoundsIsVisibleAtEnd() = testSpec.splitAppLayerBoundsIsVisibleAtEnd(
|
||||
secondaryApp, landscapePosLeft = !tapl.isTablet, portraitPosTop = true)
|
||||
fun secondaryAppBoundsIsVisibleAtEnd() =
|
||||
testSpec.splitAppLayerBoundsIsVisibleAtEnd(
|
||||
secondaryApp,
|
||||
landscapePosLeft = !tapl.isTablet,
|
||||
portraitPosTop = true
|
||||
)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
@@ -102,28 +104,22 @@ class SwitchBackToSplitFromRecent(testSpec: FlickerTestParameter) : SplitScreenB
|
||||
fun secondaryAppWindowBecomesVisible() = testSpec.appWindowBecomesVisible(secondaryApp)
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun entireScreenCovered() =
|
||||
super.entireScreenCovered()
|
||||
@Postsubmit @Test override fun entireScreenCovered() = super.entireScreenCovered()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun navBarLayerIsVisibleAtStartAndEnd() =
|
||||
super.navBarLayerIsVisibleAtStartAndEnd()
|
||||
override fun navBarLayerIsVisibleAtStartAndEnd() = super.navBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun navBarLayerPositionAtStartAndEnd() =
|
||||
super.navBarLayerPositionAtStartAndEnd()
|
||||
override fun navBarLayerPositionAtStartAndEnd() = super.navBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun navBarWindowIsAlwaysVisible() =
|
||||
super.navBarWindowIsAlwaysVisible()
|
||||
override fun navBarWindowIsAlwaysVisible() = super.navBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@@ -134,26 +130,22 @@ class SwitchBackToSplitFromRecent(testSpec: FlickerTestParameter) : SplitScreenB
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun statusBarLayerPositionAtStartAndEnd() =
|
||||
super.statusBarLayerPositionAtStartAndEnd()
|
||||
override fun statusBarLayerPositionAtStartAndEnd() = super.statusBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun statusBarWindowIsAlwaysVisible() =
|
||||
super.statusBarWindowIsAlwaysVisible()
|
||||
override fun statusBarWindowIsAlwaysVisible() = super.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() =
|
||||
super.taskBarLayerIsVisibleAtStartAndEnd()
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() = super.taskBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun taskBarWindowIsAlwaysVisible() =
|
||||
super.taskBarWindowIsAlwaysVisible()
|
||||
override fun taskBarWindowIsAlwaysVisible() = super.taskBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@@ -171,10 +163,12 @@ class SwitchBackToSplitFromRecent(testSpec: FlickerTestParameter) : SplitScreenB
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): List<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests(
|
||||
// TODO(b/176061063):The 3 buttons of nav bar do not exist in the hierarchy.
|
||||
supportedNavigationModes =
|
||||
listOf(WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY))
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(
|
||||
// TODO(b/176061063):The 3 buttons of nav bar do not exist in the hierarchy.
|
||||
supportedNavigationModes =
|
||||
listOf(WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,46 +31,40 @@ import org.junit.Test
|
||||
* [ComponentNameMatcher.TASK_BAR], [ComponentNameMatcher.STATUS_BAR], and general assertions
|
||||
* (layers visible in consecutive states, entire screen covered, etc.)
|
||||
*/
|
||||
abstract class BaseTest @JvmOverloads constructor(
|
||||
abstract class BaseTest
|
||||
@JvmOverloads
|
||||
constructor(
|
||||
protected val testSpec: FlickerTestParameter,
|
||||
protected val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation(),
|
||||
protected val tapl: LauncherInstrumentation = LauncherInstrumentation()
|
||||
) {
|
||||
init {
|
||||
testSpec.setIsTablet(
|
||||
WindowManagerStateHelper(
|
||||
instrumentation,
|
||||
clearCacheAfterParsing = false
|
||||
).currentState.wmState.isTablet
|
||||
WindowManagerStateHelper(instrumentation, clearCacheAfterParsing = false)
|
||||
.currentState
|
||||
.wmState
|
||||
.isTablet
|
||||
)
|
||||
tapl.setExpectedRotationCheckEnabled(true)
|
||||
}
|
||||
|
||||
/**
|
||||
* Specification of the test transition to execute
|
||||
*/
|
||||
/** Specification of the test transition to execute */
|
||||
abstract val transition: FlickerBuilder.() -> Unit
|
||||
|
||||
/**
|
||||
* Entry point for the test runner. It will use this method to initialize and cache
|
||||
* flicker executions
|
||||
* 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 {
|
||||
setup {
|
||||
testSpec.setIsTablet(wmHelper.currentState.wmState.isTablet)
|
||||
}
|
||||
setup { testSpec.setIsTablet(wmHelper.currentState.wmState.isTablet) }
|
||||
transition()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that all parts of the screen are covered during the transition
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun entireScreenCovered() = testSpec.entireScreenCovered()
|
||||
/** Checks that all parts of the screen are covered during the transition */
|
||||
@Presubmit @Test open fun entireScreenCovered() = testSpec.entireScreenCovered()
|
||||
|
||||
/**
|
||||
* Checks that the [ComponentNameMatcher.NAV_BAR] layer is visible during the whole transition
|
||||
@@ -110,8 +104,8 @@ abstract class BaseTest @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the [ComponentNameMatcher.TASK_BAR] window is visible at the start and end of
|
||||
* the transition
|
||||
* Checks that the [ComponentNameMatcher.TASK_BAR] window is visible at the start and end of the
|
||||
* transition
|
||||
*
|
||||
* Note: Large screen only
|
||||
*/
|
||||
@@ -123,8 +117,7 @@ abstract class BaseTest @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the [ComponentNameMatcher.TASK_BAR] window is visible during the whole
|
||||
* transition
|
||||
* Checks that the [ComponentNameMatcher.TASK_BAR] window is visible during the whole transition
|
||||
*
|
||||
* Note: Large screen only
|
||||
*/
|
||||
@@ -136,8 +129,8 @@ abstract class BaseTest @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the [ComponentNameMatcher.STATUS_BAR] layer is visible at the start and end
|
||||
* of the transition
|
||||
* Checks that the [ComponentNameMatcher.STATUS_BAR] layer is visible at the start and end of
|
||||
* the transition
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
@@ -161,26 +154,22 @@ abstract class BaseTest @JvmOverloads constructor(
|
||||
open fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
/**
|
||||
* Checks that all layers that are visible on the trace, are visible for at least 2
|
||||
* consecutive entries.
|
||||
* Checks that all layers that are visible on the trace, are visible for at least 2 consecutive
|
||||
* entries.
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun visibleLayersShownMoreThanOneConsecutiveEntry() {
|
||||
testSpec.assertLayers {
|
||||
this.visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
}
|
||||
testSpec.assertLayers { this.visibleLayersShownMoreThanOneConsecutiveEntry() }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that all windows that are visible on the trace, are visible for at least 2
|
||||
* consecutive entries.
|
||||
* 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()
|
||||
}
|
||||
testSpec.assertWm { this.visibleWindowsShownMoreThanOneConsecutiveEntry() }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
@file:JvmName("CommonAssertions")
|
||||
|
||||
package com.android.server.wm.flicker
|
||||
|
||||
import com.android.server.wm.flicker.helpers.WindowUtils
|
||||
@@ -23,28 +24,24 @@ import com.android.server.wm.traces.common.ComponentNameMatcher
|
||||
import com.android.server.wm.traces.common.IComponentNameMatcher
|
||||
|
||||
/**
|
||||
* Checks that [ComponentNameMatcher.STATUS_BAR] window is visible and above the app windows in
|
||||
* all WM trace entries
|
||||
* Checks that [ComponentNameMatcher.STATUS_BAR] window is visible and above the app windows in all
|
||||
* WM trace entries
|
||||
*/
|
||||
fun FlickerTestParameter.statusBarWindowIsAlwaysVisible() {
|
||||
assertWm {
|
||||
this.isAboveAppWindowVisible(ComponentNameMatcher.STATUS_BAR)
|
||||
}
|
||||
assertWm { this.isAboveAppWindowVisible(ComponentNameMatcher.STATUS_BAR) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [ComponentNameMatcher.NAV_BAR] window is visible and above the app windows in
|
||||
* all WM trace entries
|
||||
* Checks that [ComponentNameMatcher.NAV_BAR] window is visible and above the app windows in all WM
|
||||
* trace entries
|
||||
*/
|
||||
fun FlickerTestParameter.navBarWindowIsAlwaysVisible() {
|
||||
assertWm {
|
||||
this.isAboveAppWindowVisible(ComponentNameMatcher.NAV_BAR)
|
||||
}
|
||||
assertWm { this.isAboveAppWindowVisible(ComponentNameMatcher.NAV_BAR) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [ComponentNameMatcher.NAV_BAR] window is visible and above the app windows at the start
|
||||
* and end of the WM trace
|
||||
* Checks that [ComponentNameMatcher.NAV_BAR] window is visible and above the app windows at the
|
||||
* start and end of the WM trace
|
||||
*/
|
||||
fun FlickerTestParameter.navBarWindowIsVisibleAtStartAndEnd() {
|
||||
this.navBarWindowIsVisibleAtStart()
|
||||
@@ -52,51 +49,43 @@ fun FlickerTestParameter.navBarWindowIsVisibleAtStartAndEnd() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [ComponentNameMatcher.NAV_BAR] window is visible and above the app windows at the start
|
||||
* of the WM trace
|
||||
* Checks that [ComponentNameMatcher.NAV_BAR] window is visible and above the app windows at the
|
||||
* start of the WM trace
|
||||
*/
|
||||
fun FlickerTestParameter.navBarWindowIsVisibleAtStart() {
|
||||
assertWmStart {
|
||||
this.isAboveAppWindowVisible(ComponentNameMatcher.NAV_BAR)
|
||||
}
|
||||
assertWmStart { this.isAboveAppWindowVisible(ComponentNameMatcher.NAV_BAR) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [ComponentNameMatcher.NAV_BAR] window is visible and above the app windows at the
|
||||
* end of the WM trace
|
||||
* Checks that [ComponentNameMatcher.NAV_BAR] window is visible and above the app windows at the end
|
||||
* of the WM trace
|
||||
*/
|
||||
fun FlickerTestParameter.navBarWindowIsVisibleAtEnd() {
|
||||
assertWmEnd {
|
||||
this.isAboveAppWindowVisible(ComponentNameMatcher.NAV_BAR)
|
||||
}
|
||||
assertWmEnd { this.isAboveAppWindowVisible(ComponentNameMatcher.NAV_BAR) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [ComponentNameMatcher.TASK_BAR] window is visible and above the app windows in
|
||||
* all WM trace entries
|
||||
* Checks that [ComponentNameMatcher.TASK_BAR] window is visible and above the app windows in all WM
|
||||
* trace entries
|
||||
*/
|
||||
fun FlickerTestParameter.taskBarWindowIsAlwaysVisible() {
|
||||
assertWm {
|
||||
this.isAboveAppWindowVisible(ComponentNameMatcher.TASK_BAR)
|
||||
}
|
||||
assertWm { this.isAboveAppWindowVisible(ComponentNameMatcher.TASK_BAR) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [ComponentNameMatcher.TASK_BAR] window is visible and above the app windows in
|
||||
* all WM trace entries
|
||||
* Checks that [ComponentNameMatcher.TASK_BAR] window is visible and above the app windows in all WM
|
||||
* trace entries
|
||||
*/
|
||||
fun FlickerTestParameter.taskBarWindowIsVisibleAtEnd() {
|
||||
assertWmEnd {
|
||||
this.isAboveAppWindowVisible(ComponentNameMatcher.TASK_BAR)
|
||||
}
|
||||
assertWmEnd { this.isAboveAppWindowVisible(ComponentNameMatcher.TASK_BAR) }
|
||||
}
|
||||
|
||||
/**
|
||||
* If [allStates] is true, checks if the stack space of all displays is fully covered
|
||||
* by any visible layer, during the whole transitions
|
||||
* If [allStates] is true, checks if the stack space of all displays is fully covered by any visible
|
||||
* layer, during the whole transitions
|
||||
*
|
||||
* Otherwise, checks if the stack space of all displays is fully covered
|
||||
* by any visible layer, at the start and end of the transition
|
||||
* Otherwise, checks if the stack space of all displays is fully covered by any visible layer, at
|
||||
* the start and end of the transition
|
||||
*
|
||||
* @param allStates if all states should be checked, othersie, just initial and final
|
||||
*/
|
||||
@@ -124,27 +113,18 @@ fun FlickerTestParameter.entireScreenCovered(allStates: Boolean = true) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [ComponentNameMatcher.NAV_BAR] layer is visible at the start of the SF trace
|
||||
*/
|
||||
/** Checks that [ComponentNameMatcher.NAV_BAR] layer is visible at the start of the SF trace */
|
||||
fun FlickerTestParameter.navBarLayerIsVisibleAtStart() {
|
||||
assertLayersStart {
|
||||
this.isVisible(ComponentNameMatcher.NAV_BAR)
|
||||
}
|
||||
assertLayersStart { this.isVisible(ComponentNameMatcher.NAV_BAR) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [ComponentNameMatcher.NAV_BAR] layer is visible at the end of the SF trace
|
||||
*/
|
||||
/** Checks that [ComponentNameMatcher.NAV_BAR] layer is visible at the end of the SF trace */
|
||||
fun FlickerTestParameter.navBarLayerIsVisibleAtEnd() {
|
||||
assertLayersEnd {
|
||||
this.isVisible(ComponentNameMatcher.NAV_BAR)
|
||||
}
|
||||
assertLayersEnd { this.isVisible(ComponentNameMatcher.NAV_BAR) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [ComponentNameMatcher.NAV_BAR] layer is visible at the start and end of the SF
|
||||
* trace
|
||||
* Checks that [ComponentNameMatcher.NAV_BAR] layer is visible at the start and end of the SF trace
|
||||
*/
|
||||
fun FlickerTestParameter.navBarLayerIsVisibleAtStartAndEnd() {
|
||||
this.navBarLayerIsVisibleAtStart()
|
||||
@@ -152,32 +132,21 @@ fun FlickerTestParameter.navBarLayerIsVisibleAtStartAndEnd() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [ComponentNameMatcher.TASK_BAR] layer is visible at the start and end of the SF
|
||||
* trace
|
||||
* Checks that [ComponentNameMatcher.TASK_BAR] layer is visible at the start and end of the SF trace
|
||||
*/
|
||||
fun FlickerTestParameter.taskBarLayerIsVisibleAtStartAndEnd() {
|
||||
this.taskBarLayerIsVisibleAtStart()
|
||||
this.taskBarLayerIsVisibleAtEnd()
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [ComponentNameMatcher.TASK_BAR] layer is visible at the start of the SF
|
||||
* trace
|
||||
*/
|
||||
/** Checks that [ComponentNameMatcher.TASK_BAR] layer is visible at the start of the SF trace */
|
||||
fun FlickerTestParameter.taskBarLayerIsVisibleAtStart() {
|
||||
assertLayersStart {
|
||||
this.isVisible(ComponentNameMatcher.TASK_BAR)
|
||||
}
|
||||
assertLayersStart { this.isVisible(ComponentNameMatcher.TASK_BAR) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [ComponentNameMatcher.TASK_BAR] layer is visible at the end of the SF
|
||||
* trace
|
||||
*/
|
||||
/** Checks that [ComponentNameMatcher.TASK_BAR] layer is visible at the end of the SF trace */
|
||||
fun FlickerTestParameter.taskBarLayerIsVisibleAtEnd() {
|
||||
assertLayersEnd {
|
||||
this.isVisible(ComponentNameMatcher.TASK_BAR)
|
||||
}
|
||||
assertLayersEnd { this.isVisible(ComponentNameMatcher.TASK_BAR) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -185,43 +154,40 @@ fun FlickerTestParameter.taskBarLayerIsVisibleAtEnd() {
|
||||
* trace
|
||||
*/
|
||||
fun FlickerTestParameter.statusBarLayerIsVisibleAtStartAndEnd() {
|
||||
assertLayersStart {
|
||||
this.isVisible(ComponentNameMatcher.STATUS_BAR)
|
||||
}
|
||||
assertLayersEnd {
|
||||
this.isVisible(ComponentNameMatcher.STATUS_BAR)
|
||||
}
|
||||
assertLayersStart { this.isVisible(ComponentNameMatcher.STATUS_BAR) }
|
||||
assertLayersEnd { this.isVisible(ComponentNameMatcher.STATUS_BAR) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the [ComponentNameMatcher.NAV_BAR] layer is at the correct position at the start
|
||||
* of the SF trace
|
||||
* Asserts that the [ComponentNameMatcher.NAV_BAR] layer is at the correct position at the start of
|
||||
* the SF trace
|
||||
*/
|
||||
fun FlickerTestParameter.navBarLayerPositionAtStart() {
|
||||
assertLayersStart {
|
||||
val display = this.entry.displays.firstOrNull { !it.isVirtual }
|
||||
?: error("There is no display!")
|
||||
val display =
|
||||
this.entry.displays.firstOrNull { !it.isVirtual } ?: error("There is no display!")
|
||||
this.visibleRegion(ComponentNameMatcher.NAV_BAR)
|
||||
.coversExactly(WindowUtils.getNavigationBarPosition(display, isGesturalNavigation))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the [ComponentNameMatcher.NAV_BAR] layer is at the correct position at the end
|
||||
* of the SF trace
|
||||
* Asserts that the [ComponentNameMatcher.NAV_BAR] layer is at the correct position at the end of
|
||||
* the SF trace
|
||||
*/
|
||||
fun FlickerTestParameter.navBarLayerPositionAtEnd() {
|
||||
assertLayersEnd {
|
||||
val display = this.entry.displays.minByOrNull { it.id }
|
||||
?: throw RuntimeException("There is no display!")
|
||||
val display =
|
||||
this.entry.displays.minByOrNull { it.id }
|
||||
?: throw RuntimeException("There is no display!")
|
||||
this.visibleRegion(ComponentNameMatcher.NAV_BAR)
|
||||
.coversExactly(WindowUtils.getNavigationBarPosition(display, isGesturalNavigation))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the [ComponentNameMatcher.NAV_BAR] layer is at the correct position at the start
|
||||
* and end of the SF trace
|
||||
* Asserts that the [ComponentNameMatcher.NAV_BAR] layer is at the correct position at the start and
|
||||
* end of the SF trace
|
||||
*/
|
||||
fun FlickerTestParameter.navBarLayerPositionAtStartAndEnd() {
|
||||
navBarLayerPositionAtStart()
|
||||
@@ -234,21 +200,23 @@ fun FlickerTestParameter.navBarLayerPositionAtStartAndEnd() {
|
||||
*/
|
||||
fun FlickerTestParameter.statusBarLayerPositionAtStart() {
|
||||
assertLayersStart {
|
||||
val display = this.entry.displays.minByOrNull { it.id }
|
||||
?: throw RuntimeException("There is no display!")
|
||||
val display =
|
||||
this.entry.displays.minByOrNull { it.id }
|
||||
?: throw RuntimeException("There is no display!")
|
||||
this.visibleRegion(ComponentNameMatcher.STATUS_BAR)
|
||||
.coversExactly(WindowUtils.getStatusBarPosition(display))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the [ComponentNameMatcher.STATUS_BAR] layer is at the correct position at the end
|
||||
* of the SF trace
|
||||
* Asserts that the [ComponentNameMatcher.STATUS_BAR] layer is at the correct position at the end of
|
||||
* the SF trace
|
||||
*/
|
||||
fun FlickerTestParameter.statusBarLayerPositionAtEnd() {
|
||||
assertLayersEnd {
|
||||
val display = this.entry.displays.minByOrNull { it.id }
|
||||
?: throw RuntimeException("There is no display!")
|
||||
val display =
|
||||
this.entry.displays.minByOrNull { it.id }
|
||||
?: throw RuntimeException("There is no display!")
|
||||
this.visibleRegion(ComponentNameMatcher.STATUS_BAR)
|
||||
.coversExactly(WindowUtils.getStatusBarPosition(display))
|
||||
}
|
||||
@@ -264,23 +232,25 @@ fun FlickerTestParameter.statusBarLayerPositionAtStartAndEnd() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the visibleRegion of the [ComponentNameMatcher.SNAPSHOT] layer can cover
|
||||
* the visibleRegion of the given app component exactly
|
||||
* Asserts that the visibleRegion of the [ComponentNameMatcher.SNAPSHOT] layer can cover the
|
||||
* visibleRegion of the given app component exactly
|
||||
*/
|
||||
fun FlickerTestParameter.snapshotStartingWindowLayerCoversExactlyOnApp(
|
||||
component: IComponentNameMatcher
|
||||
) {
|
||||
assertLayers {
|
||||
invoke("snapshotStartingWindowLayerCoversExactlyOnApp") {
|
||||
val snapshotLayers = it.subjects.filter { subject ->
|
||||
subject.name.contains(
|
||||
ComponentNameMatcher.SNAPSHOT.toLayerName()) && subject.isVisible
|
||||
}
|
||||
val snapshotLayers =
|
||||
it.subjects.filter { subject ->
|
||||
subject.name.contains(ComponentNameMatcher.SNAPSHOT.toLayerName()) &&
|
||||
subject.isVisible
|
||||
}
|
||||
// Verify the size of snapshotRegion covers appVisibleRegion exactly in animation.
|
||||
if (snapshotLayers.isNotEmpty()) {
|
||||
val visibleAreas = snapshotLayers.mapNotNull { snapshotLayer ->
|
||||
snapshotLayer.layer?.visibleRegion
|
||||
}.toTypedArray()
|
||||
val visibleAreas =
|
||||
snapshotLayers
|
||||
.mapNotNull { snapshotLayer -> snapshotLayer.layer?.visibleRegion }
|
||||
.toTypedArray()
|
||||
val snapshotRegion = RegionSubject.assertThat(visibleAreas, this, timestamp)
|
||||
val appVisibleRegion = it.visibleRegion(component)
|
||||
if (snapshotRegion.region.isNotEmpty) {
|
||||
@@ -293,22 +263,33 @@ fun FlickerTestParameter.snapshotStartingWindowLayerCoversExactlyOnApp(
|
||||
|
||||
/**
|
||||
* Asserts that:
|
||||
* ```
|
||||
* [originalLayer] is visible at the start of the trace
|
||||
* [originalLayer] becomes invisible during the trace and (in the same entry) [newLayer]
|
||||
* becomes visible
|
||||
* [newLayer] remains visible until the end of the trace
|
||||
*
|
||||
* @param originalLayer Layer that should be visible at the start
|
||||
* @param originalLayer
|
||||
* ```
|
||||
* Layer that should be visible at the start
|
||||
* @param newLayer Layer that should be visible at the end
|
||||
* @param ignoreEntriesWithRotationLayer If entries with a visible rotation layer should be ignored
|
||||
* ```
|
||||
* when checking the transition. If true we will not fail the assertion if a rotation layer is
|
||||
* visible to fill the gap between the [originalLayer] being visible and the [newLayer] being
|
||||
* visible.
|
||||
* @param ignoreSnapshot If the snapshot layer should be ignored during the transition
|
||||
* @param ignoreSnapshot
|
||||
* ```
|
||||
* If the snapshot layer should be ignored during the transition
|
||||
* ```
|
||||
* (useful mostly for app launch)
|
||||
* @param ignoreSplashscreen If the splashscreen layer should be ignored during the transition.
|
||||
* @param ignoreSplashscreen
|
||||
* ```
|
||||
* If the splashscreen layer should be ignored during the transition.
|
||||
* ```
|
||||
* If true then we will allow for a splashscreen to be shown before the layer is shown,
|
||||
* otherwise we won't and the layer must appear immediately.
|
||||
* ```
|
||||
*/
|
||||
fun FlickerTestParameter.replacesLayer(
|
||||
originalLayer: IComponentNameMatcher,
|
||||
@@ -333,13 +314,7 @@ fun FlickerTestParameter.replacesLayer(
|
||||
assertion.then().isVisible(newLayer)
|
||||
}
|
||||
|
||||
assertLayersStart {
|
||||
this.isVisible(originalLayer)
|
||||
.isInvisible(newLayer)
|
||||
}
|
||||
assertLayersStart { this.isVisible(originalLayer).isInvisible(newLayer) }
|
||||
|
||||
assertLayersEnd {
|
||||
this.isInvisible(originalLayer)
|
||||
.isVisible(newLayer)
|
||||
}
|
||||
assertLayersEnd { this.isInvisible(originalLayer).isVisible(newLayer) }
|
||||
}
|
||||
|
||||
@@ -41,9 +41,8 @@ import org.junit.runners.Parameterized
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
class OpenActivityEmbeddingPlaceholderSplit(
|
||||
testSpec: FlickerTestParameter
|
||||
) : ActivityEmbeddingTestBase(testSpec) {
|
||||
class OpenActivityEmbeddingPlaceholderSplit(testSpec: FlickerTestParameter) :
|
||||
ActivityEmbeddingTestBase(testSpec) {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
override val transition: FlickerBuilder.() -> Unit = {
|
||||
@@ -51,9 +50,7 @@ class OpenActivityEmbeddingPlaceholderSplit(
|
||||
tapl.setExpectedRotationCheckEnabled(false)
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
}
|
||||
transitions {
|
||||
testApp.launchPlaceholderSplit(wmHelper)
|
||||
}
|
||||
transitions { testApp.launchPlaceholderSplit(wmHelper) }
|
||||
teardown {
|
||||
tapl.goHome()
|
||||
testApp.exit(wmHelper)
|
||||
@@ -65,8 +62,8 @@ class OpenActivityEmbeddingPlaceholderSplit(
|
||||
fun mainActivityBecomesInvisible() {
|
||||
testSpec.assertLayers {
|
||||
isVisible(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT)
|
||||
.then()
|
||||
.isInvisible(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT)
|
||||
.then()
|
||||
.isInvisible(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,20 +72,18 @@ class OpenActivityEmbeddingPlaceholderSplit(
|
||||
fun placeholderSplitBecomesVisible() {
|
||||
testSpec.assertLayers {
|
||||
isInvisible(ActivityEmbeddingAppHelper.PLACEHOLDER_PRIMARY_COMPONENT)
|
||||
.then()
|
||||
.isVisible(ActivityEmbeddingAppHelper.PLACEHOLDER_PRIMARY_COMPONENT)
|
||||
.then()
|
||||
.isVisible(ActivityEmbeddingAppHelper.PLACEHOLDER_PRIMARY_COMPONENT)
|
||||
}
|
||||
testSpec.assertLayers {
|
||||
isInvisible(ActivityEmbeddingAppHelper.PLACEHOLDER_SECONDARY_COMPONENT)
|
||||
.then()
|
||||
.isVisible(ActivityEmbeddingAppHelper.PLACEHOLDER_SECONDARY_COMPONENT)
|
||||
.then()
|
||||
.isVisible(ActivityEmbeddingAppHelper.PLACEHOLDER_SECONDARY_COMPONENT)
|
||||
}
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Presubmit
|
||||
@Test
|
||||
override fun entireScreenCovered() = super.entireScreenCovered()
|
||||
@Presubmit @Test override fun entireScreenCovered() = super.entireScreenCovered()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Presubmit
|
||||
@@ -124,14 +119,12 @@ class OpenActivityEmbeddingPlaceholderSplit(
|
||||
/** {@inheritDoc} */
|
||||
@Presubmit
|
||||
@Test
|
||||
override fun statusBarLayerPositionAtStartAndEnd() =
|
||||
super.statusBarLayerPositionAtStartAndEnd()
|
||||
override fun statusBarLayerPositionAtStartAndEnd() = super.statusBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Presubmit
|
||||
@Test
|
||||
override fun statusBarWindowIsAlwaysVisible() =
|
||||
super.statusBarWindowIsAlwaysVisible()
|
||||
override fun statusBarWindowIsAlwaysVisible() = super.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Presubmit
|
||||
@@ -149,20 +142,21 @@ class OpenActivityEmbeddingPlaceholderSplit(
|
||||
/**
|
||||
* Creates the test configurations.
|
||||
*
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
|
||||
* repetitions, screen orientation and navigation modes.
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring repetitions,
|
||||
* screen orientation and navigation modes.
|
||||
*/
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(
|
||||
supportedRotations = listOf(Surface.ROTATION_0, Surface.ROTATION_90),
|
||||
supportedNavigationModes = listOf(
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
|
||||
)
|
||||
)
|
||||
.getConfigNonRotationTests(
|
||||
supportedRotations = listOf(Surface.ROTATION_0, Surface.ROTATION_90),
|
||||
supportedNavigationModes =
|
||||
listOf(
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
@@ -36,28 +35,34 @@ import org.junit.runners.Parameterized
|
||||
* To run this test: `atest FlickerTests:CloseAppBackButtonTest`
|
||||
*
|
||||
* Actions:
|
||||
* ```
|
||||
* Make sure no apps are running on the device
|
||||
* Launch an app [testApp] and wait animation to complete
|
||||
* Press back button
|
||||
*
|
||||
* ```
|
||||
* To run only the presubmit assertions add: `--
|
||||
* ```
|
||||
* --module-arg FlickerTests:exclude-annotation:androidx.test.filters.FlakyTest
|
||||
* --module-arg FlickerTests:include-annotation:android.platform.test.annotations.Presubmit`
|
||||
*
|
||||
* ```
|
||||
* To run only the postsubmit assertions add: `--
|
||||
* ```
|
||||
* --module-arg FlickerTests:exclude-annotation:androidx.test.filters.FlakyTest
|
||||
* --module-arg FlickerTests:include-annotation:android.platform.test.annotations.Postsubmit`
|
||||
*
|
||||
* ```
|
||||
* To run only the flaky assertions add: `--
|
||||
* ```
|
||||
* --module-arg FlickerTests:include-annotation:androidx.test.filters.FlakyTest`
|
||||
*
|
||||
* ```
|
||||
* Notes:
|
||||
* ```
|
||||
* 1. Some default assertions (e.g., nav bar, status bar and screen covered)
|
||||
* are inherited [CloseAppTransition]
|
||||
* 2. Part of the test setup occurs automatically via
|
||||
* [com.android.server.wm.flicker.TransitionRunnerWithRules],
|
||||
* including configuring navigation mode, initial orientation and ensuring no
|
||||
* apps are running before setup
|
||||
* ```
|
||||
*/
|
||||
@RequiresDevice
|
||||
@FlickerServiceCompatible
|
||||
@@ -71,9 +76,7 @@ class CloseAppBackButtonTest(testSpec: FlickerTestParameter) : CloseAppTransitio
|
||||
super.transition(this)
|
||||
transitions {
|
||||
tapl.pressBack()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withHomeActivityVisible()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withHomeActivityVisible().waitForAndVerify()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,14 +89,13 @@ class CloseAppBackButtonTest(testSpec: FlickerTestParameter) : CloseAppTransitio
|
||||
/**
|
||||
* Creates the test configurations.
|
||||
*
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
|
||||
* repetitions, screen orientation and navigation modes.
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring repetitions,
|
||||
* screen orientation and navigation modes.
|
||||
*/
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): List<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests()
|
||||
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,28 +35,34 @@ import org.junit.runners.Parameterized
|
||||
* To run this test: `atest FlickerTests:CloseAppHomeButtonTest`
|
||||
*
|
||||
* Actions:
|
||||
* ```
|
||||
* Make sure no apps are running on the device
|
||||
* Launch an app [testApp] and wait animation to complete
|
||||
* Press home button
|
||||
*
|
||||
* ```
|
||||
* To run only the presubmit assertions add: `--
|
||||
* ```
|
||||
* --module-arg FlickerTests:exclude-annotation:androidx.test.filters.FlakyTest
|
||||
* --module-arg FlickerTests:include-annotation:android.platform.test.annotations.Presubmit`
|
||||
*
|
||||
* ```
|
||||
* To run only the postsubmit assertions add: `--
|
||||
* ```
|
||||
* --module-arg FlickerTests:exclude-annotation:androidx.test.filters.FlakyTest
|
||||
* --module-arg FlickerTests:include-annotation:android.platform.test.annotations.Postsubmit`
|
||||
*
|
||||
* ```
|
||||
* To run only the flaky assertions add: `--
|
||||
* ```
|
||||
* --module-arg FlickerTests:include-annotation:androidx.test.filters.FlakyTest`
|
||||
*
|
||||
* ```
|
||||
* Notes:
|
||||
* ```
|
||||
* 1. Some default assertions (e.g., nav bar, status bar and screen covered)
|
||||
* are inherited [CloseAppTransition]
|
||||
* 2. Part of the test setup occurs automatically via
|
||||
* [com.android.server.wm.flicker.TransitionRunnerWithRules],
|
||||
* including configuring navigation mode, initial orientation and ensuring no
|
||||
* apps are running before setup
|
||||
* ```
|
||||
*/
|
||||
@RequiresDevice
|
||||
@FlickerServiceCompatible
|
||||
@@ -68,18 +74,14 @@ class CloseAppHomeButtonTest(testSpec: FlickerTestParameter) : CloseAppTransitio
|
||||
override val transition: FlickerBuilder.() -> Unit
|
||||
get() = {
|
||||
super.transition(this)
|
||||
setup {
|
||||
tapl.setExpectedRotationCheckEnabled(false)
|
||||
}
|
||||
setup { tapl.setExpectedRotationCheckEnabled(false) }
|
||||
transitions {
|
||||
// Can't use TAPL at the moment because of rotation test issues
|
||||
// When pressing home, TAPL expects the orientation to remain constant
|
||||
// However, when closing a landscape app back to a portrait-only launcher
|
||||
// this causes an error in verifyActiveContainer();
|
||||
tapl.goHome()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withHomeActivityVisible()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withHomeActivityVisible().waitForAndVerify()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,14 +94,13 @@ class CloseAppHomeButtonTest(testSpec: FlickerTestParameter) : CloseAppTransitio
|
||||
/**
|
||||
* Creates the test configurations.
|
||||
*
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
|
||||
* repetitions, screen orientation and navigation modes.
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring repetitions,
|
||||
* screen orientation and navigation modes.
|
||||
*/
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests()
|
||||
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,9 +27,7 @@ import com.android.server.wm.flicker.replacesLayer
|
||||
import com.android.server.wm.traces.common.ComponentNameMatcher.Companion.LAUNCHER
|
||||
import org.junit.Test
|
||||
|
||||
/**
|
||||
* Base test class for transitions that close an app back to the launcher screen
|
||||
*/
|
||||
/** Base test class for transitions that close an app back to the launcher screen */
|
||||
abstract class CloseAppTransition(testSpec: FlickerTestParameter) : BaseTest(testSpec) {
|
||||
protected open val testApp: StandardAppHelper = SimpleAppHelper(instrumentation)
|
||||
|
||||
@@ -40,42 +38,30 @@ abstract class CloseAppTransition(testSpec: FlickerTestParameter) : BaseTest(tes
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
this.setRotation(testSpec.startRotation)
|
||||
}
|
||||
teardown {
|
||||
testApp.exit(wmHelper)
|
||||
}
|
||||
teardown { testApp.exit(wmHelper) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [testApp] is the top visible app window at the start of the transition and
|
||||
* that it is replaced by [LAUNCHER] during the transition
|
||||
* Checks that [testApp] is the top visible app window at the start of the transition and that
|
||||
* it is replaced by [LAUNCHER] during the transition
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun launcherReplacesAppWindowAsTopWindow() {
|
||||
testSpec.assertWm {
|
||||
this.isAppWindowOnTop(testApp)
|
||||
.then()
|
||||
.isAppWindowOnTop(LAUNCHER)
|
||||
}
|
||||
testSpec.assertWm { this.isAppWindowOnTop(testApp).then().isAppWindowOnTop(LAUNCHER) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [LAUNCHER] is invisible at the start of the transition and that
|
||||
* it becomes visible during the transition
|
||||
* Checks that [LAUNCHER] is invisible at the start of the transition and that it becomes
|
||||
* visible during the transition
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun launcherWindowBecomesVisible() {
|
||||
testSpec.assertWm {
|
||||
this.isAppWindowNotOnTop(LAUNCHER)
|
||||
.then()
|
||||
.isAppWindowOnTop(LAUNCHER)
|
||||
}
|
||||
testSpec.assertWm { this.isAppWindowNotOnTop(LAUNCHER).then().isAppWindowOnTop(LAUNCHER) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [LAUNCHER] layer becomes visible when [testApp] becomes invisible
|
||||
*/
|
||||
/** Checks that [LAUNCHER] layer becomes visible when [testApp] becomes invisible */
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun launcherLayerReplacesApp() {
|
||||
|
||||
@@ -32,13 +32,14 @@ import com.android.server.wm.traces.parser.toFlickerComponent
|
||||
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
|
||||
import org.junit.Assume.assumeNotNull
|
||||
|
||||
class ActivityEmbeddingAppHelper @JvmOverloads constructor(
|
||||
class ActivityEmbeddingAppHelper
|
||||
@JvmOverloads
|
||||
constructor(
|
||||
instr: Instrumentation,
|
||||
launcherName: String = ActivityOptions.ActivityEmbedding.MainActivity.LABEL,
|
||||
component: ComponentNameMatcher = MAIN_ACTIVITY_COMPONENT,
|
||||
launcherStrategy: ILauncherStrategy = LauncherStrategyFactory
|
||||
.getInstance(instr)
|
||||
.launcherStrategy
|
||||
launcherStrategy: ILauncherStrategy =
|
||||
LauncherStrategyFactory.getInstance(instr).launcherStrategy
|
||||
) : StandardAppHelper(instr, launcherName, component, launcherStrategy) {
|
||||
|
||||
/**
|
||||
@@ -46,14 +47,15 @@ class ActivityEmbeddingAppHelper @JvmOverloads constructor(
|
||||
* placeholder secondary activity based on the placeholder rule.
|
||||
*/
|
||||
fun launchPlaceholderSplit(wmHelper: WindowManagerStateHelper) {
|
||||
val launchButton = uiDevice.wait(
|
||||
Until.findObject(By.res(getPackage(), "launch_placeholder_split_button")),
|
||||
FIND_TIMEOUT)
|
||||
require(launchButton != null) {
|
||||
"Can't find launch placeholder split button on screen."
|
||||
}
|
||||
val launchButton =
|
||||
uiDevice.wait(
|
||||
Until.findObject(By.res(getPackage(), "launch_placeholder_split_button")),
|
||||
FIND_TIMEOUT
|
||||
)
|
||||
require(launchButton != null) { "Can't find launch placeholder split button on screen." }
|
||||
launchButton.click()
|
||||
wmHelper.StateSyncBuilder()
|
||||
wmHelper
|
||||
.StateSyncBuilder()
|
||||
.withActivityState(PLACEHOLDER_PRIMARY_COMPONENT, STATE_RESUMED)
|
||||
.withActivityState(PLACEHOLDER_SECONDARY_COMPONENT, STATE_RESUMED)
|
||||
.waitForAndVerify()
|
||||
|
||||
@@ -23,12 +23,18 @@ import android.content.pm.ResolveInfo
|
||||
import android.provider.MediaStore
|
||||
import com.android.server.wm.traces.common.ComponentNameMatcher
|
||||
|
||||
class CameraAppHelper @JvmOverloads constructor(
|
||||
class CameraAppHelper
|
||||
@JvmOverloads
|
||||
constructor(
|
||||
instrumentation: Instrumentation,
|
||||
pkgManager: PackageManager = instrumentation.context.packageManager
|
||||
) : StandardAppHelper(instrumentation, getCameraLauncherName(pkgManager),
|
||||
getCameraComponent(pkgManager)){
|
||||
companion object{
|
||||
) :
|
||||
StandardAppHelper(
|
||||
instrumentation,
|
||||
getCameraLauncherName(pkgManager),
|
||||
getCameraComponent(pkgManager)
|
||||
) {
|
||||
companion object {
|
||||
private fun getCameraIntent(): Intent {
|
||||
return Intent(MediaStore.ACTION_IMAGE_CAPTURE)
|
||||
}
|
||||
@@ -36,13 +42,15 @@ class CameraAppHelper @JvmOverloads constructor(
|
||||
private fun getResolveInfo(pkgManager: PackageManager): ResolveInfo {
|
||||
val intent = getCameraIntent()
|
||||
return pkgManager.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY)
|
||||
?: error("unable to resolve camera activity")
|
||||
?: error("unable to resolve camera activity")
|
||||
}
|
||||
|
||||
private fun getCameraComponent(pkgManager: PackageManager): ComponentNameMatcher {
|
||||
val resolveInfo = getResolveInfo(pkgManager)
|
||||
return ComponentNameMatcher(resolveInfo.activityInfo.packageName,
|
||||
className = resolveInfo.activityInfo.name)
|
||||
return ComponentNameMatcher(
|
||||
resolveInfo.activityInfo.packageName,
|
||||
className = resolveInfo.activityInfo.name
|
||||
)
|
||||
}
|
||||
|
||||
private fun getCameraLauncherName(pkgManager: PackageManager): String {
|
||||
|
||||
@@ -23,12 +23,13 @@ import com.android.server.wm.flicker.testapp.ActivityOptions
|
||||
import com.android.server.wm.traces.common.ComponentNameMatcher
|
||||
import com.android.server.wm.traces.parser.toFlickerComponent
|
||||
|
||||
class FixedOrientationAppHelper @JvmOverloads constructor(
|
||||
class FixedOrientationAppHelper
|
||||
@JvmOverloads
|
||||
constructor(
|
||||
instr: Instrumentation,
|
||||
launcherName: String = ActivityOptions.PortraitOnlyActivity.LABEL,
|
||||
component: ComponentNameMatcher =
|
||||
ActivityOptions.PortraitOnlyActivity.COMPONENT.toFlickerComponent(),
|
||||
launcherStrategy: ILauncherStrategy = LauncherStrategyFactory
|
||||
.getInstance(instr)
|
||||
.launcherStrategy
|
||||
launcherStrategy: ILauncherStrategy =
|
||||
LauncherStrategyFactory.getInstance(instr).launcherStrategy
|
||||
) : StandardAppHelper(instr, launcherName, component, launcherStrategy)
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
@file:JvmName("FlickerExtensions")
|
||||
|
||||
package com.android.server.wm.flicker.helpers
|
||||
|
||||
import com.android.server.wm.flicker.Flicker
|
||||
@@ -31,4 +32,4 @@ fun Flicker.setRotation(rotation: Int) =
|
||||
instrumentation,
|
||||
clearCacheAfterParsing = false,
|
||||
wmHelper = wmHelper
|
||||
)
|
||||
)
|
||||
|
||||
@@ -27,7 +27,9 @@ import com.android.server.wm.traces.common.ComponentNameMatcher
|
||||
import com.android.server.wm.traces.parser.toFlickerComponent
|
||||
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
|
||||
|
||||
class GameAppHelper @JvmOverloads constructor(
|
||||
class GameAppHelper
|
||||
@JvmOverloads
|
||||
constructor(
|
||||
instr: Instrumentation,
|
||||
launcherName: String = ActivityOptions.Game.LABEL,
|
||||
component: ComponentNameMatcher = ActivityOptions.Game.COMPONENT.toFlickerComponent(),
|
||||
@@ -41,13 +43,18 @@ class GameAppHelper @JvmOverloads constructor(
|
||||
* @return true if the swipe operation is successful.
|
||||
*/
|
||||
fun swipeDown(): Boolean {
|
||||
val gameView = uiDevice.wait(
|
||||
Until.findObject(By.res(getPackage(), GAME_APP_VIEW_RES)), WAIT_TIME_MS)
|
||||
val gameView =
|
||||
uiDevice.wait(Until.findObject(By.res(getPackage(), GAME_APP_VIEW_RES)), WAIT_TIME_MS)
|
||||
require(gameView != null) { "Mock game app view not found." }
|
||||
|
||||
val bound = gameView.getVisibleBounds()
|
||||
return uiDevice.swipe(
|
||||
bound.centerX(), bound.top, bound.centerX(), bound.centerY(), SWIPE_STEPS)
|
||||
bound.centerX(),
|
||||
bound.top,
|
||||
bound.centerX(),
|
||||
bound.centerY(),
|
||||
SWIPE_STEPS
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,15 +76,21 @@ class GameAppHelper @JvmOverloads constructor(
|
||||
|
||||
val bound = fullView.bounds
|
||||
val targetYPos = bound.bottom * ratioForScreenBottom
|
||||
val endX = when (direction) {
|
||||
Direction.LEFT -> bound.left
|
||||
Direction.RIGHT -> bound.right
|
||||
else -> {
|
||||
throw IllegalStateException("Only left or right direction is allowed.")
|
||||
val endX =
|
||||
when (direction) {
|
||||
Direction.LEFT -> bound.left
|
||||
Direction.RIGHT -> bound.right
|
||||
else -> {
|
||||
throw IllegalStateException("Only left or right direction is allowed.")
|
||||
}
|
||||
}
|
||||
}
|
||||
return uiDevice.swipe(
|
||||
bound.centerX(), targetYPos.toInt(), endX, targetYPos.toInt(), SWIPE_STEPS)
|
||||
bound.centerX(),
|
||||
targetYPos.toInt(),
|
||||
endX,
|
||||
targetYPos.toInt(),
|
||||
SWIPE_STEPS
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,7 +28,9 @@ import com.android.server.wm.traces.parser.toFlickerComponent
|
||||
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
|
||||
import java.util.regex.Pattern
|
||||
|
||||
class ImeAppAutoFocusHelper @JvmOverloads constructor(
|
||||
class ImeAppAutoFocusHelper
|
||||
@JvmOverloads
|
||||
constructor(
|
||||
instr: Instrumentation,
|
||||
private val rotation: Int,
|
||||
private val imePackageName: String = IME_PACKAGE,
|
||||
@@ -52,59 +54,61 @@ class ImeAppAutoFocusHelper @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
override fun open() {
|
||||
val expectedPackage = if (rotation.isRotated()) {
|
||||
imePackageName
|
||||
} else {
|
||||
getPackage()
|
||||
}
|
||||
val expectedPackage =
|
||||
if (rotation.isRotated()) {
|
||||
imePackageName
|
||||
} else {
|
||||
getPackage()
|
||||
}
|
||||
launcherStrategy.launch(appName, expectedPackage)
|
||||
}
|
||||
|
||||
fun startDialogThemedActivity(wmHelper: WindowManagerStateHelper) {
|
||||
val button = uiDevice.wait(Until.findObject(By.res(getPackage(),
|
||||
"start_dialog_themed_activity_btn")), FIND_TIMEOUT)
|
||||
val button =
|
||||
uiDevice.wait(
|
||||
Until.findObject(By.res(getPackage(), "start_dialog_themed_activity_btn")),
|
||||
FIND_TIMEOUT
|
||||
)
|
||||
|
||||
requireNotNull(button) {
|
||||
"Button not found, this usually happens when the device " +
|
||||
"was left in an unknown state (e.g. Screen turned off)"
|
||||
}
|
||||
button.click()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withFullScreenApp(
|
||||
ActivityOptions.DialogThemedActivity.COMPONENT.toFlickerComponent())
|
||||
wmHelper
|
||||
.StateSyncBuilder()
|
||||
.withFullScreenApp(ActivityOptions.DialogThemedActivity.COMPONENT.toFlickerComponent())
|
||||
.waitForAndVerify()
|
||||
}
|
||||
|
||||
fun dismissDialog(wmHelper: WindowManagerStateHelper) {
|
||||
val dialog = uiDevice.wait(
|
||||
Until.findObject(By.text("Dialog for test")), FIND_TIMEOUT)
|
||||
val dialog = uiDevice.wait(Until.findObject(By.text("Dialog for test")), FIND_TIMEOUT)
|
||||
|
||||
// Pressing back key to dismiss the dialog
|
||||
if (dialog != null) {
|
||||
uiDevice.pressBack()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withAppTransitionIdle()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withAppTransitionIdle().waitForAndVerify()
|
||||
}
|
||||
}
|
||||
|
||||
fun getInsetsVisibleFromDialog(type: Int): Boolean {
|
||||
val insetsVisibilityTextView = uiDevice.wait(
|
||||
Until.findObject(By.res("android:id/text1")), FIND_TIMEOUT)
|
||||
val insetsVisibilityTextView =
|
||||
uiDevice.wait(Until.findObject(By.res("android:id/text1")), FIND_TIMEOUT)
|
||||
if (insetsVisibilityTextView != null) {
|
||||
val visibility = insetsVisibilityTextView.text.toString()
|
||||
val matcher = when (type) {
|
||||
ime() -> {
|
||||
Pattern.compile("IME\\: (VISIBLE|INVISIBLE)").matcher(visibility)
|
||||
val matcher =
|
||||
when (type) {
|
||||
ime() -> {
|
||||
Pattern.compile("IME\\: (VISIBLE|INVISIBLE)").matcher(visibility)
|
||||
}
|
||||
statusBars() -> {
|
||||
Pattern.compile("StatusBar\\: (VISIBLE|INVISIBLE)").matcher(visibility)
|
||||
}
|
||||
navigationBars() -> {
|
||||
Pattern.compile("NavBar\\: (VISIBLE|INVISIBLE)").matcher(visibility)
|
||||
}
|
||||
else -> null
|
||||
}
|
||||
statusBars() -> {
|
||||
Pattern.compile("StatusBar\\: (VISIBLE|INVISIBLE)").matcher(visibility)
|
||||
}
|
||||
navigationBars() -> {
|
||||
Pattern.compile("NavBar\\: (VISIBLE|INVISIBLE)").matcher(visibility)
|
||||
}
|
||||
else -> null
|
||||
}
|
||||
if (matcher != null && matcher.find()) {
|
||||
return matcher.group(1).equals("VISIBLE")
|
||||
}
|
||||
|
||||
@@ -26,11 +26,12 @@ import com.android.server.wm.traces.common.ComponentNameMatcher
|
||||
import com.android.server.wm.traces.parser.toFlickerComponent
|
||||
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
|
||||
|
||||
open class ImeAppHelper @JvmOverloads constructor(
|
||||
open class ImeAppHelper
|
||||
@JvmOverloads
|
||||
constructor(
|
||||
instr: Instrumentation,
|
||||
launcherName: String = ActivityOptions.Ime.Default.LABEL,
|
||||
component: ComponentNameMatcher =
|
||||
ActivityOptions.Ime.Default.COMPONENT.toFlickerComponent(),
|
||||
component: ComponentNameMatcher = ActivityOptions.Ime.Default.COMPONENT.toFlickerComponent(),
|
||||
launcherStrategy: ILauncherStrategy =
|
||||
LauncherStrategyFactory.getInstance(instr).launcherStrategy
|
||||
) : StandardAppHelper(instr, launcherName, component, launcherStrategy) {
|
||||
@@ -40,9 +41,8 @@ open class ImeAppHelper @JvmOverloads constructor(
|
||||
* @param wmHelper Helper used to wait for WindowManager states
|
||||
*/
|
||||
open fun openIME(wmHelper: WindowManagerStateHelper) {
|
||||
val editText = uiDevice.wait(
|
||||
Until.findObject(By.res(getPackage(), "plain_text_input")),
|
||||
FIND_TIMEOUT)
|
||||
val editText =
|
||||
uiDevice.wait(Until.findObject(By.res(getPackage(), "plain_text_input")), FIND_TIMEOUT)
|
||||
|
||||
requireNotNull(editText) {
|
||||
"Text field not found, this usually happens when the device " +
|
||||
@@ -53,9 +53,7 @@ open class ImeAppHelper @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
protected fun waitIMEShown(wmHelper: WindowManagerStateHelper) {
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withImeShown()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withImeShown().waitForAndVerify()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,21 +63,19 @@ open class ImeAppHelper @JvmOverloads constructor(
|
||||
*/
|
||||
open fun closeIME(wmHelper: WindowManagerStateHelper) {
|
||||
uiDevice.pressBack()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withImeGone()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withImeGone().waitForAndVerify()
|
||||
}
|
||||
|
||||
open fun finishActivity(wmHelper: WindowManagerStateHelper) {
|
||||
val finishButton = uiDevice.wait(
|
||||
Until.findObject(By.res(getPackage(), "finish_activity_btn")),
|
||||
FIND_TIMEOUT)
|
||||
val finishButton =
|
||||
uiDevice.wait(
|
||||
Until.findObject(By.res(getPackage(), "finish_activity_btn")),
|
||||
FIND_TIMEOUT
|
||||
)
|
||||
requireNotNull(finishButton) {
|
||||
"Finish activity button not found, probably IME activity is not on the screen?"
|
||||
}
|
||||
finishButton.click()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withActivityRemoved(this)
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withActivityRemoved(this).waitForAndVerify()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,9 @@ import com.android.server.wm.traces.common.ComponentNameMatcher
|
||||
import com.android.server.wm.traces.parser.toFlickerComponent
|
||||
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
|
||||
|
||||
class ImeEditorPopupDialogAppHelper @JvmOverloads constructor(
|
||||
class ImeEditorPopupDialogAppHelper
|
||||
@JvmOverloads
|
||||
constructor(
|
||||
instr: Instrumentation,
|
||||
launcherName: String = ActivityOptions.Ime.EditorPopupDialogActivity.LABEL,
|
||||
component: ComponentNameMatcher =
|
||||
@@ -42,15 +44,12 @@ class ImeEditorPopupDialogAppHelper @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
fun dismissDialog(wmHelper: WindowManagerStateHelper) {
|
||||
val dismissButton = uiDevice.wait(
|
||||
Until.findObject(By.text("Dismiss")), FIND_TIMEOUT)
|
||||
val dismissButton = uiDevice.wait(Until.findObject(By.text("Dismiss")), FIND_TIMEOUT)
|
||||
|
||||
// Pressing back key to dismiss the dialog
|
||||
if (dismissButton != null) {
|
||||
dismissButton.click()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withAppTransitionIdle()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withAppTransitionIdle().waitForAndVerify()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,9 @@ import com.android.server.wm.flicker.testapp.ActivityOptions
|
||||
import com.android.server.wm.traces.common.ComponentNameMatcher
|
||||
import com.android.server.wm.traces.parser.toFlickerComponent
|
||||
|
||||
class ImeStateInitializeHelper @JvmOverloads constructor(
|
||||
class ImeStateInitializeHelper
|
||||
@JvmOverloads
|
||||
constructor(
|
||||
instr: Instrumentation,
|
||||
launcherName: String = ActivityOptions.Ime.StateInitializeActivity.LABEL,
|
||||
component: ComponentNameMatcher =
|
||||
|
||||
@@ -20,8 +20,9 @@ import android.app.Instrumentation
|
||||
import com.android.server.wm.flicker.testapp.ActivityOptions
|
||||
import com.android.server.wm.traces.parser.toFlickerComponent
|
||||
|
||||
class LaunchBubbleHelper(instrumentation: Instrumentation) : StandardAppHelper(
|
||||
instrumentation,
|
||||
ActivityOptions.Bubbles.LaunchBubble.LABEL,
|
||||
ActivityOptions.Bubbles.LaunchBubble.COMPONENT.toFlickerComponent()
|
||||
)
|
||||
class LaunchBubbleHelper(instrumentation: Instrumentation) :
|
||||
StandardAppHelper(
|
||||
instrumentation,
|
||||
ActivityOptions.Bubbles.LaunchBubble.LABEL,
|
||||
ActivityOptions.Bubbles.LaunchBubble.COMPONENT.toFlickerComponent()
|
||||
)
|
||||
|
||||
@@ -27,19 +27,19 @@ import com.android.server.wm.flicker.testapp.ActivityOptions
|
||||
import com.android.server.wm.traces.common.ComponentNameMatcher
|
||||
import com.android.server.wm.traces.parser.toFlickerComponent
|
||||
|
||||
class MailAppHelper @JvmOverloads constructor(
|
||||
class MailAppHelper
|
||||
@JvmOverloads
|
||||
constructor(
|
||||
instr: Instrumentation,
|
||||
launcherName: String = ActivityOptions.Mail.LABEL,
|
||||
component: ComponentNameMatcher =
|
||||
ActivityOptions.Mail.COMPONENT.toFlickerComponent(),
|
||||
launcherStrategy: ILauncherStrategy = LauncherStrategyFactory
|
||||
.getInstance(instr)
|
||||
.launcherStrategy
|
||||
component: ComponentNameMatcher = ActivityOptions.Mail.COMPONENT.toFlickerComponent(),
|
||||
launcherStrategy: ILauncherStrategy =
|
||||
LauncherStrategyFactory.getInstance(instr).launcherStrategy
|
||||
) : StandardAppHelper(instr, launcherName, component, launcherStrategy) {
|
||||
|
||||
fun openMail(rowIdx: Int) {
|
||||
val rowSel = By.res(getPackage(), "mail_row_item_text")
|
||||
.textEndsWith(String.format("%04d", rowIdx))
|
||||
val rowSel =
|
||||
By.res(getPackage(), "mail_row_item_text").textEndsWith(String.format("%04d", rowIdx))
|
||||
var row: UiObject2? = null
|
||||
for (i in 1..1000) {
|
||||
row = uiDevice.wait(Until.findObject(rowSel), SHORT_WAIT_TIME_MS)
|
||||
|
||||
@@ -40,23 +40,29 @@ class MultiWindowUtils(
|
||||
}
|
||||
|
||||
fun getDevEnableNonResizableMultiWindow(context: Context): Int =
|
||||
Settings.Global.getInt(context.contentResolver,
|
||||
Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW)
|
||||
Settings.Global.getInt(
|
||||
context.contentResolver,
|
||||
Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW
|
||||
)
|
||||
|
||||
fun setDevEnableNonResizableMultiWindow(context: Context, configValue: Int) =
|
||||
Settings.Global.putInt(context.contentResolver,
|
||||
Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW, configValue)
|
||||
Settings.Global.putInt(
|
||||
context.contentResolver,
|
||||
Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW,
|
||||
configValue
|
||||
)
|
||||
|
||||
fun setSupportsNonResizableMultiWindow(instrumentation: Instrumentation, configValue: Int) =
|
||||
executeShellCommand(
|
||||
instrumentation,
|
||||
createConfigSupportsNonResizableMultiWindowCommand(configValue))
|
||||
instrumentation,
|
||||
createConfigSupportsNonResizableMultiWindowCommand(configValue)
|
||||
)
|
||||
|
||||
fun resetMultiWindowConfig(instrumentation: Instrumentation) =
|
||||
executeShellCommand(instrumentation, resetMultiWindowConfigCommand)
|
||||
|
||||
private fun createConfigSupportsNonResizableMultiWindowCommand(configValue: Int): String =
|
||||
"wm set-multi-window-config --supportsNonResizable $configValue"
|
||||
"wm set-multi-window-config --supportsNonResizable $configValue"
|
||||
|
||||
private const val resetMultiWindowConfigCommand: String = "wm reset-multi-window-config"
|
||||
}
|
||||
|
||||
@@ -27,27 +27,24 @@ import com.android.server.wm.traces.common.ComponentNameMatcher
|
||||
import com.android.server.wm.traces.parser.toFlickerComponent
|
||||
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
|
||||
|
||||
class NewTasksAppHelper @JvmOverloads constructor(
|
||||
class NewTasksAppHelper
|
||||
@JvmOverloads
|
||||
constructor(
|
||||
instr: Instrumentation,
|
||||
launcherName: String = ActivityOptions.LaunchNewTask.LABEL,
|
||||
component: ComponentNameMatcher =
|
||||
ActivityOptions.LaunchNewTask.COMPONENT.toFlickerComponent(),
|
||||
launcherStrategy: ILauncherStrategy = LauncherStrategyFactory
|
||||
.getInstance(instr)
|
||||
.launcherStrategy
|
||||
component: ComponentNameMatcher = ActivityOptions.LaunchNewTask.COMPONENT.toFlickerComponent(),
|
||||
launcherStrategy: ILauncherStrategy =
|
||||
LauncherStrategyFactory.getInstance(instr).launcherStrategy
|
||||
) : StandardAppHelper(instr, launcherName, component, launcherStrategy) {
|
||||
fun openNewTask(device: UiDevice, wmHelper: WindowManagerStateHelper) {
|
||||
val button = device.wait(
|
||||
Until.findObject(By.res(getPackage(), "launch_new_task")),
|
||||
FIND_TIMEOUT)
|
||||
val button =
|
||||
device.wait(Until.findObject(By.res(getPackage(), "launch_new_task")), FIND_TIMEOUT)
|
||||
|
||||
requireNotNull(button) {
|
||||
"Button not found, this usually happens when the device " +
|
||||
"was left in an unknown state (e.g. in split screen)"
|
||||
}
|
||||
button.click()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withAppTransitionIdle()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withAppTransitionIdle().waitForAndVerify()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,9 @@ import com.android.server.wm.flicker.testapp.ActivityOptions
|
||||
import com.android.server.wm.traces.common.ComponentNameMatcher
|
||||
import com.android.server.wm.traces.parser.toFlickerComponent
|
||||
|
||||
class NonResizeableAppHelper @JvmOverloads constructor(
|
||||
class NonResizeableAppHelper
|
||||
@JvmOverloads
|
||||
constructor(
|
||||
instr: Instrumentation,
|
||||
launcherName: String = ActivityOptions.NonResizeableActivity.LABEL,
|
||||
component: ComponentNameMatcher =
|
||||
|
||||
@@ -26,19 +26,18 @@ import com.android.server.wm.traces.common.ComponentNameMatcher
|
||||
import com.android.server.wm.traces.parser.toFlickerComponent
|
||||
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
|
||||
|
||||
class NotificationAppHelper @JvmOverloads constructor(
|
||||
class NotificationAppHelper
|
||||
@JvmOverloads
|
||||
constructor(
|
||||
instr: Instrumentation,
|
||||
launcherName: String = ActivityOptions.Notification.LABEL,
|
||||
component: ComponentNameMatcher =
|
||||
ActivityOptions.Notification.COMPONENT.toFlickerComponent(),
|
||||
launcherStrategy: ILauncherStrategy = LauncherStrategyFactory
|
||||
.getInstance(instr)
|
||||
.launcherStrategy
|
||||
component: ComponentNameMatcher = ActivityOptions.Notification.COMPONENT.toFlickerComponent(),
|
||||
launcherStrategy: ILauncherStrategy =
|
||||
LauncherStrategyFactory.getInstance(instr).launcherStrategy
|
||||
) : StandardAppHelper(instr, launcherName, component, launcherStrategy) {
|
||||
fun postNotification(wmHelper: WindowManagerStateHelper) {
|
||||
val button = uiDevice.wait(
|
||||
Until.findObject(By.res(getPackage(), "post_notification")),
|
||||
FIND_TIMEOUT)
|
||||
val button =
|
||||
uiDevice.wait(Until.findObject(By.res(getPackage(), "post_notification")), FIND_TIMEOUT)
|
||||
|
||||
requireNotNull(button) {
|
||||
"Post notification button not found, this usually happens when the device " +
|
||||
@@ -48,8 +47,6 @@ class NotificationAppHelper @JvmOverloads constructor(
|
||||
|
||||
uiDevice.wait(Until.findObject(By.text("Flicker Test Notification")), FIND_TIMEOUT)
|
||||
?: error("Flicker Notification not found")
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withAppTransitionIdle()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withAppTransitionIdle().waitForAndVerify()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,19 +29,20 @@ import com.android.server.wm.traces.common.region.Region
|
||||
import com.android.server.wm.traces.parser.toFlickerComponent
|
||||
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
|
||||
|
||||
open class PipAppHelper(instrumentation: Instrumentation) : StandardAppHelper(
|
||||
instrumentation,
|
||||
ActivityOptions.Pip.LABEL,
|
||||
ActivityOptions.Pip.COMPONENT.toFlickerComponent()
|
||||
) {
|
||||
open class PipAppHelper(instrumentation: Instrumentation) :
|
||||
StandardAppHelper(
|
||||
instrumentation,
|
||||
ActivityOptions.Pip.LABEL,
|
||||
ActivityOptions.Pip.COMPONENT.toFlickerComponent()
|
||||
) {
|
||||
private val mediaSessionManager: MediaSessionManager
|
||||
get() = context.getSystemService(MediaSessionManager::class.java)
|
||||
?: error("Could not get MediaSessionManager")
|
||||
get() =
|
||||
context.getSystemService(MediaSessionManager::class.java)
|
||||
?: error("Could not get MediaSessionManager")
|
||||
|
||||
private val mediaController: MediaController?
|
||||
get() = mediaSessionManager.getActiveSessions(null).firstOrNull {
|
||||
it.packageName == `package`
|
||||
}
|
||||
get() =
|
||||
mediaSessionManager.getActiveSessions(null).firstOrNull { it.packageName == `package` }
|
||||
|
||||
open fun clickObject(resId: String) {
|
||||
val selector = By.res(`package`, resId)
|
||||
@@ -51,8 +52,8 @@ open class PipAppHelper(instrumentation: Instrumentation) : StandardAppHelper(
|
||||
}
|
||||
|
||||
/**
|
||||
* Launches the app through an intent instead of interacting with the launcher and waits
|
||||
* until the app window is in PIP mode
|
||||
* Launches the app through an intent instead of interacting with the launcher and waits until
|
||||
* the app window is in PIP mode
|
||||
*/
|
||||
@JvmOverloads
|
||||
fun launchViaIntentAndWaitForPip(
|
||||
@@ -62,18 +63,17 @@ open class PipAppHelper(instrumentation: Instrumentation) : StandardAppHelper(
|
||||
stringExtras: Map<String, String>
|
||||
) {
|
||||
launchViaIntentAndWaitShown(
|
||||
wmHelper, expectedWindowName, action, stringExtras,
|
||||
wmHelper,
|
||||
expectedWindowName,
|
||||
action,
|
||||
stringExtras,
|
||||
waitConditions = arrayOf(WindowManagerConditionsFactory.hasPipWindow())
|
||||
)
|
||||
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withPipShown()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withPipShown().waitForAndVerify()
|
||||
}
|
||||
|
||||
/**
|
||||
* Expand the PIP window back to full screen via intent and wait until the app is visible
|
||||
*/
|
||||
/** Expand the PIP window back to full screen via intent and wait until the app is visible */
|
||||
fun exitPipToFullScreenViaIntent(wmHelper: WindowManagerStateHelper) =
|
||||
launchViaIntentAndWaitShown(wmHelper)
|
||||
|
||||
@@ -81,9 +81,7 @@ open class PipAppHelper(instrumentation: Instrumentation) : StandardAppHelper(
|
||||
clickObject(ENTER_PIP_BUTTON_ID)
|
||||
|
||||
// Wait on WMHelper or simply wait for 3 seconds
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withPipShown()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withPipShown().waitForAndVerify()
|
||||
// when entering pip, the dismiss button is visible at the start. to ensure the pip
|
||||
// animation is complete, wait until the pip dismiss button is no longer visible.
|
||||
// b/176822698: dismiss-only state will be removed in the future
|
||||
@@ -102,17 +100,18 @@ open class PipAppHelper(instrumentation: Instrumentation) : StandardAppHelper(
|
||||
clickObject(MEDIA_SESSION_START_RADIO_BUTTON_ID)
|
||||
}
|
||||
|
||||
fun checkWithCustomActionsCheckbox() = uiDevice
|
||||
.findObject(By.res(`package`, WITH_CUSTOM_ACTIONS_BUTTON_ID))
|
||||
?.takeIf { it.isCheckable }
|
||||
?.apply { if (!isChecked) clickObject(WITH_CUSTOM_ACTIONS_BUTTON_ID) }
|
||||
?: error("'With custom actions' checkbox not found")
|
||||
fun checkWithCustomActionsCheckbox() =
|
||||
uiDevice
|
||||
.findObject(By.res(`package`, WITH_CUSTOM_ACTIONS_BUTTON_ID))
|
||||
?.takeIf { it.isCheckable }
|
||||
?.apply { if (!isChecked) clickObject(WITH_CUSTOM_ACTIONS_BUTTON_ID) }
|
||||
?: error("'With custom actions' checkbox not found")
|
||||
|
||||
fun pauseMedia() = mediaController?.transportControls?.pause()
|
||||
?: error("No active media session found")
|
||||
fun pauseMedia() =
|
||||
mediaController?.transportControls?.pause() ?: error("No active media session found")
|
||||
|
||||
fun stopMedia() = mediaController?.transportControls?.stop()
|
||||
?: error("No active media session found")
|
||||
fun stopMedia() =
|
||||
mediaController?.transportControls?.stop() ?: error("No active media session found")
|
||||
|
||||
@Deprecated(
|
||||
"Use PipAppHelper.closePipWindow(wmHelper) instead",
|
||||
@@ -124,55 +123,41 @@ open class PipAppHelper(instrumentation: Instrumentation) : StandardAppHelper(
|
||||
|
||||
private fun getWindowRect(wmHelper: WindowManagerStateHelper): Rect {
|
||||
val windowRegion = wmHelper.getWindowRegion(this)
|
||||
require(!windowRegion.isEmpty) {
|
||||
"Unable to find a PIP window in the current state"
|
||||
}
|
||||
require(!windowRegion.isEmpty) { "Unable to find a PIP window in the current state" }
|
||||
return windowRegion.bounds
|
||||
}
|
||||
|
||||
/**
|
||||
* Taps the pip window and dismisses it by clicking on the X button.
|
||||
*/
|
||||
/** Taps the pip window and dismisses it by clicking on the X button. */
|
||||
open fun closePipWindow(wmHelper: WindowManagerStateHelper) {
|
||||
val windowRect = getWindowRect(wmHelper)
|
||||
uiDevice.click(windowRect.centerX(), windowRect.centerY())
|
||||
// search and interact with the dismiss button
|
||||
val dismissSelector = By.res(SYSTEMUI_PACKAGE, "dismiss")
|
||||
uiDevice.wait(Until.hasObject(dismissSelector), FIND_TIMEOUT)
|
||||
val dismissPipObject = uiDevice.findObject(dismissSelector)
|
||||
?: error("PIP window dismiss button not found")
|
||||
val dismissPipObject =
|
||||
uiDevice.findObject(dismissSelector) ?: error("PIP window dismiss button not found")
|
||||
val dismissButtonBounds = dismissPipObject.visibleBounds
|
||||
uiDevice.click(dismissButtonBounds.centerX(), dismissButtonBounds.centerY())
|
||||
|
||||
// Wait for animation to complete.
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withPipGone()
|
||||
.withHomeActivityVisible()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withPipGone().withHomeActivityVisible().waitForAndVerify()
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the pip window by pressing the expand button
|
||||
*/
|
||||
/** Close the pip window by pressing the expand button */
|
||||
fun expandPipWindowToApp(wmHelper: WindowManagerStateHelper) {
|
||||
val windowRect = getWindowRect(wmHelper)
|
||||
uiDevice.click(windowRect.centerX(), windowRect.centerY())
|
||||
// search and interact with the expand button
|
||||
val expandSelector = By.res(SYSTEMUI_PACKAGE, "expand_button")
|
||||
uiDevice.wait(Until.hasObject(expandSelector), FIND_TIMEOUT)
|
||||
val expandPipObject = uiDevice.findObject(expandSelector)
|
||||
?: error("PIP window expand button not found")
|
||||
val expandPipObject =
|
||||
uiDevice.findObject(expandSelector) ?: error("PIP window expand button not found")
|
||||
val expandButtonBounds = expandPipObject.visibleBounds
|
||||
uiDevice.click(expandButtonBounds.centerX(), expandButtonBounds.centerY())
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withPipGone()
|
||||
.withFullScreenApp(this)
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withPipGone().withFullScreenApp(this).waitForAndVerify()
|
||||
}
|
||||
|
||||
/**
|
||||
* Double click on the PIP window to expand it
|
||||
*/
|
||||
/** Double click on the PIP window to expand it */
|
||||
fun doubleClickPipWindow(wmHelper: WindowManagerStateHelper) {
|
||||
val windowRect = getWindowRect(wmHelper)
|
||||
Log.d(TAG, "First click")
|
||||
@@ -180,9 +165,7 @@ open class PipAppHelper(instrumentation: Instrumentation) : StandardAppHelper(
|
||||
Log.d(TAG, "Second click")
|
||||
uiDevice.click(windowRect.centerX(), windowRect.centerY())
|
||||
Log.d(TAG, "Wait for app transition to end")
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withAppTransitionIdle()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withAppTransitionIdle().waitForAndVerify()
|
||||
waitForPipWindowToExpandFrom(wmHelper, Region.from(windowRect))
|
||||
}
|
||||
|
||||
@@ -190,13 +173,18 @@ open class PipAppHelper(instrumentation: Instrumentation) : StandardAppHelper(
|
||||
wmHelper: WindowManagerStateHelper,
|
||||
windowRect: Region
|
||||
) {
|
||||
wmHelper.StateSyncBuilder().add("pipWindowExpanded") {
|
||||
val pipAppWindow = it.wmState.visibleWindows.firstOrNull { window ->
|
||||
this.windowMatchesAnyOf(window)
|
||||
} ?: return@add false
|
||||
val pipRegion = pipAppWindow.frameRegion
|
||||
return@add pipRegion.coversMoreThan(windowRect)
|
||||
}.waitForAndVerify()
|
||||
wmHelper
|
||||
.StateSyncBuilder()
|
||||
.add("pipWindowExpanded") {
|
||||
val pipAppWindow =
|
||||
it.wmState.visibleWindows.firstOrNull { window ->
|
||||
this.windowMatchesAnyOf(window)
|
||||
}
|
||||
?: return@add false
|
||||
val pipRegion = pipAppWindow.frameRegion
|
||||
return@add pipRegion.coversMoreThan(windowRect)
|
||||
}
|
||||
.waitForAndVerify()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -23,7 +23,9 @@ import com.android.server.wm.flicker.testapp.ActivityOptions
|
||||
import com.android.server.wm.traces.common.ComponentNameMatcher
|
||||
import com.android.server.wm.traces.parser.toFlickerComponent
|
||||
|
||||
class SeamlessRotationAppHelper @JvmOverloads constructor(
|
||||
class SeamlessRotationAppHelper
|
||||
@JvmOverloads
|
||||
constructor(
|
||||
instr: Instrumentation,
|
||||
launcherName: String = ActivityOptions.SeamlessRotation.LABEL,
|
||||
component: ComponentNameMatcher =
|
||||
|
||||
@@ -23,7 +23,9 @@ import com.android.server.wm.flicker.testapp.ActivityOptions
|
||||
import com.android.server.wm.traces.common.ComponentNameMatcher
|
||||
import com.android.server.wm.traces.parser.toFlickerComponent
|
||||
|
||||
class ShowWhenLockedAppHelper @JvmOverloads constructor(
|
||||
class ShowWhenLockedAppHelper
|
||||
@JvmOverloads
|
||||
constructor(
|
||||
instr: Instrumentation,
|
||||
launcherName: String = ActivityOptions.ShowWhenLockedActivity.LABEL,
|
||||
component: ComponentNameMatcher =
|
||||
|
||||
@@ -23,11 +23,12 @@ import com.android.server.wm.flicker.testapp.ActivityOptions
|
||||
import com.android.server.wm.traces.common.ComponentNameMatcher
|
||||
import com.android.server.wm.traces.parser.toFlickerComponent
|
||||
|
||||
class SimpleAppHelper @JvmOverloads constructor(
|
||||
class SimpleAppHelper
|
||||
@JvmOverloads
|
||||
constructor(
|
||||
instr: Instrumentation,
|
||||
launcherName: String = ActivityOptions.SimpleActivity.LABEL,
|
||||
component: ComponentNameMatcher =
|
||||
ActivityOptions.SimpleActivity.COMPONENT.toFlickerComponent(),
|
||||
component: ComponentNameMatcher = ActivityOptions.SimpleActivity.COMPONENT.toFlickerComponent(),
|
||||
launcherStrategy: ILauncherStrategy =
|
||||
LauncherStrategyFactory.getInstance(instr).launcherStrategy
|
||||
) : StandardAppHelper(instr, launcherName, component, launcherStrategy)
|
||||
|
||||
@@ -27,7 +27,9 @@ import com.android.server.wm.traces.common.ComponentNameMatcher
|
||||
import com.android.server.wm.traces.parser.toFlickerComponent
|
||||
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
|
||||
|
||||
class TwoActivitiesAppHelper @JvmOverloads constructor(
|
||||
class TwoActivitiesAppHelper
|
||||
@JvmOverloads
|
||||
constructor(
|
||||
instr: Instrumentation,
|
||||
launcherName: String = ActivityOptions.LaunchNewActivity.LABEL,
|
||||
component: ComponentNameMatcher =
|
||||
@@ -50,9 +52,7 @@ class TwoActivitiesAppHelper @JvmOverloads constructor(
|
||||
button.click()
|
||||
|
||||
device.wait(Until.gone(launchActivityButton), FIND_TIMEOUT)
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withFullScreenApp(secondActivityComponent)
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withFullScreenApp(secondActivityComponent).waitForAndVerify()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -37,10 +37,10 @@ import org.junit.runners.Parameterized
|
||||
* Test IME window closing back to app window transitions.
|
||||
*
|
||||
* This test doesn't work on 90 degrees. According to the InputMethodService documentation:
|
||||
*
|
||||
* ```
|
||||
* Don't show if this is not explicitly requested by the user and the input method
|
||||
* is fullscreen. That would be too disruptive.
|
||||
*
|
||||
* ```
|
||||
* More details on b/190352379
|
||||
*
|
||||
* To run this test: `atest FlickerTests:CloseImeAutoOpenWindowToAppTest`
|
||||
@@ -54,51 +54,35 @@ class CloseImeAutoOpenWindowToAppTest(testSpec: FlickerTestParameter) : BaseTest
|
||||
|
||||
/** {@inheritDoc} */
|
||||
override val transition: FlickerBuilder.() -> Unit = {
|
||||
setup {
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
}
|
||||
teardown {
|
||||
testApp.exit(wmHelper)
|
||||
}
|
||||
transitions {
|
||||
testApp.closeIME(wmHelper)
|
||||
}
|
||||
setup { testApp.launchViaIntent(wmHelper) }
|
||||
teardown { testApp.exit(wmHelper) }
|
||||
transitions { testApp.closeIME(wmHelper) }
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeAppWindowIsAlwaysVisible() {
|
||||
testSpec.assertWm {
|
||||
this.isAppWindowOnTop(testApp)
|
||||
}
|
||||
testSpec.assertWm { this.isAppWindowOnTop(testApp) }
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeLayerVisibleStart() {
|
||||
testSpec.assertLayersStart {
|
||||
this.isVisible(ComponentNameMatcher.IME)
|
||||
}
|
||||
testSpec.assertLayersStart { this.isVisible(ComponentNameMatcher.IME) }
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeLayerInvisibleEnd() {
|
||||
testSpec.assertLayersEnd {
|
||||
this.isInvisible(ComponentNameMatcher.IME)
|
||||
}
|
||||
testSpec.assertLayersEnd { this.isInvisible(ComponentNameMatcher.IME) }
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeLayerBecomesInvisible() = testSpec.imeLayerBecomesInvisible()
|
||||
@Presubmit @Test fun imeLayerBecomesInvisible() = testSpec.imeLayerBecomesInvisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeAppLayerIsAlwaysVisible() {
|
||||
testSpec.assertLayers {
|
||||
this.isVisible(testApp)
|
||||
}
|
||||
testSpec.assertLayers { this.isVisible(testApp) }
|
||||
}
|
||||
|
||||
companion object {
|
||||
@@ -107,12 +91,13 @@ class CloseImeAutoOpenWindowToAppTest(testSpec: FlickerTestParameter) : BaseTest
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(
|
||||
// b/190352379 (IME doesn't show on app launch in 90 degrees)
|
||||
// b/190352379 (IME doesn't show on app launch in 90 degrees)
|
||||
supportedRotations = listOf(Surface.ROTATION_0),
|
||||
supportedNavigationModes = listOf(
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
|
||||
)
|
||||
supportedNavigationModes =
|
||||
listOf(
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,10 +37,10 @@ import org.junit.runners.Parameterized
|
||||
* Test IME window closing back to app window transitions.
|
||||
*
|
||||
* This test doesn't work on 90 degrees. According to the InputMethodService documentation:
|
||||
*
|
||||
* ```
|
||||
* Don't show if this is not explicitly requested by the user and the input method
|
||||
* is fullscreen. That would be too disruptive.
|
||||
*
|
||||
* ```
|
||||
* More details on b/190352379
|
||||
*
|
||||
* To run this test: `atest FlickerTests:CloseImeAutoOpenWindowToHomeTest`
|
||||
@@ -58,56 +58,37 @@ class CloseImeAutoOpenWindowToHomeTest(testSpec: FlickerTestParameter) : BaseTes
|
||||
tapl.setExpectedRotationCheckEnabled(false)
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
}
|
||||
teardown {
|
||||
testApp.exit(wmHelper)
|
||||
}
|
||||
teardown { testApp.exit(wmHelper) }
|
||||
transitions {
|
||||
tapl.goHome()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withHomeActivityVisible()
|
||||
.withImeGone()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withHomeActivityVisible().withImeGone().waitForAndVerify()
|
||||
}
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeAppWindowBecomesInvisible() {
|
||||
testSpec.assertWm {
|
||||
this.isAppWindowOnTop(testApp)
|
||||
.then()
|
||||
.isAppWindowNotOnTop(testApp)
|
||||
}
|
||||
testSpec.assertWm { this.isAppWindowOnTop(testApp).then().isAppWindowNotOnTop(testApp) }
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeLayerVisibleStart() {
|
||||
testSpec.assertLayersStart {
|
||||
this.isVisible(ComponentNameMatcher.IME)
|
||||
}
|
||||
testSpec.assertLayersStart { this.isVisible(ComponentNameMatcher.IME) }
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeLayerInvisibleEnd() {
|
||||
testSpec.assertLayersEnd {
|
||||
this.isInvisible(ComponentNameMatcher.IME)
|
||||
}
|
||||
testSpec.assertLayersEnd { this.isInvisible(ComponentNameMatcher.IME) }
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeLayerBecomesInvisible() = testSpec.imeLayerBecomesInvisible()
|
||||
@Presubmit @Test fun imeLayerBecomesInvisible() = testSpec.imeLayerBecomesInvisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeAppLayerBecomesInvisible() {
|
||||
testSpec.assertLayers {
|
||||
this.isVisible(testApp)
|
||||
.then()
|
||||
.isInvisible(testApp)
|
||||
}
|
||||
testSpec.assertLayers { this.isVisible(testApp).then().isInvisible(testApp) }
|
||||
}
|
||||
|
||||
companion object {
|
||||
@@ -118,9 +99,11 @@ class CloseImeAutoOpenWindowToHomeTest(testSpec: FlickerTestParameter) : BaseTes
|
||||
.getConfigNonRotationTests(
|
||||
// b/190352379 (IME doesn't show on app launch in 90 degrees)
|
||||
supportedRotations = listOf(Surface.ROTATION_0),
|
||||
supportedNavigationModes = listOf(
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY)
|
||||
supportedNavigationModes =
|
||||
listOf(
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,15 +50,11 @@ class CloseImeEditorPopupDialogTest(testSpec: FlickerTestParameter) : BaseTest(t
|
||||
}
|
||||
transitions {
|
||||
imeTestApp.dismissDialog(wmHelper)
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withImeGone()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withImeGone().waitForAndVerify()
|
||||
}
|
||||
teardown {
|
||||
tapl.goHome()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withHomeActivityVisible()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withHomeActivityVisible().waitForAndVerify()
|
||||
imeTestApp.exit(wmHelper)
|
||||
}
|
||||
}
|
||||
@@ -71,8 +67,7 @@ class CloseImeEditorPopupDialogTest(testSpec: FlickerTestParameter) : BaseTest(t
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() =
|
||||
super.taskBarLayerIsVisibleAtStartAndEnd()
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() = super.taskBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@@ -86,9 +81,7 @@ class CloseImeEditorPopupDialogTest(testSpec: FlickerTestParameter) : BaseTest(t
|
||||
override fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
|
||||
super.visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun imeWindowBecameInvisible() = testSpec.imeWindowBecomesInvisible()
|
||||
@Postsubmit @Test fun imeWindowBecameInvisible() = testSpec.imeWindowBecomesInvisible()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
@@ -108,15 +101,18 @@ class CloseImeEditorPopupDialogTest(testSpec: FlickerTestParameter) : BaseTest(t
|
||||
fun imeSnapshotAssociatedOnAppVisibleRegion() {
|
||||
testSpec.assertLayers {
|
||||
this.invoke("imeSnapshotAssociatedOnAppVisibleRegion") {
|
||||
val imeSnapshotLayers = it.subjects.filter { subject ->
|
||||
subject.name.contains(
|
||||
ComponentNameMatcher.IME_SNAPSHOT.toLayerName()
|
||||
) && subject.isVisible
|
||||
}
|
||||
val imeSnapshotLayers =
|
||||
it.subjects.filter { subject ->
|
||||
subject.name.contains(ComponentNameMatcher.IME_SNAPSHOT.toLayerName()) &&
|
||||
subject.isVisible
|
||||
}
|
||||
if (imeSnapshotLayers.isNotEmpty()) {
|
||||
val visibleAreas = imeSnapshotLayers.mapNotNull { imeSnapshotLayer ->
|
||||
imeSnapshotLayer.layer?.visibleRegion
|
||||
}.toTypedArray()
|
||||
val visibleAreas =
|
||||
imeSnapshotLayers
|
||||
.mapNotNull { imeSnapshotLayer ->
|
||||
imeSnapshotLayer.layer?.visibleRegion
|
||||
}
|
||||
.toTypedArray()
|
||||
val imeVisibleRegion = RegionSubject.assertThat(visibleAreas, this, timestamp)
|
||||
val appVisibleRegion = it.visibleRegion(imeTestApp)
|
||||
if (imeVisibleRegion.region.isNotEmpty) {
|
||||
@@ -133,10 +129,11 @@ class CloseImeEditorPopupDialogTest(testSpec: FlickerTestParameter) : BaseTest(t
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(
|
||||
supportedNavigationModes = listOf(
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
|
||||
),
|
||||
supportedNavigationModes =
|
||||
listOf(
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
|
||||
),
|
||||
supportedRotations = listOf(Surface.ROTATION_0)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@ import org.junit.runners.MethodSorters
|
||||
import org.junit.runners.Parameterized
|
||||
|
||||
/**
|
||||
* Test IME window closing back to app window transitions.
|
||||
* To run this test: `atest FlickerTests:CloseImeWindowToAppTest`
|
||||
* Test IME window closing back to app window transitions. To run this test: `atest
|
||||
* FlickerTests:CloseImeWindowToAppTest`
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@@ -51,12 +51,8 @@ class CloseImeWindowToAppTest(testSpec: FlickerTestParameter) : BaseTest(testSpe
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
testApp.openIME(wmHelper)
|
||||
}
|
||||
teardown {
|
||||
testApp.exit(wmHelper)
|
||||
}
|
||||
transitions {
|
||||
testApp.closeIME(wmHelper)
|
||||
}
|
||||
teardown { testApp.exit(wmHelper) }
|
||||
transitions { testApp.closeIME(wmHelper) }
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@@ -64,10 +60,13 @@ class CloseImeWindowToAppTest(testSpec: FlickerTestParameter) : BaseTest(testSpe
|
||||
@Test
|
||||
override fun visibleWindowsShownMoreThanOneConsecutiveEntry() {
|
||||
testSpec.assertWm {
|
||||
this.visibleWindowsShownMoreThanOneConsecutiveEntry(listOf(
|
||||
ComponentNameMatcher.IME,
|
||||
ComponentNameMatcher.SPLASH_SCREEN,
|
||||
ComponentNameMatcher.SNAPSHOT))
|
||||
this.visibleWindowsShownMoreThanOneConsecutiveEntry(
|
||||
listOf(
|
||||
ComponentNameMatcher.IME,
|
||||
ComponentNameMatcher.SPLASH_SCREEN,
|
||||
ComponentNameMatcher.SNAPSHOT
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,32 +87,25 @@ class CloseImeWindowToAppTest(testSpec: FlickerTestParameter) : BaseTest(testSpe
|
||||
testSpec.navBarLayerPositionAtStartAndEnd()
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeLayerBecomesInvisible() = testSpec.imeLayerBecomesInvisible()
|
||||
@Presubmit @Test fun imeLayerBecomesInvisible() = testSpec.imeLayerBecomesInvisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeAppLayerIsAlwaysVisible() {
|
||||
testSpec.assertLayers {
|
||||
this.isVisible(testApp)
|
||||
}
|
||||
testSpec.assertLayers { this.isVisible(testApp) }
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeAppWindowIsAlwaysVisible() {
|
||||
testSpec.assertWm {
|
||||
this.isAppWindowOnTop(testApp)
|
||||
}
|
||||
testSpec.assertWm { this.isAppWindowOnTop(testApp) }
|
||||
}
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests()
|
||||
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,8 +34,8 @@ import org.junit.runners.MethodSorters
|
||||
import org.junit.runners.Parameterized
|
||||
|
||||
/**
|
||||
* Test IME window closing to home transitions.
|
||||
* To run this test: `atest FlickerTests:CloseImeWindowToHomeTest`
|
||||
* Test IME window closing to home transitions. To run this test: `atest
|
||||
* FlickerTests:CloseImeWindowToHomeTest`
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@@ -53,14 +53,9 @@ class CloseImeWindowToHomeTest(testSpec: FlickerTestParameter) : BaseTest(testSp
|
||||
}
|
||||
transitions {
|
||||
tapl.goHome()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withHomeActivityVisible()
|
||||
.withImeGone()
|
||||
.waitForAndVerify()
|
||||
}
|
||||
teardown {
|
||||
testApp.exit(wmHelper)
|
||||
wmHelper.StateSyncBuilder().withHomeActivityVisible().withImeGone().waitForAndVerify()
|
||||
}
|
||||
teardown { testApp.exit(wmHelper) }
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@@ -84,40 +79,25 @@ class CloseImeWindowToHomeTest(testSpec: FlickerTestParameter) : BaseTest(testSp
|
||||
override fun visibleLayersShownMoreThanOneConsecutiveEntry() {
|
||||
testSpec.assertLayers {
|
||||
this.visibleLayersShownMoreThanOneConsecutiveEntry(
|
||||
listOf(
|
||||
ComponentNameMatcher.IME,
|
||||
ComponentNameMatcher.SPLASH_SCREEN
|
||||
)
|
||||
listOf(ComponentNameMatcher.IME, ComponentNameMatcher.SPLASH_SCREEN)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeLayerBecomesInvisible() = testSpec.imeLayerBecomesInvisible()
|
||||
@Presubmit @Test fun imeLayerBecomesInvisible() = testSpec.imeLayerBecomesInvisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeWindowBecomesInvisible() = testSpec.imeWindowBecomesInvisible()
|
||||
@Presubmit @Test fun imeWindowBecomesInvisible() = testSpec.imeWindowBecomesInvisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeAppWindowBecomesInvisible() {
|
||||
testSpec.assertWm {
|
||||
this.isAppWindowVisible(testApp)
|
||||
.then()
|
||||
.isAppWindowInvisible(testApp)
|
||||
}
|
||||
testSpec.assertWm { this.isAppWindowVisible(testApp).then().isAppWindowInvisible(testApp) }
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeAppLayerBecomesInvisible() {
|
||||
testSpec.assertLayers {
|
||||
this.isVisible(testApp)
|
||||
.then()
|
||||
.isInvisible(testApp)
|
||||
}
|
||||
testSpec.assertLayers { this.isVisible(testApp).then().isInvisible(testApp) }
|
||||
}
|
||||
|
||||
companion object {
|
||||
@@ -126,11 +106,12 @@ class CloseImeWindowToHomeTest(testSpec: FlickerTestParameter) : BaseTest(testSp
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(
|
||||
supportedRotations = listOf(Surface.ROTATION_0),
|
||||
supportedNavigationModes = listOf(
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
|
||||
)
|
||||
supportedRotations = listOf(Surface.ROTATION_0),
|
||||
supportedNavigationModes =
|
||||
listOf(
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
@file:JvmName("CommonAssertions")
|
||||
|
||||
package com.android.server.wm.flicker.ime
|
||||
|
||||
import com.android.server.wm.flicker.FlickerTestParameter
|
||||
@@ -22,17 +23,13 @@ import com.android.server.wm.traces.common.ComponentNameMatcher
|
||||
|
||||
fun FlickerTestParameter.imeLayerBecomesVisible() {
|
||||
assertLayers {
|
||||
this.isInvisible(ComponentNameMatcher.IME)
|
||||
.then()
|
||||
.isVisible(ComponentNameMatcher.IME)
|
||||
this.isInvisible(ComponentNameMatcher.IME).then().isVisible(ComponentNameMatcher.IME)
|
||||
}
|
||||
}
|
||||
|
||||
fun FlickerTestParameter.imeLayerBecomesInvisible() {
|
||||
assertLayers {
|
||||
this.isVisible(ComponentNameMatcher.IME)
|
||||
.then()
|
||||
.isInvisible(ComponentNameMatcher.IME)
|
||||
this.isVisible(ComponentNameMatcher.IME).then().isInvisible(ComponentNameMatcher.IME)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,9 +43,7 @@ fun FlickerTestParameter.imeWindowIsAlwaysVisible(rotatesScreen: Boolean = false
|
||||
.isNonAppWindowVisible(ComponentNameMatcher.IME)
|
||||
}
|
||||
} else {
|
||||
assertWm {
|
||||
this.isNonAppWindowVisible(ComponentNameMatcher.IME)
|
||||
}
|
||||
assertWm { this.isNonAppWindowVisible(ComponentNameMatcher.IME) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,30 +47,22 @@ import org.junit.runners.Parameterized
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
class LaunchAppShowImeAndDialogThemeAppTest(
|
||||
testSpec: FlickerTestParameter
|
||||
) : BaseTest(testSpec) {
|
||||
class LaunchAppShowImeAndDialogThemeAppTest(testSpec: FlickerTestParameter) : BaseTest(testSpec) {
|
||||
private val testApp = ImeAppAutoFocusHelper(instrumentation, testSpec.startRotation)
|
||||
|
||||
/** {@inheritDoc} */
|
||||
override val transition: FlickerBuilder.() -> Unit = {
|
||||
setup {
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withImeShown()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withImeShown().waitForAndVerify()
|
||||
testApp.startDialogThemedActivity(wmHelper)
|
||||
// Verify IME insets isn't visible on dialog since it's non-IME focusable window
|
||||
assertFalse(testApp.getInsetsVisibleFromDialog(ime()))
|
||||
assertTrue(testApp.getInsetsVisibleFromDialog(statusBars()))
|
||||
assertTrue(testApp.getInsetsVisibleFromDialog(navigationBars()))
|
||||
}
|
||||
teardown {
|
||||
testApp.exit(wmHelper)
|
||||
}
|
||||
transitions {
|
||||
testApp.dismissDialog(wmHelper)
|
||||
}
|
||||
teardown { testApp.exit(wmHelper) }
|
||||
transitions { testApp.dismissDialog(wmHelper) }
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@@ -83,41 +75,29 @@ class LaunchAppShowImeAndDialogThemeAppTest(
|
||||
@Test
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() = super.taskBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
/**
|
||||
* Checks that [ComponentMatcher.IME] layer becomes visible during the transition
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeWindowIsAlwaysVisible() = testSpec.imeWindowIsAlwaysVisible()
|
||||
/** Checks that [ComponentMatcher.IME] layer becomes visible during the transition */
|
||||
@Presubmit @Test fun imeWindowIsAlwaysVisible() = testSpec.imeWindowIsAlwaysVisible()
|
||||
|
||||
/**
|
||||
* Checks that [ComponentMatcher.IME] layer is visible at the end of the transition
|
||||
*/
|
||||
/** Checks that [ComponentMatcher.IME] layer is visible at the end of the transition */
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeLayerExistsEnd() {
|
||||
testSpec.assertLayersEnd {
|
||||
this.isVisible(ComponentNameMatcher.IME)
|
||||
}
|
||||
testSpec.assertLayersEnd { this.isVisible(ComponentNameMatcher.IME) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [ComponentMatcher.IME_SNAPSHOT] layer is invisible always.
|
||||
*/
|
||||
/** Checks that [ComponentMatcher.IME_SNAPSHOT] layer is invisible always. */
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeSnapshotNotVisible() {
|
||||
testSpec.assertLayers {
|
||||
this.isInvisible(ComponentNameMatcher.IME_SNAPSHOT)
|
||||
}
|
||||
testSpec.assertLayers { this.isInvisible(ComponentNameMatcher.IME_SNAPSHOT) }
|
||||
}
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* Creates the test configurations.
|
||||
*
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
|
||||
* repetitions, screen orientation and navigation modes.
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring repetitions,
|
||||
* screen orientation and navigation modes.
|
||||
*/
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
@@ -125,10 +105,11 @@ class LaunchAppShowImeAndDialogThemeAppTest(
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(
|
||||
supportedRotations = listOf(Surface.ROTATION_0),
|
||||
supportedNavigationModes = listOf(
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
|
||||
)
|
||||
supportedNavigationModes =
|
||||
listOf(
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,27 +41,33 @@ import org.junit.runners.Parameterized
|
||||
* To run this test: `atest FlickerTests:LaunchAppShowImeOnStartTest`
|
||||
*
|
||||
* Actions:
|
||||
* ```
|
||||
* Make sure no apps are running on the device
|
||||
* Launch an app [testApp] that automatically displays IME and wait animation to complete
|
||||
*
|
||||
* ```
|
||||
* To run only the presubmit assertions add: `--
|
||||
* ```
|
||||
* --module-arg FlickerTests:exclude-annotation:androidx.test.filters.FlakyTest
|
||||
* --module-arg FlickerTests:include-annotation:android.platform.test.annotations.Presubmit`
|
||||
*
|
||||
* ```
|
||||
* To run only the postsubmit assertions add: `--
|
||||
* ```
|
||||
* --module-arg FlickerTests:exclude-annotation:androidx.test.filters.FlakyTest
|
||||
* --module-arg FlickerTests:include-annotation:android.platform.test.annotations.Postsubmit`
|
||||
*
|
||||
* ```
|
||||
* To run only the flaky assertions add: `--
|
||||
* ```
|
||||
* --module-arg FlickerTests:include-annotation:androidx.test.filters.FlakyTest`
|
||||
*
|
||||
* ```
|
||||
* Notes:
|
||||
* ```
|
||||
* 1. Some default assertions (e.g., nav bar, status bar and screen covered)
|
||||
* are inherited [CloseAppTransition]
|
||||
* 2. Part of the test setup occurs automatically via
|
||||
* [com.android.server.wm.flicker.TransitionRunnerWithRules],
|
||||
* including configuring navigation mode, initial orientation and ensuring no
|
||||
* apps are running before setup
|
||||
* ```
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@@ -83,65 +89,48 @@ class LaunchAppShowImeOnStartTest(testSpec: FlickerTestParameter) : BaseTest(tes
|
||||
}
|
||||
transitions {
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withImeShown()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withImeShown().waitForAndVerify()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [ComponentMatcher.IME] window becomes visible during the transition
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeWindowBecomesVisible() = testSpec.imeWindowBecomesVisible()
|
||||
/** Checks that [ComponentMatcher.IME] window becomes visible during the transition */
|
||||
@Presubmit @Test fun imeWindowBecomesVisible() = testSpec.imeWindowBecomesVisible()
|
||||
|
||||
/**
|
||||
* Checks that [ComponentMatcher.IME] layer becomes visible during the transition
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeLayerBecomesVisible() = testSpec.imeLayerBecomesVisible()
|
||||
/** Checks that [ComponentMatcher.IME] layer becomes visible during the transition */
|
||||
@Presubmit @Test fun imeLayerBecomesVisible() = testSpec.imeLayerBecomesVisible()
|
||||
|
||||
/**
|
||||
* Checks that [ComponentMatcher.IME] layer is invisible at the start of the transition
|
||||
*/
|
||||
/** Checks that [ComponentMatcher.IME] layer is invisible at the start of the transition */
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeLayerNotExistsStart() {
|
||||
testSpec.assertLayersStart {
|
||||
this.isInvisible(ComponentNameMatcher.IME)
|
||||
}
|
||||
testSpec.assertLayersStart { this.isInvisible(ComponentNameMatcher.IME) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [ComponentMatcher.IME] layer is visible at the end of the transition
|
||||
*/
|
||||
/** Checks that [ComponentMatcher.IME] layer is visible at the end of the transition */
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeLayerExistsEnd() {
|
||||
testSpec.assertLayersEnd {
|
||||
this.isVisible(ComponentNameMatcher.IME)
|
||||
}
|
||||
testSpec.assertLayersEnd { this.isVisible(ComponentNameMatcher.IME) }
|
||||
}
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* Creates the test configurations.
|
||||
*
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
|
||||
* repetitions, screen orientation and navigation modes.
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring repetitions,
|
||||
* screen orientation and navigation modes.
|
||||
*/
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(
|
||||
supportedRotations = listOf(Surface.ROTATION_0),
|
||||
supportedNavigationModes = listOf(
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
|
||||
)
|
||||
supportedRotations = listOf(Surface.ROTATION_0),
|
||||
supportedNavigationModes =
|
||||
listOf(
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,21 +57,13 @@ class OpenImeWindowAndCloseTest(testSpec: FlickerTestParameter) : BaseTest(testS
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
testApp.openIME(wmHelper)
|
||||
}
|
||||
transitions {
|
||||
testApp.finishActivity(wmHelper)
|
||||
}
|
||||
teardown {
|
||||
simpleApp.exit(wmHelper)
|
||||
}
|
||||
transitions { testApp.finishActivity(wmHelper) }
|
||||
teardown { simpleApp.exit(wmHelper) }
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeWindowBecomesInvisible() = testSpec.imeWindowBecomesInvisible()
|
||||
@Presubmit @Test fun imeWindowBecomesInvisible() = testSpec.imeWindowBecomesInvisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeLayerBecomesInvisible() = testSpec.imeLayerBecomesInvisible()
|
||||
@Presubmit @Test fun imeLayerBecomesInvisible() = testSpec.imeLayerBecomesInvisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
@@ -93,11 +85,12 @@ class OpenImeWindowAndCloseTest(testSpec: FlickerTestParameter) : BaseTest(testS
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(
|
||||
supportedRotations = listOf(Surface.ROTATION_0),
|
||||
supportedNavigationModes = listOf(
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
|
||||
)
|
||||
supportedRotations = listOf(Surface.ROTATION_0),
|
||||
supportedNavigationModes =
|
||||
listOf(
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,16 +37,15 @@ import org.junit.runners.Parameterized
|
||||
|
||||
/**
|
||||
* Test IME window layer will become visible when switching from the fixed orientation activity
|
||||
* (e.g. Launcher activity).
|
||||
* To run this test: `atest FlickerTests:OpenImeWindowFromFixedOrientationAppTest`
|
||||
* (e.g. Launcher activity). To run this test: `atest
|
||||
* FlickerTests:OpenImeWindowFromFixedOrientationAppTest`
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
class OpenImeWindowFromFixedOrientationAppTest(
|
||||
testSpec: FlickerTestParameter
|
||||
) : BaseTest(testSpec) {
|
||||
class OpenImeWindowFromFixedOrientationAppTest(testSpec: FlickerTestParameter) :
|
||||
BaseTest(testSpec) {
|
||||
private val imeTestApp = ImeAppAutoFocusHelper(instrumentation, testSpec.startRotation)
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@@ -59,18 +58,14 @@ class OpenImeWindowFromFixedOrientationAppTest(
|
||||
|
||||
// Swiping out the IME activity to home.
|
||||
tapl.goHome()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withHomeActivityVisible()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withHomeActivityVisible().waitForAndVerify()
|
||||
}
|
||||
transitions {
|
||||
// Bring the exist IME activity to the front in landscape mode device rotation.
|
||||
setRotation(Surface.ROTATION_90)
|
||||
imeTestApp.launchViaIntent(wmHelper)
|
||||
}
|
||||
teardown {
|
||||
imeTestApp.exit(wmHelper)
|
||||
}
|
||||
teardown { imeTestApp.exit(wmHelper) }
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@@ -83,13 +78,9 @@ class OpenImeWindowFromFixedOrientationAppTest(
|
||||
@Test
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() = super.taskBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeWindowBecomesVisible() = testSpec.imeWindowBecomesVisible()
|
||||
@Presubmit @Test fun imeWindowBecomesVisible() = testSpec.imeWindowBecomesVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeLayerBecomesVisible() = testSpec.imeLayerBecomesVisible()
|
||||
@Presubmit @Test fun imeLayerBecomesVisible() = testSpec.imeLayerBecomesVisible()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
@@ -101,18 +92,17 @@ class OpenImeWindowFromFixedOrientationAppTest(
|
||||
/**
|
||||
* Creates the test configurations.
|
||||
*
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
|
||||
* repetitions, screen orientation and navigation modes.
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring repetitions,
|
||||
* screen orientation and navigation modes.
|
||||
*/
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(
|
||||
supportedRotations = listOf(Surface.ROTATION_90),
|
||||
supportedNavigationModes = listOf(
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
|
||||
)
|
||||
supportedRotations = listOf(Surface.ROTATION_90),
|
||||
supportedNavigationModes =
|
||||
listOf(WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,10 +32,7 @@ import org.junit.runner.RunWith
|
||||
import org.junit.runners.MethodSorters
|
||||
import org.junit.runners.Parameterized
|
||||
|
||||
/**
|
||||
* Test IME window opening transitions.
|
||||
* To run this test: `atest FlickerTests:OpenImeWindowTest`
|
||||
*/
|
||||
/** Test IME window opening transitions. To run this test: `atest FlickerTests:OpenImeWindowTest` */
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@@ -45,40 +42,28 @@ class OpenImeWindowTest(testSpec: FlickerTestParameter) : BaseTest(testSpec) {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
override val transition: FlickerBuilder.() -> Unit = {
|
||||
setup {
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
}
|
||||
transitions {
|
||||
testApp.openIME(wmHelper)
|
||||
}
|
||||
setup { testApp.launchViaIntent(wmHelper) }
|
||||
transitions { testApp.openIME(wmHelper) }
|
||||
teardown {
|
||||
testApp.closeIME(wmHelper)
|
||||
testApp.exit(wmHelper)
|
||||
}
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeWindowBecomesVisible() = testSpec.imeWindowBecomesVisible()
|
||||
@Presubmit @Test fun imeWindowBecomesVisible() = testSpec.imeWindowBecomesVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun appWindowAlwaysVisibleOnTop() {
|
||||
testSpec.assertWm {
|
||||
this.isAppWindowOnTop(testApp)
|
||||
}
|
||||
testSpec.assertWm { this.isAppWindowOnTop(testApp) }
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeLayerBecomesVisible() = testSpec.imeLayerBecomesVisible()
|
||||
@Presubmit @Test fun imeLayerBecomesVisible() = testSpec.imeLayerBecomesVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun layerAlwaysVisible() {
|
||||
testSpec.assertLayers {
|
||||
this.isVisible(testApp)
|
||||
}
|
||||
testSpec.assertLayers { this.isVisible(testApp) }
|
||||
}
|
||||
|
||||
companion object {
|
||||
@@ -87,11 +72,12 @@ class OpenImeWindowTest(testSpec: FlickerTestParameter) : BaseTest(testSpec) {
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(
|
||||
supportedRotations = listOf(Surface.ROTATION_0),
|
||||
supportedNavigationModes = listOf(
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
|
||||
)
|
||||
supportedRotations = listOf(Surface.ROTATION_0),
|
||||
supportedNavigationModes =
|
||||
listOf(
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,8 +42,8 @@ import org.junit.runners.MethodSorters
|
||||
import org.junit.runners.Parameterized
|
||||
|
||||
/**
|
||||
* Test IME window layer will be associated with the app task when going to the overview screen.
|
||||
* To run this test: `atest FlickerTests:OpenImeWindowToOverViewTest`
|
||||
* Test IME window layer will be associated with the app task when going to the overview screen. To
|
||||
* run this test: `atest FlickerTests:OpenImeWindowToOverViewTest`
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@@ -54,21 +54,16 @@ class OpenImeWindowToOverViewTest(testSpec: FlickerTestParameter) : BaseTest(tes
|
||||
|
||||
/** {@inheritDoc} */
|
||||
override val transition: FlickerBuilder.() -> Unit = {
|
||||
setup {
|
||||
imeTestApp.launchViaIntent(wmHelper)
|
||||
}
|
||||
setup { imeTestApp.launchViaIntent(wmHelper) }
|
||||
transitions {
|
||||
device.pressRecentApps()
|
||||
val builder = wmHelper.StateSyncBuilder()
|
||||
.withRecentsActivityVisible()
|
||||
val builder = wmHelper.StateSyncBuilder().withRecentsActivityVisible()
|
||||
waitNavStatusBarVisibility(builder)
|
||||
builder.waitForAndVerify()
|
||||
}
|
||||
teardown {
|
||||
device.pressHome()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withHomeActivityVisible()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withHomeActivityVisible().waitForAndVerify()
|
||||
imeTestApp.exit(wmHelper)
|
||||
}
|
||||
}
|
||||
@@ -80,9 +75,9 @@ class OpenImeWindowToOverViewTest(testSpec: FlickerTestParameter) : BaseTest(tes
|
||||
* state depending on the touch-up to decide the intention of gesture, the display may keep in
|
||||
* landscape if return to app, or change to portrait if the gesture is to swipe-to-home.
|
||||
*
|
||||
* So instead of showing landscape bars with portrait launcher at the same time
|
||||
* (especially return-to-home that launcher workspace becomes visible), hide the bars until
|
||||
* leave overview to have cleaner appearance.
|
||||
* So instead of showing landscape bars with portrait launcher at the same time (especially
|
||||
* return-to-home that launcher workspace becomes visible), hide the bars until leave overview
|
||||
* to have cleaner appearance.
|
||||
*
|
||||
* b/227189877
|
||||
*/
|
||||
@@ -90,8 +85,7 @@ class OpenImeWindowToOverViewTest(testSpec: FlickerTestParameter) : BaseTest(tes
|
||||
when {
|
||||
testSpec.isLandscapeOrSeascapeAtStart && !testSpec.isTablet ->
|
||||
stateSync.add(WindowManagerConditionsFactory.isStatusBarVisible().negate())
|
||||
else ->
|
||||
stateSync.withNavOrTaskBarVisible().withStatusBarVisible()
|
||||
else -> stateSync.withNavOrTaskBarVisible().withStatusBarVisible()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,9 +103,7 @@ class OpenImeWindowToOverViewTest(testSpec: FlickerTestParameter) : BaseTest(tes
|
||||
testSpec.navBarLayerIsVisibleAtStartAndEnd()
|
||||
}
|
||||
|
||||
/**
|
||||
* Bars are expected to be hidden while entering overview in landscape (b/227189877)
|
||||
*/
|
||||
/** Bars are expected to be hidden while entering overview in landscape (b/227189877) */
|
||||
@Presubmit
|
||||
@Test
|
||||
fun navBarLayerIsVisibleAtStartAndEndGestural() {
|
||||
@@ -122,8 +114,8 @@ class OpenImeWindowToOverViewTest(testSpec: FlickerTestParameter) : BaseTest(tes
|
||||
}
|
||||
|
||||
/**
|
||||
* In the legacy transitions, the nav bar is not marked as invisible.
|
||||
* In the new transitions this is fixed and the nav bar shows as invisible
|
||||
* In the legacy transitions, the nav bar is not marked as invisible. In the new transitions
|
||||
* this is fixed and the nav bar shows as invisible
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
@@ -132,17 +124,13 @@ class OpenImeWindowToOverViewTest(testSpec: FlickerTestParameter) : BaseTest(tes
|
||||
Assume.assumeTrue(testSpec.isLandscapeOrSeascapeAtStart)
|
||||
Assume.assumeTrue(testSpec.isGesturalNavigation)
|
||||
Assume.assumeTrue(isShellTransitionsEnabled)
|
||||
testSpec.assertLayersStart {
|
||||
this.isVisible(ComponentNameMatcher.NAV_BAR)
|
||||
}
|
||||
testSpec.assertLayersEnd {
|
||||
this.isInvisible(ComponentNameMatcher.NAV_BAR)
|
||||
}
|
||||
testSpec.assertLayersStart { this.isVisible(ComponentNameMatcher.NAV_BAR) }
|
||||
testSpec.assertLayersEnd { this.isInvisible(ComponentNameMatcher.NAV_BAR) }
|
||||
}
|
||||
|
||||
/**
|
||||
* In the legacy transitions, the nav bar is not marked as invisible.
|
||||
* In the new transitions this is fixed and the nav bar shows as invisible
|
||||
* In the legacy transitions, the nav bar is not marked as invisible. In the new transitions
|
||||
* this is fixed and the nav bar shows as invisible
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
@@ -150,17 +138,13 @@ class OpenImeWindowToOverViewTest(testSpec: FlickerTestParameter) : BaseTest(tes
|
||||
Assume.assumeTrue(testSpec.isLandscapeOrSeascapeAtStart)
|
||||
Assume.assumeTrue(testSpec.isGesturalNavigation)
|
||||
Assume.assumeFalse(testSpec.isTablet)
|
||||
testSpec.assertLayersStart {
|
||||
this.isVisible(ComponentNameMatcher.STATUS_BAR)
|
||||
}
|
||||
testSpec.assertLayersEnd {
|
||||
this.isInvisible(ComponentNameMatcher.STATUS_BAR)
|
||||
}
|
||||
testSpec.assertLayersStart { this.isVisible(ComponentNameMatcher.STATUS_BAR) }
|
||||
testSpec.assertLayersEnd { this.isInvisible(ComponentNameMatcher.STATUS_BAR) }
|
||||
}
|
||||
|
||||
/**
|
||||
* In the legacy transitions, the nav bar is not marked as invisible.
|
||||
* In the new transitions this is fixed and the nav bar shows as invisible
|
||||
* In the legacy transitions, the nav bar is not marked as invisible. In the new transitions
|
||||
* this is fixed and the nav bar shows as invisible
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
@@ -174,27 +158,26 @@ class OpenImeWindowToOverViewTest(testSpec: FlickerTestParameter) : BaseTest(tes
|
||||
/** {@inheritDoc} */
|
||||
@Test
|
||||
@Ignore("Visibility changes depending on orientation and navigation mode")
|
||||
override fun navBarLayerIsVisibleAtStartAndEnd() { }
|
||||
override fun navBarLayerIsVisibleAtStartAndEnd() {}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Test
|
||||
@Ignore("Visibility changes depending on orientation and navigation mode")
|
||||
override fun navBarLayerPositionAtStartAndEnd() { }
|
||||
override fun navBarLayerPositionAtStartAndEnd() {}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Test
|
||||
@Ignore("Visibility changes depending on orientation and navigation mode")
|
||||
override fun statusBarLayerPositionAtStartAndEnd() { }
|
||||
override fun statusBarLayerPositionAtStartAndEnd() {}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Test
|
||||
@Ignore("Visibility changes depending on orientation and navigation mode")
|
||||
override fun statusBarLayerIsVisibleAtStartAndEnd() { }
|
||||
override fun statusBarLayerIsVisibleAtStartAndEnd() {}
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() =
|
||||
super.taskBarLayerIsVisibleAtStartAndEnd()
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() = super.taskBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
@@ -209,12 +192,8 @@ class OpenImeWindowToOverViewTest(testSpec: FlickerTestParameter) : BaseTest(tes
|
||||
Assume.assumeTrue(testSpec.isLandscapeOrSeascapeAtStart)
|
||||
Assume.assumeFalse(testSpec.isTablet)
|
||||
Assume.assumeTrue(isShellTransitionsEnabled)
|
||||
testSpec.assertLayersStart {
|
||||
this.isVisible(ComponentNameMatcher.STATUS_BAR)
|
||||
}
|
||||
testSpec.assertLayersEnd {
|
||||
this.isInvisible(ComponentNameMatcher.STATUS_BAR)
|
||||
}
|
||||
testSpec.assertLayersStart { this.isVisible(ComponentNameMatcher.STATUS_BAR) }
|
||||
testSpec.assertLayersEnd { this.isInvisible(ComponentNameMatcher.STATUS_BAR) }
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@@ -230,11 +209,9 @@ class OpenImeWindowToOverViewTest(testSpec: FlickerTestParameter) : BaseTest(tes
|
||||
@Test
|
||||
fun imeLayerIsVisibleAndAssociatedWithAppWidow() {
|
||||
testSpec.assertLayersStart {
|
||||
isVisible(ComponentNameMatcher.IME).visibleRegion(ComponentNameMatcher.IME)
|
||||
.coversAtMost(
|
||||
isVisible(imeTestApp)
|
||||
.visibleRegion(imeTestApp).region
|
||||
)
|
||||
isVisible(ComponentNameMatcher.IME)
|
||||
.visibleRegion(ComponentNameMatcher.IME)
|
||||
.coversAtMost(isVisible(imeTestApp).visibleRegion(imeTestApp).region)
|
||||
}
|
||||
testSpec.assertLayers {
|
||||
this.invoke("imeLayerIsVisibleAndAlignAppWidow") {
|
||||
@@ -252,8 +229,8 @@ class OpenImeWindowToOverViewTest(testSpec: FlickerTestParameter) : BaseTest(tes
|
||||
/**
|
||||
* Creates the test configurations.
|
||||
*
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
|
||||
* repetitions, screen orientation and navigation modes.
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring repetitions,
|
||||
* screen orientation and navigation modes.
|
||||
*/
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
@@ -261,10 +238,11 @@ class OpenImeWindowToOverViewTest(testSpec: FlickerTestParameter) : BaseTest(tes
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(
|
||||
supportedRotations = listOf(Surface.ROTATION_0, Surface.ROTATION_90),
|
||||
supportedNavigationModes = listOf(
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
|
||||
)
|
||||
supportedNavigationModes =
|
||||
listOf(
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,8 +35,7 @@ import org.junit.runners.MethodSorters
|
||||
import org.junit.runners.Parameterized
|
||||
|
||||
/**
|
||||
* Test IME window opening transitions.
|
||||
* To run this test: `atest FlickerTests:ReOpenImeWindowTest`
|
||||
* Test IME window opening transitions. To run this test: `atest FlickerTests:ReOpenImeWindowTest`
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@@ -48,24 +47,17 @@ open class ReOpenImeWindowTest(testSpec: FlickerTestParameter) : BaseTest(testSp
|
||||
/** {@inheritDoc} */
|
||||
override val transition: FlickerBuilder.() -> Unit = {
|
||||
setup {
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
testApp.openIME(wmHelper)
|
||||
this.setRotation(testSpec.startRotation)
|
||||
device.pressRecentApps()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withRecentsActivityVisible()
|
||||
.waitForAndVerify()
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
testApp.openIME(wmHelper)
|
||||
this.setRotation(testSpec.startRotation)
|
||||
device.pressRecentApps()
|
||||
wmHelper.StateSyncBuilder().withRecentsActivityVisible().waitForAndVerify()
|
||||
}
|
||||
transitions {
|
||||
device.reopenAppFromOverview(wmHelper)
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withFullScreenApp(testApp)
|
||||
.withImeShown()
|
||||
.waitForAndVerify()
|
||||
}
|
||||
teardown {
|
||||
testApp.exit(wmHelper)
|
||||
wmHelper.StateSyncBuilder().withFullScreenApp(testApp).withImeShown().waitForAndVerify()
|
||||
}
|
||||
teardown { testApp.exit(wmHelper) }
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@@ -77,8 +69,11 @@ open class ReOpenImeWindowTest(testSpec: FlickerTestParameter) : BaseTest(testSp
|
||||
val recentTaskComponent = ComponentNameMatcher("", "RecentTaskScreenshotSurface")
|
||||
testSpec.assertLayers {
|
||||
this.visibleLayersShownMoreThanOneConsecutiveEntry(
|
||||
listOf(ComponentNameMatcher.SPLASH_SCREEN,
|
||||
ComponentNameMatcher.SNAPSHOT, recentTaskComponent)
|
||||
listOf(
|
||||
ComponentNameMatcher.SPLASH_SCREEN,
|
||||
ComponentNameMatcher.SNAPSHOT,
|
||||
recentTaskComponent
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -90,9 +85,12 @@ open class ReOpenImeWindowTest(testSpec: FlickerTestParameter) : BaseTest(testSp
|
||||
val component = ComponentNameMatcher("", "RecentTaskScreenshotSurface")
|
||||
testSpec.assertWm {
|
||||
this.visibleWindowsShownMoreThanOneConsecutiveEntry(
|
||||
ignoreWindows = listOf(ComponentNameMatcher.SPLASH_SCREEN,
|
||||
ignoreWindows =
|
||||
listOf(
|
||||
ComponentNameMatcher.SPLASH_SCREEN,
|
||||
ComponentNameMatcher.SNAPSHOT,
|
||||
component)
|
||||
component
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -102,14 +100,12 @@ open class ReOpenImeWindowTest(testSpec: FlickerTestParameter) : BaseTest(testSp
|
||||
fun launcherWindowBecomesInvisible() {
|
||||
testSpec.assertWm {
|
||||
this.isAppWindowVisible(ComponentNameMatcher.LAUNCHER)
|
||||
.then()
|
||||
.isAppWindowInvisible(ComponentNameMatcher.LAUNCHER)
|
||||
.then()
|
||||
.isAppWindowInvisible(ComponentNameMatcher.LAUNCHER)
|
||||
}
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeWindowIsAlwaysVisible() = testSpec.imeWindowIsAlwaysVisible()
|
||||
@Presubmit @Test fun imeWindowIsAlwaysVisible() = testSpec.imeWindowIsAlwaysVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
@@ -118,17 +114,13 @@ open class ReOpenImeWindowTest(testSpec: FlickerTestParameter) : BaseTest(testSp
|
||||
// and exiting overview. Since we log 1x per frame, sometimes the activity visibility
|
||||
// and the app visibility are updated together, sometimes not, thus ignore activity
|
||||
// check at the start
|
||||
testSpec.assertWm {
|
||||
this.isAppWindowVisible(testApp)
|
||||
}
|
||||
testSpec.assertWm { this.isAppWindowVisible(testApp) }
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeLayerBecomesVisible() {
|
||||
testSpec.assertLayers {
|
||||
this.isVisible(ComponentNameMatcher.IME)
|
||||
}
|
||||
testSpec.assertLayers { this.isVisible(ComponentNameMatcher.IME) }
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@@ -148,9 +140,7 @@ open class ReOpenImeWindowTest(testSpec: FlickerTestParameter) : BaseTest(testSp
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(
|
||||
supportedRotations = listOf(Surface.ROTATION_0)
|
||||
)
|
||||
.getConfigNonRotationTests(supportedRotations = listOf(Surface.ROTATION_0))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,17 +41,15 @@ import org.junit.runners.MethodSorters
|
||||
import org.junit.runners.Parameterized
|
||||
|
||||
/**
|
||||
* Test IME windows switching with 2-Buttons or gestural navigation.
|
||||
* To run this test: `atest FlickerTests:SwitchImeWindowsFromGestureNavTest`
|
||||
* Test IME windows switching with 2-Buttons or gestural navigation. To run this test: `atest
|
||||
* FlickerTests:SwitchImeWindowsFromGestureNavTest`
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
@Presubmit
|
||||
open class SwitchImeWindowsFromGestureNavTest(
|
||||
testSpec: FlickerTestParameter
|
||||
) : BaseTest(testSpec) {
|
||||
open class SwitchImeWindowsFromGestureNavTest(testSpec: FlickerTestParameter) : BaseTest(testSpec) {
|
||||
private val testApp = SimpleAppHelper(instrumentation)
|
||||
private val imeTestApp = ImeAppAutoFocusHelper(instrumentation, testSpec.startRotation)
|
||||
|
||||
@@ -66,22 +64,16 @@ open class SwitchImeWindowsFromGestureNavTest(
|
||||
tapl.setExpectedRotationCheckEnabled(false)
|
||||
this.setRotation(testSpec.startRotation)
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withFullScreenApp(testApp)
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withFullScreenApp(testApp).waitForAndVerify()
|
||||
|
||||
imeTestApp.launchViaIntent(wmHelper)
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withFullScreenApp(imeTestApp)
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withFullScreenApp(imeTestApp).waitForAndVerify()
|
||||
|
||||
imeTestApp.openIME(wmHelper)
|
||||
}
|
||||
teardown {
|
||||
tapl.goHome()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withHomeActivityVisible()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withHomeActivityVisible().waitForAndVerify()
|
||||
testApp.exit(wmHelper)
|
||||
imeTestApp.exit(wmHelper)
|
||||
}
|
||||
@@ -89,17 +81,13 @@ open class SwitchImeWindowsFromGestureNavTest(
|
||||
// [Step1]: Swipe right from imeTestApp to testApp task
|
||||
createTag(TAG_IME_VISIBLE)
|
||||
tapl.launchedAppState.quickSwitchToPreviousApp()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withFullScreenApp(testApp)
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withFullScreenApp(testApp).waitForAndVerify()
|
||||
createTag(TAG_IME_INVISIBLE)
|
||||
}
|
||||
transitions {
|
||||
// [Step2]: Swipe left to back to imeTestApp task
|
||||
tapl.launchedAppState.quickSwitchToPreviousAppSwipeLeft()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withFullScreenApp(imeTestApp)
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withFullScreenApp(imeTestApp).waitForAndVerify()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,9 +97,7 @@ open class SwitchImeWindowsFromGestureNavTest(
|
||||
override fun statusBarWindowIsAlwaysVisible() = super.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun entireScreenCovered() = super.entireScreenCovered()
|
||||
@Postsubmit @Test override fun entireScreenCovered() = super.entireScreenCovered()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@@ -137,8 +123,7 @@ open class SwitchImeWindowsFromGestureNavTest(
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun statusBarLayerPositionAtStartAndEnd() =
|
||||
super.statusBarLayerPositionAtStartAndEnd()
|
||||
override fun statusBarLayerPositionAtStartAndEnd() = super.statusBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@@ -171,23 +156,15 @@ open class SwitchImeWindowsFromGestureNavTest(
|
||||
@FlakyTest(bugId = 244414110)
|
||||
@Test
|
||||
open fun imeLayerIsVisibleWhenSwitchingToImeApp() {
|
||||
testSpec.assertLayersStart {
|
||||
isVisible(ComponentNameMatcher.IME)
|
||||
}
|
||||
testSpec.assertLayersTag(TAG_IME_VISIBLE) {
|
||||
isVisible(ComponentNameMatcher.IME)
|
||||
}
|
||||
testSpec.assertLayersEnd {
|
||||
isVisible(ComponentNameMatcher.IME)
|
||||
}
|
||||
testSpec.assertLayersStart { isVisible(ComponentNameMatcher.IME) }
|
||||
testSpec.assertLayersTag(TAG_IME_VISIBLE) { isVisible(ComponentNameMatcher.IME) }
|
||||
testSpec.assertLayersEnd { isVisible(ComponentNameMatcher.IME) }
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeLayerIsInvisibleWhenSwitchingToTestApp() {
|
||||
testSpec.assertLayersTag(TAG_IME_INVISIBLE) {
|
||||
isInvisible(ComponentNameMatcher.IME)
|
||||
}
|
||||
testSpec.assertLayersTag(TAG_IME_INVISIBLE) { isInvisible(ComponentNameMatcher.IME) }
|
||||
}
|
||||
|
||||
companion object {
|
||||
@@ -196,9 +173,8 @@ open class SwitchImeWindowsFromGestureNavTest(
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(
|
||||
supportedNavigationModes = listOf(
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
|
||||
),
|
||||
supportedNavigationModes =
|
||||
listOf(WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY),
|
||||
supportedRotations = listOf(Surface.ROTATION_0)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -33,16 +33,15 @@ import org.junit.runners.MethodSorters
|
||||
import org.junit.runners.Parameterized
|
||||
|
||||
/**
|
||||
* Test IME windows switching with 2-Buttons or gestural navigation.
|
||||
* To run this test: `atest FlickerTests:SwitchImeWindowsFromGestureNavTest`
|
||||
* Test IME windows switching with 2-Buttons or gestural navigation. To run this test: `atest
|
||||
* FlickerTests:SwitchImeWindowsFromGestureNavTest`
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
class SwitchImeWindowsFromGestureNavTest_ShellTransit(
|
||||
testSpec: FlickerTestParameter
|
||||
) : SwitchImeWindowsFromGestureNavTest(testSpec) {
|
||||
class SwitchImeWindowsFromGestureNavTest_ShellTransit(testSpec: FlickerTestParameter) :
|
||||
SwitchImeWindowsFromGestureNavTest(testSpec) {
|
||||
@Before
|
||||
override fun before() {
|
||||
Assume.assumeTrue(isShellTransitionsEnabled)
|
||||
@@ -73,8 +72,8 @@ class SwitchImeWindowsFromGestureNavTest_ShellTransit(
|
||||
override fun navBarWindowIsAlwaysVisible() = super.navBarWindowIsAlwaysVisible()
|
||||
|
||||
/**
|
||||
* Checks that [ComponentMatcher.NAV_BAR] window is visible and above the app windows at the start
|
||||
* and end of the WM trace
|
||||
* Checks that [ComponentMatcher.NAV_BAR] window is visible and above the app windows at the
|
||||
* start and end of the WM trace
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
|
||||
@@ -40,15 +40,18 @@ import org.junit.runners.Parameterized
|
||||
* To run this test: `atest FlickerTests:ActivitiesTransitionTest`
|
||||
*
|
||||
* Actions:
|
||||
* ```
|
||||
* Launch an app
|
||||
* Launch a secondary activity within the app
|
||||
* Close the secondary activity back to the initial one
|
||||
*
|
||||
* ```
|
||||
* Notes:
|
||||
* ```
|
||||
* 1. Part of the test setup occurs automatically via
|
||||
* [com.android.server.wm.flicker.TransitionRunnerWithRules],
|
||||
* including configuring navigation mode, initial orientation and ensuring no
|
||||
* apps are running before setup
|
||||
* ```
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@@ -63,15 +66,11 @@ class ActivitiesTransitionTest(testSpec: FlickerTestParameter) : BaseTest(testSp
|
||||
tapl.setExpectedRotation(testSpec.startRotation)
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
}
|
||||
teardown {
|
||||
testApp.exit(wmHelper)
|
||||
}
|
||||
teardown { testApp.exit(wmHelper) }
|
||||
transitions {
|
||||
testApp.openSecondActivity(device, wmHelper)
|
||||
tapl.pressBack()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withFullScreenApp(testApp)
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withFullScreenApp(testApp).waitForAndVerify()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,9 +80,9 @@ class ActivitiesTransitionTest(testSpec: FlickerTestParameter) : BaseTest(testSp
|
||||
override fun navBarLayerPositionAtStartAndEnd() = super.navBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/**
|
||||
* Checks that the [ActivityOptions.LaunchNewActivity] activity is visible at
|
||||
* the start of the transition, that [ActivityOptions.SimpleActivity] becomes visible during
|
||||
* the transition, and that [ActivityOptions.LaunchNewActivity] is again visible at the end
|
||||
* Checks that the [ActivityOptions.LaunchNewActivity] activity is visible at the start of the
|
||||
* transition, that [ActivityOptions.SimpleActivity] becomes visible during the transition, and
|
||||
* that [ActivityOptions.LaunchNewActivity] is again visible at the end
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
@@ -109,9 +108,7 @@ class ActivitiesTransitionTest(testSpec: FlickerTestParameter) : BaseTest(testSp
|
||||
@Presubmit
|
||||
@Test
|
||||
fun launcherWindowNotOnTop() {
|
||||
testSpec.assertWm {
|
||||
this.isAppWindowNotOnTop(ComponentNameMatcher.LAUNCHER)
|
||||
}
|
||||
testSpec.assertWm { this.isAppWindowNotOnTop(ComponentNameMatcher.LAUNCHER) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,14 +124,13 @@ class ActivitiesTransitionTest(testSpec: FlickerTestParameter) : BaseTest(testSp
|
||||
/**
|
||||
* Creates the test configurations.
|
||||
*
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
|
||||
* repetitions, screen orientation and navigation modes.
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring repetitions,
|
||||
* screen orientation and navigation modes.
|
||||
*/
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests()
|
||||
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,22 +35,21 @@ import org.junit.runners.Parameterized
|
||||
*
|
||||
* To run this test: `atest FlickerTests:OpenAppAfterCameraTest`
|
||||
*
|
||||
* Notes:
|
||||
* Some default assertions are inherited [OpenAppTransition]
|
||||
* Notes: Some default assertions are inherited [OpenAppTransition]
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
open class OpenAppAfterCameraTest(
|
||||
testSpec: FlickerTestParameter
|
||||
) : OpenAppFromLauncherTransition(testSpec) {
|
||||
open class OpenAppAfterCameraTest(testSpec: FlickerTestParameter) :
|
||||
OpenAppFromLauncherTransition(testSpec) {
|
||||
@Before
|
||||
open fun before() {
|
||||
Assume.assumeFalse(isShellTransitionsEnabled)
|
||||
}
|
||||
|
||||
private val cameraApp = CameraAppHelper(instrumentation) /** {@inheritDoc} */
|
||||
private val cameraApp = CameraAppHelper(instrumentation)
|
||||
/** {@inheritDoc} */
|
||||
override val transition: FlickerBuilder.() -> Unit
|
||||
get() = {
|
||||
super.transition(this)
|
||||
@@ -62,26 +61,21 @@ open class OpenAppAfterCameraTest(
|
||||
// 2. Press home button (button nav mode) / swipe up to home (gesture nav mode)
|
||||
tapl.goHome()
|
||||
}
|
||||
teardown {
|
||||
testApp.exit(wmHelper)
|
||||
}
|
||||
transitions {
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
}
|
||||
teardown { testApp.exit(wmHelper) }
|
||||
transitions { testApp.launchViaIntent(wmHelper) }
|
||||
}
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* Creates the test configurations.
|
||||
*
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
|
||||
* repetitions, screen orientation and navigation modes.
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring repetitions,
|
||||
* screen orientation and navigation modes.
|
||||
*/
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests()
|
||||
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,16 +33,14 @@ import org.junit.runners.Parameterized
|
||||
*
|
||||
* To run this test: `atest FlickerTests:OpenAppAfterCameraTest_ShellTransit`
|
||||
*
|
||||
* Notes:
|
||||
* Some default assertions are inherited [OpenAppTransition]
|
||||
* Notes: Some default assertions are inherited [OpenAppTransition]
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
class OpenAppAfterCameraTest_ShellTransit(
|
||||
testSpec: FlickerTestParameter
|
||||
) : OpenAppAfterCameraTest(testSpec) {
|
||||
class OpenAppAfterCameraTest_ShellTransit(testSpec: FlickerTestParameter) :
|
||||
OpenAppAfterCameraTest(testSpec) {
|
||||
@Before
|
||||
override fun before() {
|
||||
Assume.assumeFalse(isShellTransitionsEnabled)
|
||||
|
||||
@@ -37,24 +37,26 @@ import org.junit.runners.Parameterized
|
||||
* To run this test: `atest FlickerTests:OpenAppColdFromIcon`
|
||||
*
|
||||
* Actions:
|
||||
* ```
|
||||
* Make sure no apps are running on the device
|
||||
* Launch an app [testApp] by clicking it's icon on all apps and wait animation to complete
|
||||
*
|
||||
* ```
|
||||
* Notes:
|
||||
* ```
|
||||
* 1. Some default assertions (e.g., nav bar, status bar and screen covered)
|
||||
* are inherited [OpenAppTransition]
|
||||
* 2. Part of the test setup occurs automatically via
|
||||
* [com.android.server.wm.flicker.TransitionRunnerWithRules],
|
||||
* including configuring navigation mode, initial orientation and ensuring no
|
||||
* apps are running before setup
|
||||
* ```
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
class OpenAppColdFromIcon(
|
||||
testSpec: FlickerTestParameter
|
||||
) : OpenAppFromLauncherTransition(testSpec) {
|
||||
class OpenAppColdFromIcon(testSpec: FlickerTestParameter) :
|
||||
OpenAppFromLauncherTransition(testSpec) {
|
||||
/** {@inheritDoc} */
|
||||
override val transition: FlickerBuilder.() -> Unit
|
||||
get() = {
|
||||
@@ -69,21 +71,17 @@ class OpenAppColdFromIcon(
|
||||
this.setRotation(testSpec.startRotation)
|
||||
}
|
||||
transitions {
|
||||
tapl.goHome()
|
||||
tapl
|
||||
.goHome()
|
||||
.switchToAllApps()
|
||||
.getAppIcon(testApp.launcherName)
|
||||
.launch(testApp.`package`)
|
||||
}
|
||||
teardown {
|
||||
testApp.exit(wmHelper)
|
||||
}
|
||||
teardown { testApp.exit(wmHelper) }
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun appWindowAsTopWindowAtEnd() =
|
||||
super.appWindowAsTopWindowAtEnd()
|
||||
@Postsubmit @Test override fun appWindowAsTopWindowAtEnd() = super.appWindowAsTopWindowAtEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@@ -92,35 +90,22 @@ class OpenAppColdFromIcon(
|
||||
super.appWindowReplacesLauncherAsTopWindow()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun appLayerBecomesVisible() =
|
||||
super.appLayerBecomesVisible()
|
||||
@Postsubmit @Test override fun appLayerBecomesVisible() = super.appLayerBecomesVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun appLayerReplacesLauncher() = super.appLayerReplacesLauncher()
|
||||
@Postsubmit @Test override fun appLayerReplacesLauncher() = super.appLayerReplacesLauncher()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun appWindowBecomesTopWindow() = super.appWindowBecomesTopWindow()
|
||||
@Postsubmit @Test override fun appWindowBecomesTopWindow() = super.appWindowBecomesTopWindow()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun appWindowBecomesVisible() = super.appWindowBecomesVisible()
|
||||
@Postsubmit @Test override fun appWindowBecomesVisible() = super.appWindowBecomesVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun entireScreenCovered() = super.entireScreenCovered()
|
||||
@Postsubmit @Test override fun entireScreenCovered() = super.entireScreenCovered()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun focusChanges() = super.focusChanges()
|
||||
@Postsubmit @Test override fun focusChanges() = super.focusChanges()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@@ -150,8 +135,7 @@ class OpenAppColdFromIcon(
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun statusBarLayerPositionAtStartAndEnd() =
|
||||
super.statusBarLayerPositionAtStartAndEnd()
|
||||
override fun statusBarLayerPositionAtStartAndEnd() = super.statusBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@@ -177,22 +161,19 @@ class OpenAppColdFromIcon(
|
||||
super.visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun appWindowIsTopWindowAtEnd() = super.appWindowIsTopWindowAtEnd()
|
||||
@Postsubmit @Test override fun appWindowIsTopWindowAtEnd() = super.appWindowIsTopWindowAtEnd()
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* Creates the test configurations.
|
||||
*
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
|
||||
* repetitions, screen orientation and navigation modes.
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring repetitions,
|
||||
* screen orientation and navigation modes.
|
||||
*/
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests()
|
||||
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,25 +38,27 @@ import org.junit.runners.Parameterized
|
||||
* To run this test: `atest FlickerTests:OpenAppColdTest`
|
||||
*
|
||||
* Actions:
|
||||
* ```
|
||||
* Make sure no apps are running on the device
|
||||
* Launch an app [testApp] and wait animation to complete
|
||||
*
|
||||
* ```
|
||||
* Notes:
|
||||
* ```
|
||||
* 1. Some default assertions (e.g., nav bar, status bar and screen covered)
|
||||
* are inherited [OpenAppTransition]
|
||||
* 2. Part of the test setup occurs automatically via
|
||||
* [com.android.server.wm.flicker.TransitionRunnerWithRules],
|
||||
* including configuring navigation mode, initial orientation and ensuring no
|
||||
* apps are running before setup
|
||||
* ```
|
||||
*/
|
||||
@RequiresDevice
|
||||
@FlickerServiceCompatible
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
open class OpenAppColdTest(
|
||||
testSpec: FlickerTestParameter
|
||||
) : OpenAppFromLauncherTransition(testSpec) {
|
||||
open class OpenAppColdTest(testSpec: FlickerTestParameter) :
|
||||
OpenAppFromLauncherTransition(testSpec) {
|
||||
/** {@inheritDoc} */
|
||||
override val transition: FlickerBuilder.() -> Unit
|
||||
get() = {
|
||||
@@ -65,24 +67,17 @@ open class OpenAppColdTest(
|
||||
removeAllTasksButHome()
|
||||
this.setRotation(testSpec.startRotation)
|
||||
}
|
||||
teardown {
|
||||
testApp.exit(wmHelper)
|
||||
}
|
||||
transitions {
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
}
|
||||
teardown { testApp.exit(wmHelper) }
|
||||
transitions { testApp.launchViaIntent(wmHelper) }
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@FlakyTest(bugId = 206753786)
|
||||
@Test
|
||||
override fun navBarLayerPositionAtStartAndEnd() =
|
||||
super.navBarLayerPositionAtStartAndEnd()
|
||||
override fun navBarLayerPositionAtStartAndEnd() = super.navBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Presubmit
|
||||
@Test
|
||||
override fun appLayerReplacesLauncher() = super.appLayerReplacesLauncher()
|
||||
@Presubmit @Test override fun appLayerReplacesLauncher() = super.appLayerReplacesLauncher()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@FlakyTest(bugId = 240238245)
|
||||
@@ -94,14 +89,13 @@ open class OpenAppColdTest(
|
||||
/**
|
||||
* Creates the test configurations.
|
||||
*
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
|
||||
* repetitions, screen orientation and navigation modes.
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring repetitions,
|
||||
* screen orientation and navigation modes.
|
||||
*/
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests()
|
||||
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,32 +22,27 @@ import com.android.server.wm.flicker.replacesLayer
|
||||
import com.android.server.wm.traces.common.ComponentNameMatcher
|
||||
import org.junit.Test
|
||||
|
||||
/**
|
||||
* Base class for app launch tests
|
||||
*/
|
||||
abstract class OpenAppFromLauncherTransition(
|
||||
testSpec: FlickerTestParameter
|
||||
) : OpenAppTransition(testSpec) {
|
||||
/** Base class for app launch tests */
|
||||
abstract class OpenAppFromLauncherTransition(testSpec: FlickerTestParameter) :
|
||||
OpenAppTransition(testSpec) {
|
||||
|
||||
/**
|
||||
* Checks that the focus changes from the [ComponentMatcher.LAUNCHER] to [testApp]
|
||||
*/
|
||||
/** Checks that the focus changes from the [ComponentMatcher.LAUNCHER] to [testApp] */
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun focusChanges() {
|
||||
testSpec.assertEventLog {
|
||||
this.focusChanges("NexusLauncherActivity", testApp.`package`)
|
||||
}
|
||||
testSpec.assertEventLog { this.focusChanges("NexusLauncherActivity", testApp.`package`) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [ComponentMatcher.LAUNCHER] layer is visible at the start of the transition,
|
||||
* and is replaced by [testApp], which remains visible until the end
|
||||
* Checks that [ComponentMatcher.LAUNCHER] layer is visible at the start of the transition, and
|
||||
* is replaced by [testApp], which remains visible until the end
|
||||
*/
|
||||
open fun appLayerReplacesLauncher() {
|
||||
testSpec.replacesLayer(
|
||||
ComponentNameMatcher.LAUNCHER, testApp,
|
||||
ignoreEntriesWithRotationLayer = true, ignoreSnapshot = true,
|
||||
ComponentNameMatcher.LAUNCHER,
|
||||
testApp,
|
||||
ignoreEntriesWithRotationLayer = true,
|
||||
ignoreSnapshot = true,
|
||||
ignoreSplashscreen = true
|
||||
)
|
||||
}
|
||||
@@ -64,21 +59,15 @@ abstract class OpenAppFromLauncherTransition(
|
||||
this.isAppWindowOnTop(ComponentNameMatcher.LAUNCHER)
|
||||
.then()
|
||||
.isAppWindowOnTop(
|
||||
testApp
|
||||
.or(ComponentNameMatcher.SNAPSHOT)
|
||||
.or(ComponentNameMatcher.SPLASH_SCREEN)
|
||||
testApp.or(ComponentNameMatcher.SNAPSHOT).or(ComponentNameMatcher.SPLASH_SCREEN)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that [testApp] window is the top window at the en dof the trace
|
||||
*/
|
||||
/** Checks that [testApp] window is the top window at the en dof the trace */
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun appWindowAsTopWindowAtEnd() {
|
||||
testSpec.assertWmEnd {
|
||||
this.isAppWindowOnTop(testApp)
|
||||
}
|
||||
testSpec.assertWmEnd { this.isAppWindowOnTop(testApp) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,18 +54,14 @@ open class OpenAppFromLockNotificationCold(testSpec: FlickerTestParameter) :
|
||||
get() = {
|
||||
// Needs to run at start of transition,
|
||||
// so before the transition defined in super.transition
|
||||
transitions {
|
||||
device.wakeUp()
|
||||
}
|
||||
transitions { device.wakeUp() }
|
||||
|
||||
super.transition(this)
|
||||
|
||||
// Needs to run at the end of the setup, so after the setup defined in super.transition
|
||||
setup {
|
||||
device.sleep()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withoutTopVisibleAppWindows()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withoutTopVisibleAppWindows().waitForAndVerify()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,13 +82,9 @@ open class OpenAppFromLockNotificationCold(testSpec: FlickerTestParameter) :
|
||||
override fun appWindowBecomesTopWindow() = super.appWindowBecomesTopWindow()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Test
|
||||
@Ignore("Display is off at the start")
|
||||
override fun navBarLayerPositionAtStartAndEnd() { }
|
||||
@Test @Ignore("Display is off at the start") override fun navBarLayerPositionAtStartAndEnd() {}
|
||||
|
||||
/**
|
||||
* Checks the position of the [ComponentMatcher.NAV_BAR] at the end of the transition
|
||||
*/
|
||||
/** Checks the position of the [ComponentMatcher.NAV_BAR] at the end of the transition */
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun navBarLayerPositionAtEnd() {
|
||||
@@ -103,15 +95,13 @@ open class OpenAppFromLockNotificationCold(testSpec: FlickerTestParameter) :
|
||||
/** {@inheritDoc} */
|
||||
@Test
|
||||
@Ignore("Display is off at the start")
|
||||
override fun statusBarLayerPositionAtStartAndEnd() { }
|
||||
override fun statusBarLayerPositionAtStartAndEnd() {}
|
||||
|
||||
/**
|
||||
* Checks the position of the [ComponentMatcher.STATUS_BAR] at the start and end of the
|
||||
* transition
|
||||
*/
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun statusBarLayerPositionEnd() = testSpec.statusBarLayerPositionAtEnd()
|
||||
@Postsubmit @Test fun statusBarLayerPositionEnd() = testSpec.statusBarLayerPositionAtEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@@ -124,9 +114,7 @@ open class OpenAppFromLockNotificationCold(testSpec: FlickerTestParameter) :
|
||||
override fun navBarWindowIsAlwaysVisible() = super.navBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun appLayerBecomesVisible() = super.appLayerBecomesVisible()
|
||||
@Postsubmit @Test override fun appLayerBecomesVisible() = super.appLayerBecomesVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@@ -134,9 +122,7 @@ open class OpenAppFromLockNotificationCold(testSpec: FlickerTestParameter) :
|
||||
override fun statusBarWindowIsAlwaysVisible() = super.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun appWindowBecomesVisible() = super.appWindowBecomesVisible()
|
||||
@Postsubmit @Test override fun appWindowBecomesVisible() = super.appWindowBecomesVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@@ -151,23 +137,19 @@ open class OpenAppFromLockNotificationCold(testSpec: FlickerTestParameter) :
|
||||
super.visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun appWindowIsTopWindowAtEnd() =
|
||||
super.appWindowIsTopWindowAtEnd()
|
||||
@Postsubmit @Test override fun appWindowIsTopWindowAtEnd() = super.appWindowIsTopWindowAtEnd()
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* Creates the test configurations.
|
||||
*
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
|
||||
* repetitions, screen orientation and navigation modes.
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring repetitions,
|
||||
* screen orientation and navigation modes.
|
||||
*/
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests()
|
||||
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,49 +58,40 @@ open class OpenAppFromLockNotificationWarm(testSpec: FlickerTestParameter) :
|
||||
get() = {
|
||||
// Needs to run at start of transition,
|
||||
// so before the transition defined in super.transition
|
||||
transitions {
|
||||
device.wakeUp()
|
||||
}
|
||||
transitions { device.wakeUp() }
|
||||
|
||||
super.transition(this)
|
||||
|
||||
// Needs to run at the end of the setup, so after the setup defined in super.transition
|
||||
setup {
|
||||
device.sleep()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withoutTopVisibleAppWindows()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withoutTopVisibleAppWindows().waitForAndVerify()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that we start of with no top windows and then [testApp] becomes the first and
|
||||
* only top window of the transition, with snapshot or splash screen windows optionally showing
|
||||
* first.
|
||||
* Checks that we start of with no top windows and then [testApp] becomes the first and only top
|
||||
* window of the transition, with snapshot or splash screen windows optionally showing first.
|
||||
*/
|
||||
@Test
|
||||
@Postsubmit
|
||||
open fun appWindowBecomesFirstAndOnlyTopWindow() {
|
||||
testSpec.assertWm {
|
||||
this.hasNoVisibleAppWindow()
|
||||
.then()
|
||||
.isAppWindowOnTop(ComponentNameMatcher.SNAPSHOT, isOptional = true)
|
||||
.then()
|
||||
.isAppWindowOnTop(ComponentNameMatcher.SPLASH_SCREEN, isOptional = true)
|
||||
.then()
|
||||
.isAppWindowOnTop(testApp)
|
||||
.then()
|
||||
.isAppWindowOnTop(ComponentNameMatcher.SNAPSHOT, isOptional = true)
|
||||
.then()
|
||||
.isAppWindowOnTop(ComponentNameMatcher.SPLASH_SCREEN, isOptional = true)
|
||||
.then()
|
||||
.isAppWindowOnTop(testApp)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the screen is locked at the start of the transition
|
||||
*/
|
||||
/** Checks that the screen is locked at the start of the transition */
|
||||
@Test
|
||||
@Postsubmit
|
||||
fun screenLockedStart() {
|
||||
testSpec.assertWmStart {
|
||||
isKeyguardShowing()
|
||||
}
|
||||
testSpec.assertWmStart { isKeyguardShowing() }
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@@ -117,11 +108,9 @@ open class OpenAppFromLockNotificationWarm(testSpec: FlickerTestParameter) :
|
||||
/** {@inheritDoc} */
|
||||
@Test
|
||||
@Ignore("Not applicable to this CUJ. Display starts locked and app is full screen at the end")
|
||||
override fun navBarLayerPositionAtStartAndEnd() { }
|
||||
override fun navBarLayerPositionAtStartAndEnd() {}
|
||||
|
||||
/**
|
||||
* Checks the position of the [ComponentNameMatcher.NAV_BAR] at the end of the transition
|
||||
*/
|
||||
/** Checks the position of the [ComponentNameMatcher.NAV_BAR] at the end of the transition */
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun navBarLayerPositionAtEnd() {
|
||||
@@ -132,40 +121,31 @@ open class OpenAppFromLockNotificationWarm(testSpec: FlickerTestParameter) :
|
||||
/** {@inheritDoc} */
|
||||
@Test
|
||||
@Ignore("Not applicable to this CUJ. Display starts off and app is full screen at the end")
|
||||
override fun statusBarLayerPositionAtStartAndEnd() { }
|
||||
override fun statusBarLayerPositionAtStartAndEnd() {}
|
||||
|
||||
/**
|
||||
* Checks the position of the [ComponentNameMatcher.STATUS_BAR] at the start and end of the
|
||||
* transition
|
||||
*/
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun statusBarLayerPositionEnd() = testSpec.statusBarLayerPositionAtEnd()
|
||||
@Postsubmit @Test fun statusBarLayerPositionEnd() = testSpec.statusBarLayerPositionAtEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Test
|
||||
@Ignore("Not applicable to this CUJ. Display starts locked and app is full screen at the end")
|
||||
override fun navBarLayerIsVisibleAtStartAndEnd() =
|
||||
super.navBarLayerIsVisibleAtStartAndEnd()
|
||||
override fun navBarLayerIsVisibleAtStartAndEnd() = super.navBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun navBarLayerIsVisibleAtEnd() = testSpec.navBarLayerIsVisibleAtEnd()
|
||||
@Postsubmit @Test fun navBarLayerIsVisibleAtEnd() = testSpec.navBarLayerIsVisibleAtEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Test
|
||||
@Ignore("Not applicable to this CUJ. Display starts locked and app is full screen at the end")
|
||||
override fun navBarWindowIsAlwaysVisible() = super.navBarWindowIsAlwaysVisible()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun navBarWindowIsVisibleAtEnd() = testSpec.navBarWindowIsVisibleAtEnd()
|
||||
@Postsubmit @Test fun navBarWindowIsVisibleAtEnd() = testSpec.navBarWindowIsVisibleAtEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun appLayerBecomesVisible() = super.appLayerBecomesVisible()
|
||||
@Postsubmit @Test override fun appLayerBecomesVisible() = super.appLayerBecomesVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@@ -173,14 +153,10 @@ open class OpenAppFromLockNotificationWarm(testSpec: FlickerTestParameter) :
|
||||
override fun statusBarWindowIsAlwaysVisible() = super.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun appWindowBecomesTopWindow() = super.appWindowBecomesTopWindow()
|
||||
@Postsubmit @Test override fun appWindowBecomesTopWindow() = super.appWindowBecomesTopWindow()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun appWindowBecomesVisible() = super.appWindowBecomesVisible()
|
||||
@Postsubmit @Test override fun appWindowBecomesVisible() = super.appWindowBecomesVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@@ -195,10 +171,7 @@ open class OpenAppFromLockNotificationWarm(testSpec: FlickerTestParameter) :
|
||||
super.visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun appWindowIsTopWindowAtEnd() =
|
||||
super.appWindowIsTopWindowAtEnd()
|
||||
@Postsubmit @Test override fun appWindowIsTopWindowAtEnd() = super.appWindowIsTopWindowAtEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Presubmit
|
||||
@@ -210,14 +183,13 @@ open class OpenAppFromLockNotificationWarm(testSpec: FlickerTestParameter) :
|
||||
/**
|
||||
* Creates the test configurations.
|
||||
*
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
|
||||
* repetitions, screen orientation and navigation modes.
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring repetitions,
|
||||
* screen orientation and navigation modes.
|
||||
*/
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests()
|
||||
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,8 +33,8 @@ import org.junit.runners.MethodSorters
|
||||
import org.junit.runners.Parameterized
|
||||
|
||||
/**
|
||||
* Test cold launching an app from a notification from the lock screen when there is an app
|
||||
* overlaid on the lock screen.
|
||||
* Test cold launching an app from a notification from the lock screen when there is an app overlaid
|
||||
* on the lock screen.
|
||||
*
|
||||
* To run this test: `atest FlickerTests:OpenAppFromLockNotificationWithLockOverlayApp`
|
||||
*/
|
||||
@@ -46,7 +46,7 @@ import org.junit.runners.Parameterized
|
||||
class OpenAppFromLockNotificationWithLockOverlayApp(testSpec: FlickerTestParameter) :
|
||||
OpenAppFromLockNotificationCold(testSpec) {
|
||||
private val showWhenLockedApp: ShowWhenLockedAppHelper =
|
||||
ShowWhenLockedAppHelper(instrumentation)
|
||||
ShowWhenLockedAppHelper(instrumentation)
|
||||
|
||||
// Although we are technically still locked here, the overlay app means we should open the
|
||||
// notification shade as if we were unlocked.
|
||||
@@ -61,19 +61,13 @@ class OpenAppFromLockNotificationWithLockOverlayApp(testSpec: FlickerTestParamet
|
||||
|
||||
// Launch an activity that is shown when the device is locked
|
||||
showWhenLockedApp.launchViaIntent(wmHelper)
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withFullScreenApp(showWhenLockedApp)
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withFullScreenApp(showWhenLockedApp).waitForAndVerify()
|
||||
|
||||
device.sleep()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withoutTopVisibleAppWindows()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withoutTopVisibleAppWindows().waitForAndVerify()
|
||||
}
|
||||
|
||||
teardown {
|
||||
showWhenLockedApp.exit(wmHelper)
|
||||
}
|
||||
teardown { showWhenLockedApp.exit(wmHelper) }
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -81,10 +75,10 @@ class OpenAppFromLockNotificationWithLockOverlayApp(testSpec: FlickerTestParamet
|
||||
fun showWhenLockedAppWindowBecomesVisible() {
|
||||
testSpec.assertWm {
|
||||
this.hasNoVisibleAppWindow()
|
||||
.then()
|
||||
.isAppWindowOnTop(ComponentNameMatcher.SNAPSHOT, isOptional = true)
|
||||
.then()
|
||||
.isAppWindowOnTop(showWhenLockedApp)
|
||||
.then()
|
||||
.isAppWindowOnTop(ComponentNameMatcher.SNAPSHOT, isOptional = true)
|
||||
.then()
|
||||
.isAppWindowOnTop(showWhenLockedApp)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,10 +87,10 @@ class OpenAppFromLockNotificationWithLockOverlayApp(testSpec: FlickerTestParamet
|
||||
fun showWhenLockedAppLayerBecomesVisible() {
|
||||
testSpec.assertLayers {
|
||||
this.isInvisible(showWhenLockedApp)
|
||||
.then()
|
||||
.isVisible(ComponentNameMatcher.SNAPSHOT, isOptional = true)
|
||||
.then()
|
||||
.isVisible(showWhenLockedApp)
|
||||
.then()
|
||||
.isVisible(ComponentNameMatcher.SNAPSHOT, isOptional = true)
|
||||
.then()
|
||||
.isVisible(showWhenLockedApp)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,22 +100,19 @@ class OpenAppFromLockNotificationWithLockOverlayApp(testSpec: FlickerTestParamet
|
||||
override fun entireScreenCovered() = super.entireScreenCovered()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun appWindowBecomesTopWindow() = super.appWindowBecomesTopWindow()
|
||||
@Postsubmit @Test override fun appWindowBecomesTopWindow() = super.appWindowBecomesTopWindow()
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* Creates the test configurations.
|
||||
*
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
|
||||
* repetitions, screen orientation and navigation modes.
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring repetitions,
|
||||
* screen orientation and navigation modes.
|
||||
*/
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests()
|
||||
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,40 +27,26 @@ import org.junit.Assume
|
||||
import org.junit.Ignore
|
||||
import org.junit.Test
|
||||
|
||||
/**
|
||||
* Base class for app launch tests from lock screen
|
||||
*/
|
||||
/** Base class for app launch tests from lock screen */
|
||||
abstract class OpenAppFromLockTransition(testSpec: FlickerTestParameter) :
|
||||
OpenAppTransition(testSpec) {
|
||||
|
||||
/**
|
||||
* Defines the transition used to run the test
|
||||
*/
|
||||
/** Defines the transition used to run the test */
|
||||
override val transition: FlickerBuilder.() -> Unit = {
|
||||
super.transition(this)
|
||||
setup {
|
||||
device.sleep()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withoutTopVisibleAppWindows()
|
||||
.waitForAndVerify()
|
||||
}
|
||||
teardown {
|
||||
testApp.exit(wmHelper)
|
||||
}
|
||||
transitions {
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
wmHelper.StateSyncBuilder().withoutTopVisibleAppWindows().waitForAndVerify()
|
||||
}
|
||||
teardown { testApp.exit(wmHelper) }
|
||||
transitions { testApp.launchViaIntent(wmHelper) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that we go from no focus to focus on the [testApp]
|
||||
*/
|
||||
/** Check that we go from no focus to focus on the [testApp] */
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun focusChanges() {
|
||||
testSpec.assertEventLog {
|
||||
this.focusChanges("", testApp.`package`)
|
||||
}
|
||||
testSpec.assertEventLog { this.focusChanges("", testApp.`package`) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,24 +58,20 @@ abstract class OpenAppFromLockTransition(testSpec: FlickerTestParameter) :
|
||||
open fun appWindowBecomesFirstAndOnlyTopWindow() {
|
||||
testSpec.assertWm {
|
||||
this.hasNoVisibleAppWindow()
|
||||
.then()
|
||||
.isAppWindowOnTop(ComponentNameMatcher.SNAPSHOT, isOptional = true)
|
||||
.then()
|
||||
.isAppWindowOnTop(ComponentNameMatcher.SPLASH_SCREEN, isOptional = true)
|
||||
.then()
|
||||
.isAppWindowOnTop(testApp)
|
||||
.then()
|
||||
.isAppWindowOnTop(ComponentNameMatcher.SNAPSHOT, isOptional = true)
|
||||
.then()
|
||||
.isAppWindowOnTop(ComponentNameMatcher.SPLASH_SCREEN, isOptional = true)
|
||||
.then()
|
||||
.isAppWindowOnTop(testApp)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the screen is locked at the start of the transition
|
||||
*/
|
||||
/** Checks that the screen is locked at the start of the transition */
|
||||
@Presubmit
|
||||
@Test
|
||||
fun screenLockedStart() {
|
||||
testSpec.assertLayersStart {
|
||||
isEmpty()
|
||||
}
|
||||
testSpec.assertLayersStart { isEmpty() }
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@@ -100,26 +82,24 @@ abstract class OpenAppFromLockTransition(testSpec: FlickerTestParameter) :
|
||||
/** {@inheritDoc} */
|
||||
@Test
|
||||
@Ignore("Not applicable to this CUJ. Display starts off and app is full screen at the end")
|
||||
override fun navBarLayerPositionAtStartAndEnd() { }
|
||||
override fun navBarLayerPositionAtStartAndEnd() {}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Test
|
||||
@Ignore("Not applicable to this CUJ. Display starts off and app is full screen at the end")
|
||||
override fun statusBarLayerPositionAtStartAndEnd() { }
|
||||
override fun statusBarLayerPositionAtStartAndEnd() {}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Test
|
||||
@Ignore("Not applicable to this CUJ. Display starts off and app is full screen at the end")
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() { }
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() {}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Test
|
||||
@Ignore("Not applicable to this CUJ. Display starts off and app is full screen at the end")
|
||||
override fun taskBarWindowIsAlwaysVisible() { }
|
||||
override fun taskBarWindowIsAlwaysVisible() {}
|
||||
|
||||
/**
|
||||
* Checks the position of the [ComponentMatcher.NAV_BAR] at the end of the transition
|
||||
*/
|
||||
/** Checks the position of the [ComponentMatcher.NAV_BAR] at the end of the transition */
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun navBarLayerPositionAtEnd() {
|
||||
@@ -127,17 +107,13 @@ abstract class OpenAppFromLockTransition(testSpec: FlickerTestParameter) :
|
||||
testSpec.navBarLayerPositionAtEnd()
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the position of the [ComponentMatcher.STATUS_BAR] at the end of the transition
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarLayerPositionAtEnd() = testSpec.statusBarLayerPositionAtEnd()
|
||||
/** Checks the position of the [ComponentMatcher.STATUS_BAR] at the end of the transition */
|
||||
@Presubmit @Test fun statusBarLayerPositionAtEnd() = testSpec.statusBarLayerPositionAtEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Test
|
||||
@Ignore("Not applicable to this CUJ. Display starts off and app is full screen at the end")
|
||||
override fun statusBarLayerIsVisibleAtStartAndEnd() { }
|
||||
override fun statusBarLayerIsVisibleAtStartAndEnd() {}
|
||||
|
||||
/**
|
||||
* Checks that the [ComponentMatcher.STATUS_BAR] layer is visible at the end of the trace
|
||||
@@ -147,8 +123,6 @@ abstract class OpenAppFromLockTransition(testSpec: FlickerTestParameter) :
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarLayerIsVisibleAtEnd() {
|
||||
testSpec.assertLayersEnd {
|
||||
this.isVisible(ComponentNameMatcher.STATUS_BAR)
|
||||
}
|
||||
testSpec.assertLayersEnd { this.isVisible(ComponentNameMatcher.STATUS_BAR) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,9 +39,8 @@ import org.junit.runners.Parameterized
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
@Postsubmit
|
||||
open class OpenAppFromNotificationCold(
|
||||
testSpec: FlickerTestParameter
|
||||
) : OpenAppFromNotificationWarm(testSpec) {
|
||||
open class OpenAppFromNotificationCold(testSpec: FlickerTestParameter) :
|
||||
OpenAppFromNotificationWarm(testSpec) {
|
||||
/** {@inheritDoc} */
|
||||
override val transition: FlickerBuilder.() -> Unit
|
||||
get() = {
|
||||
@@ -60,14 +59,13 @@ open class OpenAppFromNotificationCold(
|
||||
/**
|
||||
* Creates the test configurations.
|
||||
*
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
|
||||
* repetitions, screen orientation and navigation modes.
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring repetitions,
|
||||
* screen orientation and navigation modes.
|
||||
*/
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests()
|
||||
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,9 +54,8 @@ import org.junit.runners.Parameterized
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
@Postsubmit
|
||||
open class OpenAppFromNotificationWarm(
|
||||
testSpec: FlickerTestParameter
|
||||
) : OpenAppTransition(testSpec) {
|
||||
open class OpenAppFromNotificationWarm(testSpec: FlickerTestParameter) :
|
||||
OpenAppTransition(testSpec) {
|
||||
override val testApp: NotificationAppHelper = NotificationAppHelper(instrumentation)
|
||||
|
||||
open val openingNotificationsFromLockScreen = false
|
||||
@@ -68,14 +67,10 @@ open class OpenAppFromNotificationWarm(
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
this.setRotation(testSpec.startRotation)
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withFullScreenApp(testApp)
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withFullScreenApp(testApp).waitForAndVerify()
|
||||
testApp.postNotification(wmHelper)
|
||||
device.pressHome()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withHomeActivityVisible()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withHomeActivityVisible().waitForAndVerify()
|
||||
}
|
||||
|
||||
transitions {
|
||||
@@ -87,10 +82,10 @@ open class OpenAppFromNotificationWarm(
|
||||
instrumentation.context.getSystemService(WindowManager::class.java)
|
||||
?: error("Unable to connect to WindowManager service")
|
||||
val metricInsets = wm.currentWindowMetrics.windowInsets
|
||||
val insets = metricInsets.getInsetsIgnoringVisibility(
|
||||
WindowInsets.Type.statusBars()
|
||||
or WindowInsets.Type.displayCutout()
|
||||
)
|
||||
val insets =
|
||||
metricInsets.getInsetsIgnoringVisibility(
|
||||
WindowInsets.Type.statusBars() or WindowInsets.Type.displayCutout()
|
||||
)
|
||||
|
||||
startY = insets.top + 100
|
||||
endY = device.displayHeight / 2
|
||||
@@ -104,23 +99,16 @@ open class OpenAppFromNotificationWarm(
|
||||
instrumentation.uiAutomation.syncInputTransactions()
|
||||
|
||||
// Launch the activity by clicking the notification
|
||||
val notification = device.wait(
|
||||
Until.findObject(
|
||||
By.text("Flicker Test Notification")
|
||||
), 2000L
|
||||
)
|
||||
val notification =
|
||||
device.wait(Until.findObject(By.text("Flicker Test Notification")), 2000L)
|
||||
notification?.click() ?: error("Notification not found")
|
||||
instrumentation.uiAutomation.syncInputTransactions()
|
||||
|
||||
// Wait for the app to launch
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withFullScreenApp(testApp)
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withFullScreenApp(testApp).waitForAndVerify()
|
||||
}
|
||||
|
||||
teardown {
|
||||
testApp.exit(wmHelper)
|
||||
}
|
||||
teardown { testApp.exit(wmHelper) }
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@@ -137,8 +125,7 @@ open class OpenAppFromNotificationWarm(
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun statusBarLayerPositionAtStartAndEnd() =
|
||||
super.statusBarLayerPositionAtStartAndEnd()
|
||||
override fun statusBarLayerPositionAtStartAndEnd() = super.statusBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@@ -147,14 +134,10 @@ open class OpenAppFromNotificationWarm(
|
||||
super.visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun appWindowBecomesVisible() = appWindowBecomesVisible_warmStart()
|
||||
@Postsubmit @Test override fun appWindowBecomesVisible() = appWindowBecomesVisible_warmStart()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun appLayerBecomesVisible() = appLayerBecomesVisible_warmStart()
|
||||
@Postsubmit @Test override fun appLayerBecomesVisible() = appLayerBecomesVisible_warmStart()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@@ -162,9 +145,7 @@ open class OpenAppFromNotificationWarm(
|
||||
override fun statusBarWindowIsAlwaysVisible() = super.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun entireScreenCovered() = super.entireScreenCovered()
|
||||
@Postsubmit @Test override fun entireScreenCovered() = super.entireScreenCovered()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@@ -183,33 +164,24 @@ open class OpenAppFromNotificationWarm(
|
||||
super.visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun appWindowIsTopWindowAtEnd() =
|
||||
super.appWindowIsTopWindowAtEnd()
|
||||
@Postsubmit @Test override fun appWindowIsTopWindowAtEnd() = super.appWindowIsTopWindowAtEnd()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
open fun notificationAppWindowVisibleAtEnd() {
|
||||
testSpec.assertWmEnd {
|
||||
this.isAppWindowVisible(testApp)
|
||||
}
|
||||
testSpec.assertWmEnd { this.isAppWindowVisible(testApp) }
|
||||
}
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
open fun notificationAppWindowOnTopAtEnd() {
|
||||
testSpec.assertWmEnd {
|
||||
this.isAppWindowOnTop(testApp)
|
||||
}
|
||||
testSpec.assertWmEnd { this.isAppWindowOnTop(testApp) }
|
||||
}
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
open fun notificationAppLayerVisibleAtEnd() {
|
||||
testSpec.assertLayersEnd {
|
||||
this.isVisible(testApp)
|
||||
}
|
||||
testSpec.assertLayersEnd { this.isVisible(testApp) }
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@@ -241,8 +213,7 @@ open class OpenAppFromNotificationWarm(
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the [ComponentNameMatcher.TASK_BAR] layer is visible at the end of the
|
||||
* transition
|
||||
* Checks that the [ComponentNameMatcher.TASK_BAR] layer is visible at the end of the transition
|
||||
*
|
||||
* Note: Large screen only
|
||||
*/
|
||||
@@ -256,27 +227,24 @@ open class OpenAppFromNotificationWarm(
|
||||
/** {@inheritDoc} */
|
||||
@Test
|
||||
@Ignore("Display is locked at the start")
|
||||
override fun taskBarWindowIsAlwaysVisible() =
|
||||
super.taskBarWindowIsAlwaysVisible()
|
||||
override fun taskBarWindowIsAlwaysVisible() = super.taskBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Test
|
||||
@Ignore("Display is locked at the start")
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() =
|
||||
super.taskBarLayerIsVisibleAtStartAndEnd()
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() = super.taskBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* Creates the test configurations.
|
||||
*
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
|
||||
* repetitions, screen orientation and navigation modes.
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring repetitions,
|
||||
* screen orientation and navigation modes.
|
||||
*/
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests()
|
||||
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,31 +38,31 @@ import org.junit.runners.Parameterized
|
||||
* To run this test: `atest FlickerTests:OpenAppFromOverviewTest`
|
||||
*
|
||||
* Actions:
|
||||
* ```
|
||||
* Launch [testApp]
|
||||
* Press recents
|
||||
* Relaunch an app [testApp] by selecting it in the overview screen, and wait animation to
|
||||
* complete (only this action is traced)
|
||||
*
|
||||
* ```
|
||||
* Notes:
|
||||
* ```
|
||||
* 1. Some default assertions (e.g., nav bar, status bar and screen covered)
|
||||
* are inherited [OpenAppTransition]
|
||||
* 2. Part of the test setup occurs automatically via
|
||||
* [com.android.server.wm.flicker.TransitionRunnerWithRules],
|
||||
* including configuring navigation mode, initial orientation and ensuring no
|
||||
* apps are running before setup
|
||||
* ```
|
||||
*/
|
||||
@RequiresDevice
|
||||
@FlickerServiceCompatible
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
open class OpenAppFromOverviewTest(
|
||||
testSpec: FlickerTestParameter
|
||||
) : OpenAppFromLauncherTransition(testSpec) {
|
||||
open class OpenAppFromOverviewTest(testSpec: FlickerTestParameter) :
|
||||
OpenAppFromLauncherTransition(testSpec) {
|
||||
|
||||
/**
|
||||
* Defines the transition used to run the test
|
||||
*/
|
||||
/** Defines the transition used to run the test */
|
||||
override val transition: FlickerBuilder.() -> Unit
|
||||
get() = {
|
||||
super.transition(this)
|
||||
@@ -70,9 +70,7 @@ open class OpenAppFromOverviewTest(
|
||||
tapl.setExpectedRotationCheckEnabled(false)
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
tapl.goHome()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withHomeActivityVisible()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withHomeActivityVisible().waitForAndVerify()
|
||||
// By default, launcher doesn't rotate on phones, but rotates on tablets
|
||||
if (testSpec.isTablet) {
|
||||
tapl.setExpectedRotation(testSpec.startRotation)
|
||||
@@ -80,23 +78,17 @@ open class OpenAppFromOverviewTest(
|
||||
tapl.setExpectedRotation(Surface.ROTATION_0)
|
||||
}
|
||||
tapl.workspace.switchToOverview()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withRecentsActivityVisible()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withRecentsActivityVisible().waitForAndVerify()
|
||||
this.setRotation(testSpec.startRotation)
|
||||
}
|
||||
transitions {
|
||||
tapl.overview.currentTask.open()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withFullScreenApp(testApp)
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withFullScreenApp(testApp).waitForAndVerify()
|
||||
}
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Presubmit
|
||||
@Test
|
||||
override fun appLayerReplacesLauncher() = super.appLayerReplacesLauncher()
|
||||
@Presubmit @Test override fun appLayerReplacesLauncher() = super.appLayerReplacesLauncher()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@FlakyTest
|
||||
@@ -117,14 +109,13 @@ open class OpenAppFromOverviewTest(
|
||||
/**
|
||||
* Creates the test configurations.
|
||||
*
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
|
||||
* repetitions, screen orientation and navigation modes.
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring repetitions,
|
||||
* screen orientation and navigation modes.
|
||||
*/
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests()
|
||||
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,16 +45,19 @@ import org.junit.runners.Parameterized
|
||||
* To run this test: `atest FlickerTests:OpenAppNonResizeableTest`
|
||||
*
|
||||
* Actions:
|
||||
* ```
|
||||
* Lock the device.
|
||||
* Launch an app on top of the lock screen [testApp] and wait animation to complete
|
||||
*
|
||||
* ```
|
||||
* Notes:
|
||||
* ```
|
||||
* 1. Some default assertions (e.g., nav bar, status bar and screen covered)
|
||||
* are inherited [OpenAppTransition]
|
||||
* 2. Part of the test setup occurs automatically via
|
||||
* [com.android.server.wm.flicker.TransitionRunnerWithRules],
|
||||
* including configuring navigation mode, initial orientation and ensuring no
|
||||
* apps are running before setup
|
||||
* ```
|
||||
*/
|
||||
@RequiresDevice
|
||||
@FlickerServiceCompatible
|
||||
@@ -80,15 +83,11 @@ open class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) :
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if [testApp] is visible at the end of the transition
|
||||
*/
|
||||
/** Checks if [testApp] is visible at the end of the transition */
|
||||
@Presubmit
|
||||
@Test
|
||||
fun appWindowBecomesVisibleAtEnd() {
|
||||
testSpec.assertWmEnd {
|
||||
this.isAppWindowVisible(testApp)
|
||||
}
|
||||
testSpec.assertWmEnd { this.isAppWindowVisible(testApp) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,9 +113,7 @@ open class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) :
|
||||
@Test
|
||||
fun taskBarLayerIsVisibleAtEnd() {
|
||||
Assume.assumeTrue(testSpec.isTablet)
|
||||
testSpec.assertLayersEnd {
|
||||
this.isVisible(ComponentNameMatcher.TASK_BAR)
|
||||
}
|
||||
testSpec.assertLayersEnd { this.isVisible(ComponentNameMatcher.TASK_BAR) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,59 +124,43 @@ open class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) :
|
||||
@Presubmit
|
||||
@Test
|
||||
override fun statusBarLayerIsVisibleAtStartAndEnd() {
|
||||
testSpec.assertLayersEnd {
|
||||
this.isVisible(ComponentNameMatcher.STATUS_BAR)
|
||||
}
|
||||
testSpec.assertLayersEnd { this.isVisible(ComponentNameMatcher.STATUS_BAR) }
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Test
|
||||
@Ignore("Not applicable to this CUJ. Display starts off and app is full screen at the end")
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() {
|
||||
}
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() {}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Test
|
||||
@Ignore("Not applicable to this CUJ. Display starts off and app is full screen at the end")
|
||||
override fun navBarLayerIsVisibleAtStartAndEnd() {
|
||||
}
|
||||
override fun navBarLayerIsVisibleAtStartAndEnd() {}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Test
|
||||
@Ignore("Not applicable to this CUJ. Display starts off and app is full screen at the end")
|
||||
override fun taskBarWindowIsAlwaysVisible() {
|
||||
}
|
||||
override fun taskBarWindowIsAlwaysVisible() {}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Test
|
||||
@Ignore("Not applicable to this CUJ. Display starts off and app is full screen at the end")
|
||||
override fun navBarWindowIsAlwaysVisible() {
|
||||
}
|
||||
override fun navBarWindowIsAlwaysVisible() {}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Test
|
||||
@Ignore("Not applicable to this CUJ. Display starts off and app is full screen at the end")
|
||||
override fun statusBarWindowIsAlwaysVisible() {
|
||||
}
|
||||
override fun statusBarWindowIsAlwaysVisible() {}
|
||||
|
||||
/**
|
||||
* Checks the position of the [ComponentMatcher.STATUS_BAR] at the end of the
|
||||
* transition
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarLayerPositionEnd() = testSpec.statusBarLayerPositionAtEnd()
|
||||
/** Checks the position of the [ComponentMatcher.STATUS_BAR] at the end of the transition */
|
||||
@Presubmit @Test fun statusBarLayerPositionEnd() = testSpec.statusBarLayerPositionAtEnd()
|
||||
|
||||
/**
|
||||
* Checks the [ComponentMatcher.NAV_BAR] is visible at the end of the transition
|
||||
*/
|
||||
/** Checks the [ComponentMatcher.NAV_BAR] is visible at the end of the transition */
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun navBarLayerIsVisibleAtEnd() {
|
||||
Assume.assumeFalse(testSpec.isTablet)
|
||||
testSpec.assertLayersEnd {
|
||||
this.isVisible(ComponentNameMatcher.NAV_BAR)
|
||||
}
|
||||
testSpec.assertLayersEnd { this.isVisible(ComponentNameMatcher.NAV_BAR) }
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@@ -205,9 +186,7 @@ open class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) :
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@FlakyTest
|
||||
@Test
|
||||
override fun entireScreenCovered() = super.entireScreenCovered()
|
||||
@FlakyTest @Test override fun entireScreenCovered() = super.entireScreenCovered()
|
||||
|
||||
@FlakyTest(bugId = 218470989)
|
||||
@Test
|
||||
@@ -216,23 +195,22 @@ open class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) :
|
||||
|
||||
@FlakyTest(bugId = 227143265)
|
||||
@Test
|
||||
override fun appWindowBecomesTopWindow() =
|
||||
super.appWindowBecomesTopWindow()
|
||||
override fun appWindowBecomesTopWindow() = super.appWindowBecomesTopWindow()
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* Creates the test configurations.
|
||||
*
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
|
||||
* repetitions, screen orientation and navigation modes.
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring repetitions,
|
||||
* screen orientation and navigation modes.
|
||||
*/
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(
|
||||
supportedNavigationModes =
|
||||
listOf(WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY),
|
||||
supportedNavigationModes =
|
||||
listOf(WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY),
|
||||
supportedRotations = listOf(Surface.ROTATION_0)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -27,9 +27,7 @@ import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
|
||||
import com.android.server.wm.traces.common.ComponentNameMatcher
|
||||
import org.junit.Test
|
||||
|
||||
/**
|
||||
* Base class for app launch tests
|
||||
*/
|
||||
/** Base class for app launch tests */
|
||||
abstract class OpenAppTransition(testSpec: FlickerTestParameter) : BaseTest(testSpec) {
|
||||
protected open val testApp: StandardAppHelper = SimpleAppHelper(instrumentation)
|
||||
|
||||
@@ -40,14 +38,12 @@ abstract class OpenAppTransition(testSpec: FlickerTestParameter) : BaseTest(test
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
this.setRotation(testSpec.startRotation)
|
||||
}
|
||||
teardown {
|
||||
testApp.exit(wmHelper)
|
||||
}
|
||||
teardown { testApp.exit(wmHelper) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the [testApp] layer doesn't exist or is invisible at the start of the
|
||||
* transition, but is created and/or becomes visible during the transition.
|
||||
* Checks that the [testApp] layer doesn't exist or is invisible at the start of the transition,
|
||||
* but is created and/or becomes visible during the transition.
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
@@ -85,12 +81,10 @@ abstract class OpenAppTransition(testSpec: FlickerTestParameter) : BaseTest(test
|
||||
* Checks that the [testApp] window doesn't exist at the start of the transition, that it is
|
||||
* created (invisible - optional) and becomes visible during the transition
|
||||
*
|
||||
* The `isAppWindowInvisible` step is optional because we log once per frame, upon logging,
|
||||
* the window may be visible or not depending on what was processed until that moment.
|
||||
* The `isAppWindowInvisible` step is optional because we log once per frame, upon logging, the
|
||||
* window may be visible or not depending on what was processed until that moment.
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun appWindowBecomesVisible() = appWindowBecomesVisible_coldStart()
|
||||
@Presubmit @Test open fun appWindowBecomesVisible() = appWindowBecomesVisible_coldStart()
|
||||
|
||||
protected fun appWindowBecomesVisible_coldStart() {
|
||||
testSpec.assertWm {
|
||||
@@ -125,9 +119,7 @@ abstract class OpenAppTransition(testSpec: FlickerTestParameter) : BaseTest(test
|
||||
this.isAppWindowNotOnTop(testApp)
|
||||
.then()
|
||||
.isAppWindowOnTop(
|
||||
testApp
|
||||
.or(ComponentNameMatcher.SNAPSHOT)
|
||||
.or(ComponentNameMatcher.SPLASH_SCREEN)
|
||||
testApp.or(ComponentNameMatcher.SNAPSHOT).or(ComponentNameMatcher.SPLASH_SCREEN)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -139,8 +131,6 @@ abstract class OpenAppTransition(testSpec: FlickerTestParameter) : BaseTest(test
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun appWindowIsTopWindowAtEnd() {
|
||||
testSpec.assertWmEnd {
|
||||
this.isAppWindowOnTop(testApp)
|
||||
}
|
||||
testSpec.assertWmEnd { this.isAppWindowOnTop(testApp) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,17 +37,20 @@ import org.junit.runners.Parameterized
|
||||
* To run this test: `atest FlickerTests:OpenAppWarmTest`
|
||||
*
|
||||
* Actions:
|
||||
* ```
|
||||
* Launch [testApp]
|
||||
* Press home
|
||||
* Relaunch an app [testApp] and wait animation to complete (only this action is traced)
|
||||
*
|
||||
* ```
|
||||
* Notes:
|
||||
* ```
|
||||
* 1. Some default assertions (e.g., nav bar, status bar and screen covered)
|
||||
* are inherited [OpenAppTransition]
|
||||
* 2. Part of the test setup occurs automatically via
|
||||
* [com.android.server.wm.flicker.TransitionRunnerWithRules],
|
||||
* including configuring navigation mode, initial orientation and ensuring no
|
||||
* apps are running before setup
|
||||
* ```
|
||||
*/
|
||||
@RequiresDevice
|
||||
@FlickerServiceCompatible
|
||||
@@ -56,9 +59,7 @@ import org.junit.runners.Parameterized
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
open class OpenAppWarmTest(testSpec: FlickerTestParameter) :
|
||||
OpenAppFromLauncherTransition(testSpec) {
|
||||
/**
|
||||
* Defines the transition used to run the test
|
||||
*/
|
||||
/** Defines the transition used to run the test */
|
||||
override val transition: FlickerBuilder.() -> Unit
|
||||
get() = {
|
||||
super.transition(this)
|
||||
@@ -66,17 +67,11 @@ open class OpenAppWarmTest(testSpec: FlickerTestParameter) :
|
||||
tapl.setExpectedRotationCheckEnabled(false)
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
tapl.goHome()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withHomeActivityVisible()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withHomeActivityVisible().waitForAndVerify()
|
||||
this.setRotation(testSpec.startRotation)
|
||||
}
|
||||
teardown {
|
||||
testApp.exit(wmHelper)
|
||||
}
|
||||
transitions {
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
}
|
||||
teardown { testApp.exit(wmHelper) }
|
||||
transitions { testApp.launchViaIntent(wmHelper) }
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@@ -85,9 +80,7 @@ open class OpenAppWarmTest(testSpec: FlickerTestParameter) :
|
||||
override fun navBarLayerPositionAtStartAndEnd() = super.navBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Presubmit
|
||||
@Test
|
||||
override fun appLayerReplacesLauncher() = super.appLayerReplacesLauncher()
|
||||
@Presubmit @Test override fun appLayerReplacesLauncher() = super.appLayerReplacesLauncher()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Presubmit
|
||||
@@ -103,14 +96,13 @@ open class OpenAppWarmTest(testSpec: FlickerTestParameter) :
|
||||
/**
|
||||
* Creates the test configurations.
|
||||
*
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
|
||||
* repetitions, screen orientation and navigation modes.
|
||||
* See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring repetitions,
|
||||
* screen orientation and navigation modes.
|
||||
*/
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests()
|
||||
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,9 @@ import org.junit.runners.Parameterized
|
||||
* To run this test: `atest FlickerTests:OverrideTaskTransitionTest`
|
||||
*
|
||||
* Actions:
|
||||
* ```
|
||||
* Launches SimpleActivity with alpha_2000ms animation
|
||||
* ```
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@@ -70,16 +72,17 @@ class OverrideTaskTransitionTest(val testSpec: FlickerTestParameter) {
|
||||
}
|
||||
transitions {
|
||||
instrumentation.context.startActivity(
|
||||
testApp.openAppIntent, createCustomTaskAnimation())
|
||||
wmHelper.StateSyncBuilder()
|
||||
.add(WindowManagerConditionsFactory.isWMStateComplete())
|
||||
.withAppTransitionIdle()
|
||||
.withWindowSurfaceAppeared(testApp)
|
||||
.waitForAndVerify()
|
||||
}
|
||||
teardown {
|
||||
testApp.exit()
|
||||
testApp.openAppIntent,
|
||||
createCustomTaskAnimation()
|
||||
)
|
||||
wmHelper
|
||||
.StateSyncBuilder()
|
||||
.add(WindowManagerConditionsFactory.isWMStateComplete())
|
||||
.withAppTransitionIdle()
|
||||
.withWindowSurfaceAppeared(testApp)
|
||||
.waitForAndVerify()
|
||||
}
|
||||
teardown { testApp.exit() }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,16 +101,22 @@ class OverrideTaskTransitionTest(val testSpec: FlickerTestParameter) {
|
||||
}
|
||||
|
||||
private fun createCustomTaskAnimation(): Bundle {
|
||||
return android.app.ActivityOptions.makeCustomTaskAnimation(instrumentation.context,
|
||||
R.anim.show_2000ms, 0, Handler.getMain(), null, null).toBundle()
|
||||
return android.app.ActivityOptions.makeCustomTaskAnimation(
|
||||
instrumentation.context,
|
||||
R.anim.show_2000ms,
|
||||
0,
|
||||
Handler.getMain(),
|
||||
null,
|
||||
null
|
||||
)
|
||||
.toBundle()
|
||||
}
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests()
|
||||
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,9 +45,11 @@ import org.junit.runners.Parameterized
|
||||
* To run this test: `atest FlickerTests:ActivitiesTransitionTest`
|
||||
*
|
||||
* Actions:
|
||||
* ```
|
||||
* Launch the NewTaskLauncherApp [mTestApp]
|
||||
* Open a new task (SimpleActivity) from the NewTaskLauncherApp [mTestApp]
|
||||
* Go back to the NewTaskLauncherApp [mTestApp]
|
||||
* ```
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@@ -61,36 +63,28 @@ class TaskTransitionTest(testSpec: FlickerTestParameter) : BaseTest(testSpec) {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
override val transition: FlickerBuilder.() -> Unit = {
|
||||
setup {
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
}
|
||||
teardown {
|
||||
testApp.exit(wmHelper)
|
||||
}
|
||||
setup { testApp.launchViaIntent(wmHelper) }
|
||||
teardown { testApp.exit(wmHelper) }
|
||||
transitions {
|
||||
testApp.openNewTask(device, wmHelper)
|
||||
tapl.pressBack()
|
||||
wmHelper.StateSyncBuilder()
|
||||
.withAppTransitionIdle()
|
||||
.waitForAndVerify()
|
||||
wmHelper.StateSyncBuilder().withAppTransitionIdle().waitForAndVerify()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the [wallpaper] window is never visible when performing task transitions.
|
||||
* A solid color background should be shown instead.
|
||||
* Checks that the [wallpaper] window is never visible when performing task transitions. A solid
|
||||
* color background should be shown instead.
|
||||
*/
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun wallpaperWindowIsNeverVisible() {
|
||||
testSpec.assertWm {
|
||||
this.isNonAppWindowInvisible(wallpaper)
|
||||
}
|
||||
testSpec.assertWm { this.isNonAppWindowInvisible(wallpaper) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the [wallpaper] layer is never visible when performing task transitions.
|
||||
* A solid color background should be shown instead.
|
||||
* Checks that the [wallpaper] layer is never visible when performing task transitions. A solid
|
||||
* color background should be shown instead.
|
||||
*/
|
||||
@Postsubmit
|
||||
@Test
|
||||
@@ -103,33 +97,25 @@ class TaskTransitionTest(testSpec: FlickerTestParameter) : BaseTest(testSpec) {
|
||||
|
||||
/**
|
||||
* Check that the [ComponentNameMatcher.LAUNCHER] window is never visible when performing task
|
||||
* transitions.
|
||||
* A solid color background should be shown above it.
|
||||
* transitions. A solid color background should be shown above it.
|
||||
*/
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun launcherWindowIsNeverVisible() {
|
||||
testSpec.assertWm {
|
||||
this.isAppWindowInvisible(ComponentNameMatcher.LAUNCHER)
|
||||
}
|
||||
testSpec.assertWm { this.isAppWindowInvisible(ComponentNameMatcher.LAUNCHER) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the [ComponentNameMatcher.LAUNCHER] layer is never visible when performing task
|
||||
* transitions.
|
||||
* A solid color background should be shown above it.
|
||||
* transitions. A solid color background should be shown above it.
|
||||
*/
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun launcherLayerIsNeverVisible() {
|
||||
testSpec.assertLayers {
|
||||
this.isInvisible(ComponentNameMatcher.LAUNCHER)
|
||||
}
|
||||
testSpec.assertLayers { this.isInvisible(ComponentNameMatcher.LAUNCHER) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that a color background is visible while the task transition is occurring.
|
||||
*/
|
||||
/** Checks that a color background is visible while the task transition is occurring. */
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun colorLayerIsVisibleDuringTransition() {
|
||||
@@ -138,8 +124,8 @@ class TaskTransitionTest(testSpec: FlickerTestParameter) : BaseTest(testSpec) {
|
||||
|
||||
testSpec.assertLayers {
|
||||
this.invoke("LAUNCH_NEW_TASK_ACTIVITY coversExactly displayBounds") {
|
||||
it.visibleRegion(LAUNCH_NEW_TASK_ACTIVITY).coversExactly(displayBounds)
|
||||
}
|
||||
it.visibleRegion(LAUNCH_NEW_TASK_ACTIVITY).coversExactly(displayBounds)
|
||||
}
|
||||
.isInvisible(bgColorLayer)
|
||||
.then()
|
||||
// Transitioning
|
||||
@@ -163,8 +149,8 @@ class TaskTransitionTest(testSpec: FlickerTestParameter) : BaseTest(testSpec) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that we start with the LaunchNewTask activity on top and then open up
|
||||
* the SimpleActivity and then go back to the LaunchNewTask activity.
|
||||
* Checks that we start with the LaunchNewTask activity on top and then open up the
|
||||
* SimpleActivity and then go back to the LaunchNewTask activity.
|
||||
*/
|
||||
@Postsubmit
|
||||
@Test
|
||||
@@ -183,9 +169,7 @@ class TaskTransitionTest(testSpec: FlickerTestParameter) : BaseTest(testSpec) {
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun entireScreenCovered() = super.entireScreenCovered()
|
||||
@Postsubmit @Test override fun entireScreenCovered() = super.entireScreenCovered()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@@ -206,8 +190,7 @@ class TaskTransitionTest(testSpec: FlickerTestParameter) : BaseTest(testSpec) {
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun statusBarLayerPositionAtStartAndEnd() =
|
||||
super.statusBarLayerPositionAtStartAndEnd()
|
||||
override fun statusBarLayerPositionAtStartAndEnd() = super.statusBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@@ -255,8 +238,7 @@ class TaskTransitionTest(testSpec: FlickerTestParameter) : BaseTest(testSpec) {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests()
|
||||
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,18 +45,17 @@ import org.junit.runners.Parameterized
|
||||
* To run this test: `atest FlickerTests:QuickSwitchBetweenTwoAppsBackTest`
|
||||
*
|
||||
* Actions:
|
||||
* ```
|
||||
* Launch an app [testApp1]
|
||||
* Launch another app [testApp2]
|
||||
* Swipe right from the bottom of the screen to quick switch back to the first app [testApp1]
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
open class QuickSwitchBetweenTwoAppsBackTest(
|
||||
testSpec: FlickerTestParameter
|
||||
) : BaseTest(testSpec) {
|
||||
open class QuickSwitchBetweenTwoAppsBackTest(testSpec: FlickerTestParameter) : BaseTest(testSpec) {
|
||||
private val testApp1 = SimpleAppHelper(instrumentation)
|
||||
private val testApp2 = NonResizeableAppHelper(instrumentation)
|
||||
|
||||
@@ -71,12 +70,13 @@ open class QuickSwitchBetweenTwoAppsBackTest(
|
||||
tapl.setExpectedRotation(testSpec.startRotation)
|
||||
testApp1.launchViaIntent(wmHelper)
|
||||
testApp2.launchViaIntent(wmHelper)
|
||||
startDisplayBounds = wmHelper.currentState.layerState
|
||||
.physicalDisplayBounds ?: error("Display not found")
|
||||
startDisplayBounds =
|
||||
wmHelper.currentState.layerState.physicalDisplayBounds ?: error("Display not found")
|
||||
}
|
||||
transitions {
|
||||
tapl.launchedAppState.quickSwitchToPreviousApp()
|
||||
wmHelper.StateSyncBuilder()
|
||||
wmHelper
|
||||
.StateSyncBuilder()
|
||||
.withFullScreenApp(testApp1)
|
||||
.withNavOrTaskBarVisible()
|
||||
.withStatusBarVisible()
|
||||
@@ -96,9 +96,7 @@ open class QuickSwitchBetweenTwoAppsBackTest(
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun startsWithApp2WindowsCoverFullScreen() {
|
||||
testSpec.assertWmStart {
|
||||
this.visibleRegion(testApp2).coversExactly(startDisplayBounds)
|
||||
}
|
||||
testSpec.assertWmStart { this.visibleRegion(testApp2).coversExactly(startDisplayBounds) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,15 +111,11 @@ open class QuickSwitchBetweenTwoAppsBackTest(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the transition starts with [testApp2] being the top window.
|
||||
*/
|
||||
/** Checks that the transition starts with [testApp2] being the top window. */
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun startsWithApp2WindowBeingOnTop() {
|
||||
testSpec.assertWmStart {
|
||||
this.isAppWindowOnTop(testApp2)
|
||||
}
|
||||
testSpec.assertWmStart { this.isAppWindowOnTop(testApp2) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,21 +125,17 @@ open class QuickSwitchBetweenTwoAppsBackTest(
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun endsWithApp1WindowsCoveringFullScreen() {
|
||||
testSpec.assertWmEnd {
|
||||
this.visibleRegion(testApp1).coversExactly(startDisplayBounds)
|
||||
}
|
||||
testSpec.assertWmEnd { this.visibleRegion(testApp1).coversExactly(startDisplayBounds) }
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
fun endsWithApp1LayersCoveringFullScreen() {
|
||||
testSpec.assertLayersEnd {
|
||||
this.visibleRegion(testApp1).coversExactly(startDisplayBounds)
|
||||
}
|
||||
testSpec.assertLayersEnd { this.visibleRegion(testApp1).coversExactly(startDisplayBounds) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -155,14 +145,12 @@ open class QuickSwitchBetweenTwoAppsBackTest(
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun endsWithApp1BeingOnTop() {
|
||||
testSpec.assertWmEnd {
|
||||
this.isAppWindowOnTop(testApp1)
|
||||
}
|
||||
testSpec.assertWmEnd { this.isAppWindowOnTop(testApp1) }
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
@@ -177,45 +165,35 @@ open class QuickSwitchBetweenTwoAppsBackTest(
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
open fun app1LayerBecomesAndStaysVisible() {
|
||||
testSpec.assertLayers {
|
||||
this.isInvisible(testApp1)
|
||||
.then()
|
||||
.isVisible(testApp1)
|
||||
}
|
||||
testSpec.assertLayers { this.isInvisible(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
|
||||
open fun app2WindowBecomesAndStaysInvisible() {
|
||||
testSpec.assertWm {
|
||||
this.isAppWindowVisible(testApp2)
|
||||
.then()
|
||||
.isAppWindowInvisible(testApp2)
|
||||
this.isAppWindowVisible(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
|
||||
open fun app2LayerBecomesAndStaysInvisible() {
|
||||
testSpec.assertLayers {
|
||||
this.isVisible(testApp2)
|
||||
.then()
|
||||
.isInvisible(testApp2)
|
||||
}
|
||||
testSpec.assertLayers { this.isVisible(testApp2).then().isInvisible(testApp2) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -274,9 +252,8 @@ open class QuickSwitchBetweenTwoAppsBackTest(
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(
|
||||
supportedNavigationModes = listOf(
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
|
||||
),
|
||||
supportedNavigationModes =
|
||||
listOf(WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY),
|
||||
supportedRotations = listOf(Surface.ROTATION_0, Surface.ROTATION_90)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -38,18 +38,18 @@ import org.junit.runners.Parameterized
|
||||
* To run this test: `atest FlickerTests:QuickSwitchBetweenTwoAppsBackTest`
|
||||
*
|
||||
* Actions:
|
||||
* ```
|
||||
* Launch an app [testApp1]
|
||||
* Launch another app [testApp2]
|
||||
* Swipe right from the bottom of the screen to quick switch back to the first app [testApp1]
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
open class QuickSwitchBetweenTwoAppsBackTest_ShellTransit(
|
||||
testSpec: FlickerTestParameter
|
||||
) : QuickSwitchBetweenTwoAppsBackTest(testSpec) {
|
||||
open class QuickSwitchBetweenTwoAppsBackTest_ShellTransit(testSpec: FlickerTestParameter) :
|
||||
QuickSwitchBetweenTwoAppsBackTest(testSpec) {
|
||||
@Before
|
||||
override fun before() {
|
||||
Assume.assumeTrue(isShellTransitionsEnabled)
|
||||
@@ -61,8 +61,8 @@ open class QuickSwitchBetweenTwoAppsBackTest_ShellTransit(
|
||||
override fun navBarWindowIsAlwaysVisible() = super.navBarWindowIsAlwaysVisible()
|
||||
|
||||
/**
|
||||
* Checks that [ComponentMatcher.NAV_BAR] window is visible and above the app windows at the start
|
||||
* and end of the WM trace
|
||||
* Checks that [ComponentMatcher.NAV_BAR] window is visible and above the app windows at the
|
||||
* start and end of the WM trace
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user