Merge "Unify ComponentMatcher / WM / SF trace and state API"

This commit is contained in:
Nataniel Borges
2022-07-12 10:30:54 +00:00
committed by Android (Google) Code Review
73 changed files with 500 additions and 516 deletions

View File

@@ -20,7 +20,7 @@ package com.android.wm.shell.flicker
import android.view.Surface
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.IComponentMatcher
import com.android.server.wm.traces.common.region.Region
fun FlickerTestParameter.appPairsDividerIsVisibleAtEnd() {
@@ -48,7 +48,7 @@ fun FlickerTestParameter.splitScreenDividerBecomesVisible() {
}
fun FlickerTestParameter.layerBecomesVisible(
component: FlickerComponentName
component: IComponentMatcher
) {
assertLayers {
this.isInvisible(component)
@@ -58,7 +58,7 @@ fun FlickerTestParameter.layerBecomesVisible(
}
fun FlickerTestParameter.layerIsVisibleAtEnd(
component: FlickerComponentName
component: IComponentMatcher
) {
assertLayersEnd {
this.isVisible(component)
@@ -67,7 +67,7 @@ fun FlickerTestParameter.layerIsVisibleAtEnd(
fun FlickerTestParameter.splitAppLayerBoundsBecomesVisible(
rotation: Int,
component: FlickerComponentName,
component: IComponentMatcher,
splitLeftTop: Boolean
) {
assertLayers {
@@ -88,7 +88,7 @@ fun FlickerTestParameter.splitAppLayerBoundsBecomesVisible(
fun FlickerTestParameter.splitAppLayerBoundsIsVisibleAtEnd(
rotation: Int,
component: FlickerComponentName,
component: IComponentMatcher,
splitLeftTop: Boolean
) {
assertLayersEnd {
@@ -104,7 +104,7 @@ fun FlickerTestParameter.splitAppLayerBoundsIsVisibleAtEnd(
}
fun FlickerTestParameter.appWindowBecomesVisible(
component: FlickerComponentName
component: IComponentMatcher
) {
assertWm {
this.isAppWindowInvisible(component)
@@ -114,7 +114,7 @@ fun FlickerTestParameter.appWindowBecomesVisible(
}
fun FlickerTestParameter.appWindowIsVisibleAtEnd(
component: FlickerComponentName
component: IComponentMatcher
) {
assertWmEnd {
this.isAppWindowVisible(component)
@@ -151,7 +151,7 @@ fun FlickerTestParameter.dockedStackDividerNotExistsAtEnd() {
fun FlickerTestParameter.appPairsPrimaryBoundsIsVisibleAtEnd(
rotation: Int,
primaryComponent: FlickerComponentName
primaryComponent: IComponentMatcher
) {
assertLayersEnd {
val dividerRegion = layer(APP_PAIR_SPLIT_DIVIDER_COMPONENT).visibleRegion.region
@@ -162,7 +162,7 @@ fun FlickerTestParameter.appPairsPrimaryBoundsIsVisibleAtEnd(
fun FlickerTestParameter.dockedStackPrimaryBoundsIsVisibleAtEnd(
rotation: Int,
primaryComponent: FlickerComponentName
primaryComponent: IComponentMatcher
) {
assertLayersEnd {
val dividerRegion = layer(DOCKED_STACK_DIVIDER_COMPONENT).visibleRegion.region
@@ -173,7 +173,7 @@ fun FlickerTestParameter.dockedStackPrimaryBoundsIsVisibleAtEnd(
fun FlickerTestParameter.appPairsSecondaryBoundsIsVisibleAtEnd(
rotation: Int,
secondaryComponent: FlickerComponentName
secondaryComponent: IComponentMatcher
) {
assertLayersEnd {
val dividerRegion = layer(APP_PAIR_SPLIT_DIVIDER_COMPONENT).visibleRegion.region
@@ -184,7 +184,7 @@ fun FlickerTestParameter.appPairsSecondaryBoundsIsVisibleAtEnd(
fun FlickerTestParameter.dockedStackSecondaryBoundsIsVisibleAtEnd(
rotation: Int,
secondaryComponent: FlickerComponentName
secondaryComponent: IComponentMatcher
) {
assertLayersEnd {
val dividerRegion = layer(DOCKED_STACK_DIVIDER_COMPONENT).visibleRegion.region

View File

@@ -17,9 +17,9 @@
@file:JvmName("CommonConstants")
package com.android.wm.shell.flicker
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.ComponentMatcher
const val SYSTEM_UI_PACKAGE_NAME = "com.android.systemui"
val APP_PAIR_SPLIT_DIVIDER_COMPONENT = FlickerComponentName("", "AppPairSplitDivider#")
val DOCKED_STACK_DIVIDER_COMPONENT = FlickerComponentName("", "DockedStackDivider#")
val SPLIT_SCREEN_DIVIDER_COMPONENT = FlickerComponentName("", "StageCoordinatorSplitDivider#")
val APP_PAIR_SPLIT_DIVIDER_COMPONENT = ComponentMatcher("", "AppPairSplitDivider#")
val DOCKED_STACK_DIVIDER_COMPONENT = ComponentMatcher("", "DockedStackDivider#")
val SPLIT_SCREEN_DIVIDER_COMPONENT = ComponentMatcher("", "StageCoordinatorSplitDivider#")

View File

@@ -28,8 +28,8 @@ import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.annotation.Group4
import com.android.server.wm.flicker.dsl.FlickerBuilder
import org.junit.runner.RunWith
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
/**
@@ -70,7 +70,7 @@ open class DismissBubbleScreen(testSpec: FlickerTestParameter) : BaseBubbleScree
@Test
open fun testAppIsAlwaysVisible() {
testSpec.assertLayers {
this.isVisible(testApp.component)
this.isVisible(testApp)
}
}
}

View File

@@ -24,8 +24,8 @@ import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.annotation.Group4
import com.android.server.wm.flicker.dsl.FlickerBuilder
import org.junit.runner.RunWith
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
/**
@@ -63,7 +63,7 @@ open class ExpandBubbleScreen(testSpec: FlickerTestParameter) : BaseBubbleScreen
@Test
open fun testAppIsAlwaysVisible() {
testSpec.assertLayers {
this.isVisible(testApp.component)
this.isVisible(testApp)
}
}
}

View File

@@ -90,7 +90,7 @@ class LaunchBubbleFromLockScreen(testSpec: FlickerTestParameter) : BaseBubbleScr
fun testAppIsVisibleAtEnd() {
Assume.assumeFalse(isShellTransitionsEnabled)
testSpec.assertLayersEnd {
this.isVisible(testApp.component)
this.isVisible(testApp)
}
}
@@ -99,7 +99,7 @@ class LaunchBubbleFromLockScreen(testSpec: FlickerTestParameter) : BaseBubbleScr
fun testAppIsVisibleAtEnd_ShellTransit() {
Assume.assumeTrue(isShellTransitionsEnabled)
testSpec.assertLayersEnd {
this.isVisible(testApp.component)
this.isVisible(testApp)
}
}
}

View File

@@ -53,7 +53,7 @@ open class LaunchBubbleScreen(testSpec: FlickerTestParameter) : BaseBubbleScreen
@Test
open fun testAppIsAlwaysVisible() {
testSpec.assertLayers {
this.isVisible(testApp.component)
this.isVisible(testApp)
}
}
}

View File

@@ -28,8 +28,8 @@ import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.isShellTransitionsEnabled
import org.junit.Assume
import org.junit.Before
import org.junit.runner.RunWith
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
/**
@@ -79,7 +79,7 @@ open class MultiBubblesScreen(testSpec: FlickerTestParameter) : BaseBubbleScreen
@Test
open fun testAppIsAlwaysVisible() {
testSpec.assertLayers {
this.isVisible(testApp.component)
this.isVisible(testApp)
}
}
}

View File

@@ -17,10 +17,10 @@
package com.android.wm.shell.flicker.helpers
import android.app.Instrumentation
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.IComponentMatcher
class AppPairsHelper(
instrumentation: Instrumentation,
activityLabel: String,
component: FlickerComponentName
component: IComponentMatcher
) : BaseAppHelper(instrumentation, activityLabel, component)

View File

@@ -19,7 +19,6 @@ package com.android.wm.shell.flicker.helpers
import android.app.Instrumentation
import android.content.pm.PackageManager.FEATURE_LEANBACK
import android.content.pm.PackageManager.FEATURE_LEANBACK_ONLY
import android.os.SystemProperties
import android.support.test.launcherhelper.LauncherStrategyFactory
import android.util.Log
import androidx.test.uiautomator.By
@@ -27,13 +26,13 @@ import androidx.test.uiautomator.UiObject2
import androidx.test.uiautomator.Until
import com.android.compatibility.common.util.SystemUtil
import com.android.server.wm.flicker.helpers.StandardAppHelper
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.IComponentMatcher
import java.io.IOException
abstract class BaseAppHelper(
instrumentation: Instrumentation,
launcherName: String,
component: FlickerComponentName
component: IComponentMatcher
) : StandardAppHelper(
instrumentation,
launcherName,
@@ -48,7 +47,7 @@ abstract class BaseAppHelper(
}
val defaultWindowName: String
get() = component.toWindowName()
get() = toWindowName()
val ui: UiObject2?
get() = uiDevice.findObject(appSelector)
@@ -60,9 +59,6 @@ abstract class BaseAppHelper(
companion object {
private const val APP_CLOSE_WAIT_TIME_MS = 3_000L
fun isShellTransitionsEnabled() =
SystemProperties.getBoolean("persist.wm.debug.shell_transit", false)
fun executeShellCommand(instrumentation: Instrumentation, cmd: String) {
try {
SystemUtil.runShellCommand(instrumentation, cmd)

View File

@@ -19,12 +19,12 @@ package com.android.wm.shell.flicker.helpers
import android.app.Instrumentation
import android.content.Context
import android.provider.Settings
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.IComponentMatcher
class MultiWindowHelper(
instrumentation: Instrumentation,
activityLabel: String,
componentsInfo: FlickerComponentName
componentsInfo: IComponentMatcher
) : BaseAppHelper(instrumentation, activityLabel, componentsInfo) {
companion object {

View File

@@ -149,7 +149,7 @@ class PipAppHelper(instrumentation: Instrumentation) : BaseAppHelper(
}
private fun getWindowRect(wmHelper: WindowManagerStateHelper): Rect {
val windowRegion = wmHelper.getWindowRegion(component)
val windowRegion = wmHelper.getWindowRegion(this)
require(!windowRegion.isEmpty) {
"Unable to find a PIP window in the current state"
}
@@ -196,7 +196,7 @@ class PipAppHelper(instrumentation: Instrumentation) : BaseAppHelper(
uiDevice.click(expandButtonBounds.centerX(), expandButtonBounds.centerY())
wmHelper.StateSyncBuilder()
.withPipGone()
.withFullScreenApp(component)
.withFullScreenApp(this)
.waitForAndVerify()
}

View File

@@ -26,17 +26,16 @@ import androidx.test.uiautomator.BySelector
import androidx.test.uiautomator.UiDevice
import androidx.test.uiautomator.Until
import com.android.launcher3.tapl.LauncherInstrumentation
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.IComponentMatcher
import com.android.server.wm.traces.parser.toFlickerComponent
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
import com.android.wm.shell.flicker.SYSTEM_UI_PACKAGE_NAME
import com.android.wm.shell.flicker.testapp.Components
import org.junit.Assert
class SplitScreenHelper(
instrumentation: Instrumentation,
activityLabel: String,
componentsInfo: FlickerComponentName
componentsInfo: IComponentMatcher
) : BaseAppHelper(instrumentation, activityLabel, componentsInfo) {
companion object {
@@ -111,9 +110,9 @@ class SplitScreenHelper(
}
// Drag to split
var dragStart = notificationContent.visibleCenter
var dragMiddle = Point(dragStart.x + 50, dragStart.y)
var dragEnd = Point(displayBounds.width / 4, displayBounds.width / 4)
val dragStart = notificationContent.visibleCenter
val dragMiddle = Point(dragStart.x + 50, dragStart.y)
val dragEnd = Point(displayBounds.width / 4, displayBounds.width / 4)
val downTime = SystemClock.uptimeMillis()
touch(
@@ -199,10 +198,7 @@ class SplitScreenHelper(
val allApps = taplInstrumentation.workspace.switchToAllApps()
allApps.freeze()
try {
val appIconSrc = allApps.getAppIcon(appName)
Assert.assertNotNull("Unable to find app icon", appIconSrc)
val appIconDest = appIconSrc.dragToHotseat(0)
Assert.assertNotNull("Unable to drag app icon on hotseat", appIconDest)
allApps.getAppIcon(appName).dragToHotseat(0)
} finally {
allApps.unfreeze()
}

View File

@@ -80,9 +80,8 @@ class AutoEnterPipOnGoToHomeTest(testSpec: FlickerTestParameter) : EnterPipTest(
}
override fun pipLayerReduces() {
val layerName = pipApp.component.toLayerName()
testSpec.assertLayers {
val pipLayerList = this.layers { it.name.contains(layerName) && it.isVisible }
val pipLayerList = this.layers { pipApp.layerMatchesAnyOf(it) && it.isVisible }
pipLayerList.zipWithNext { previous, current ->
current.visibleRegion.notBiggerThan(previous.visibleRegion.region)
}
@@ -96,9 +95,8 @@ class AutoEnterPipOnGoToHomeTest(testSpec: FlickerTestParameter) : EnterPipTest(
fun pipLayerMovesTowardsRightBottomCorner() {
// in gestural nav the swipe makes PiP first go upwards
Assume.assumeFalse(testSpec.isGesturalNavigation)
val layerName = pipApp.component.toLayerName()
testSpec.assertLayers {
val pipLayerList = this.layers { it.name.contains(layerName) && it.isVisible }
val pipLayerList = this.layers { pipApp.layerMatchesAnyOf(it) && it.isVisible }
// Pip animates towards the right bottom corner, but because it is being resized at the
// same time, it is possible it shrinks first quickly below the default position and get
// moved up after that in just few last frames

View File

@@ -76,9 +76,9 @@ class EnterPipOnUserLeaveHintTest(testSpec: FlickerTestParameter) : EnterPipTest
if (!testSpec.isGesturalNavigation) super.pipAppLayerAlwaysVisible() else {
// pip layer in gesture nav will disappear during transition
testSpec.assertLayers {
this.isVisible(pipApp.component)
.then().isInvisible(pipApp.component)
.then().isVisible(pipApp.component)
this.isVisible(pipApp)
.then().isInvisible(pipApp)
.then().isVisible(pipApp)
}
}
}
@@ -99,10 +99,10 @@ class EnterPipOnUserLeaveHintTest(testSpec: FlickerTestParameter) : EnterPipTest
if (!testSpec.isGesturalNavigation) super.pipLayerRemainInsideVisibleBounds() else {
// pip layer in gesture nav will disappear during transition
testSpec.assertLayersStart {
this.visibleRegion(pipApp.component).coversAtMost(displayBounds)
this.visibleRegion(pipApp).coversAtMost(displayBounds)
}
testSpec.assertLayersEnd {
this.visibleRegion(pipApp.component).coversAtMost(displayBounds)
this.visibleRegion(pipApp).coversAtMost(displayBounds)
}
}
}

View File

@@ -16,7 +16,6 @@
package com.android.wm.shell.flicker.pip
import android.platform.test.annotations.FlakyTest
import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.RequiresDevice
@@ -25,7 +24,7 @@ import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.annotation.Group3
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.traces.common.FlickerComponentName.Companion.LAUNCHER
import com.android.server.wm.traces.common.ComponentMatcher
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
@@ -84,7 +83,7 @@ open class EnterPipTest(testSpec: FlickerTestParameter) : PipTransition(testSpec
@Test
fun pipAppWindowAlwaysVisible() {
testSpec.assertWm {
this.isAppWindowVisible(pipApp.component)
this.isAppWindowVisible(pipApp)
}
}
@@ -95,7 +94,7 @@ open class EnterPipTest(testSpec: FlickerTestParameter) : PipTransition(testSpec
@Test
open fun pipAppLayerAlwaysVisible() {
testSpec.assertLayers {
this.isVisible(pipApp.component)
this.isVisible(pipApp)
}
}
@@ -106,7 +105,7 @@ open class EnterPipTest(testSpec: FlickerTestParameter) : PipTransition(testSpec
@Presubmit
@Test
fun pipWindowRemainInsideVisibleBounds() {
testSpec.assertWmVisibleRegion(pipApp.component) {
testSpec.assertWmVisibleRegion(pipApp) {
coversAtMost(displayBounds)
}
}
@@ -118,7 +117,7 @@ open class EnterPipTest(testSpec: FlickerTestParameter) : PipTransition(testSpec
@Presubmit
@Test
open fun pipLayerRemainInsideVisibleBounds() {
testSpec.assertLayersVisibleRegion(pipApp.component) {
testSpec.assertLayersVisibleRegion(pipApp) {
coversAtMost(displayBounds)
}
}
@@ -129,9 +128,8 @@ open class EnterPipTest(testSpec: FlickerTestParameter) : PipTransition(testSpec
@Presubmit
@Test
open fun pipLayerReduces() {
val layerName = pipApp.component.toLayerName()
testSpec.assertLayers {
val pipLayerList = this.layers { it.name.contains(layerName) && it.isVisible }
val pipLayerList = this.layers { pipApp.layerMatchesAnyOf(it) && it.isVisible }
pipLayerList.zipWithNext { previous, current ->
current.visibleRegion.coversAtMost(previous.visibleRegion.region)
}
@@ -145,22 +143,22 @@ open class EnterPipTest(testSpec: FlickerTestParameter) : PipTransition(testSpec
@Test
fun pipWindowBecomesPinned() {
testSpec.assertWm {
invoke("pipWindowIsNotPinned") { it.isNotPinned(pipApp.component) }
invoke("pipWindowIsNotPinned") { it.isNotPinned(pipApp) }
.then()
.invoke("pipWindowIsPinned") { it.isPinned(pipApp.component) }
.invoke("pipWindowIsPinned") { it.isPinned(pipApp) }
}
}
/**
* Checks [LAUNCHER] layer remains visible throughout the animation
* Checks [ComponentMatcher.LAUNCHER] layer remains visible throughout the animation
*/
@Presubmit
@Test
fun launcherLayerBecomesVisible() {
testSpec.assertLayers {
isInvisible(LAUNCHER)
isInvisible(ComponentMatcher.LAUNCHER)
.then()
.isVisible(LAUNCHER)
.isVisible(ComponentMatcher.LAUNCHER)
}
}

View File

@@ -28,7 +28,6 @@ import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.entireScreenCovered
import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.wm.shell.flicker.helpers.FixedAppHelper
import com.android.wm.shell.flicker.pip.PipTransition.BroadcastActionTrigger.Companion.ORIENTATION_LANDSCAPE
import com.android.wm.shell.flicker.pip.PipTransition.BroadcastActionTrigger.Companion.ORIENTATION_PORTRAIT
@@ -107,7 +106,7 @@ class EnterPipToOtherOrientationTest(
}
/**
* Checks that the [FlickerComponentName.NAV_BAR] has the correct position at
* Checks that the [ComponentMatcher.NAV_BAR] has the correct position at
* the start and end of the transition
*/
@FlakyTest
@@ -130,7 +129,7 @@ class EnterPipToOtherOrientationTest(
@Test
fun pipAppWindowIsAlwaysOnTop() {
testSpec.assertWm {
isAppWindowOnTop(pipApp.component)
isAppWindowOnTop(pipApp)
}
}
@@ -141,7 +140,7 @@ class EnterPipToOtherOrientationTest(
@Test
fun testAppWindowInvisibleOnStart() {
testSpec.assertWmStart {
isAppWindowInvisible(testApp.component)
isAppWindowInvisible(testApp)
}
}
@@ -152,7 +151,7 @@ class EnterPipToOtherOrientationTest(
@Test
fun testAppWindowVisibleOnEnd() {
testSpec.assertWmEnd {
isAppWindowVisible(testApp.component)
isAppWindowVisible(testApp)
}
}
@@ -163,7 +162,7 @@ class EnterPipToOtherOrientationTest(
@Test
fun testAppLayerInvisibleOnStart() {
testSpec.assertLayersStart {
isInvisible(testApp.component)
isInvisible(testApp)
}
}
@@ -174,7 +173,7 @@ class EnterPipToOtherOrientationTest(
@Test
fun testAppLayerVisibleOnEnd() {
testSpec.assertLayersEnd {
isVisible(testApp.component)
isVisible(testApp)
}
}
@@ -186,7 +185,7 @@ class EnterPipToOtherOrientationTest(
@Test
fun pipAppLayerCoversFullScreenOnStart() {
testSpec.assertLayersStart {
visibleRegion(pipApp.component).coversExactly(startingBounds)
visibleRegion(pipApp).coversExactly(startingBounds)
}
}
@@ -198,8 +197,8 @@ class EnterPipToOtherOrientationTest(
@Test
fun testAppPlusPipLayerCoversFullScreenOnEnd() {
testSpec.assertLayersEnd {
val pipRegion = visibleRegion(pipApp.component).region
visibleRegion(testApp.component)
val pipRegion = visibleRegion(pipApp).region
visibleRegion(testApp)
.plus(pipRegion)
.coversExactly(endingBounds)
}

View File

@@ -34,7 +34,7 @@ abstract class ExitPipToAppTransition(testSpec: FlickerTestParameter) : PipTrans
@Presubmit
@Test
open fun pipAppWindowRemainInsideVisibleBounds() {
testSpec.assertWmVisibleRegion(pipApp.component) {
testSpec.assertWmVisibleRegion(pipApp) {
coversAtMost(displayBounds)
}
}
@@ -46,7 +46,7 @@ abstract class ExitPipToAppTransition(testSpec: FlickerTestParameter) : PipTrans
@Presubmit
@Test
open fun pipAppLayerRemainInsideVisibleBounds() {
testSpec.assertLayersVisibleRegion(pipApp.component) {
testSpec.assertLayersVisibleRegion(pipApp) {
coversAtMost(displayBounds)
}
}
@@ -62,11 +62,11 @@ abstract class ExitPipToAppTransition(testSpec: FlickerTestParameter) : PipTrans
// when the activity is STOPPING, sometimes it becomes invisible in an entry before
// the window, sometimes in the same entry. This occurs because we log 1x per frame
// thus we ignore activity here
isAppWindowVisible(testApp.component)
.isAppWindowOnTop(pipApp.component)
isAppWindowVisible(testApp)
.isAppWindowOnTop(pipApp)
.then()
.isAppWindowInvisible(testApp.component)
.isAppWindowVisible(pipApp.component)
.isAppWindowInvisible(testApp)
.isAppWindowVisible(pipApp)
}
}
@@ -78,11 +78,11 @@ abstract class ExitPipToAppTransition(testSpec: FlickerTestParameter) : PipTrans
@Test
open fun showBothAppLayersThenHidePip() {
testSpec.assertLayers {
isVisible(testApp.component)
.isVisible(pipApp.component)
isVisible(testApp)
.isVisible(pipApp)
.then()
.isInvisible(testApp.component)
.isVisible(pipApp.component)
.isInvisible(testApp)
.isVisible(pipApp)
}
}
@@ -94,8 +94,8 @@ abstract class ExitPipToAppTransition(testSpec: FlickerTestParameter) : PipTrans
@Test
open fun testPlusPipAppsCoverFullScreenAtStart() {
testSpec.assertLayersStart {
val pipRegion = visibleRegion(pipApp.component).region
visibleRegion(testApp.component)
val pipRegion = visibleRegion(pipApp).region
visibleRegion(testApp)
.plus(pipRegion)
.coversExactly(displayBounds)
}
@@ -109,7 +109,7 @@ abstract class ExitPipToAppTransition(testSpec: FlickerTestParameter) : PipTrans
@Test
open fun pipAppCoversFullScreenAtEnd() {
testSpec.assertLayersEnd {
visibleRegion(pipApp.component).coversExactly(displayBounds)
visibleRegion(pipApp).coversExactly(displayBounds)
}
}
@@ -119,9 +119,8 @@ abstract class ExitPipToAppTransition(testSpec: FlickerTestParameter) : PipTrans
@Presubmit
@Test
open fun pipLayerExpands() {
val layerName = pipApp.component.toLayerName()
testSpec.assertLayers {
val pipLayerList = this.layers { it.name.contains(layerName) && it.isVisible }
val pipLayerList = this.layers { pipApp.layerMatchesAnyOf(it) && it.isVisible }
pipLayerList.zipWithNext { previous, current ->
current.visibleRegion.coversAtLeast(previous.visibleRegion.region)
}

View File

@@ -22,7 +22,7 @@ import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.isShellTransitionsEnabled
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.traces.common.FlickerComponentName.Companion.LAUNCHER
import com.android.server.wm.traces.common.ComponentMatcher.Companion.LAUNCHER
import org.junit.Test
/**
@@ -57,21 +57,21 @@ abstract class ExitPipTransition(testSpec: FlickerTestParameter) : PipTransition
// and isAppWindowInvisible in the same assertion block.
testSpec.assertWm {
this.invoke("hasPipWindow") {
it.isPinned(pipApp.component)
.isAppWindowVisible(pipApp.component)
.isAppWindowOnTop(pipApp.component)
it.isPinned(pipApp)
.isAppWindowVisible(pipApp)
.isAppWindowOnTop(pipApp)
}.then().invoke("!hasPipWindow") {
it.isNotPinned(pipApp.component)
.isAppWindowNotOnTop(pipApp.component)
it.isNotPinned(pipApp)
.isAppWindowNotOnTop(pipApp)
}
}
testSpec.assertWmEnd { isAppWindowInvisible(pipApp.component) }
testSpec.assertWmEnd { isAppWindowInvisible(pipApp) }
} else {
testSpec.assertWm {
this.invoke("hasPipWindow") {
it.isPinned(pipApp.component).isAppWindowVisible(pipApp.component)
it.isPinned(pipApp).isAppWindowVisible(pipApp)
}.then().invoke("!hasPipWindow") {
it.isNotPinned(pipApp.component).isAppWindowInvisible(pipApp.component)
it.isNotPinned(pipApp).isAppWindowInvisible(pipApp)
}
}
}
@@ -86,10 +86,10 @@ abstract class ExitPipTransition(testSpec: FlickerTestParameter) : PipTransition
@Test
open fun pipLayerBecomesInvisible() {
testSpec.assertLayers {
this.isVisible(pipApp.component)
this.isVisible(pipApp)
.isVisible(LAUNCHER)
.then()
.isInvisible(pipApp.component)
.isInvisible(pipApp)
.isVisible(LAUNCHER)
}
}

View File

@@ -73,7 +73,7 @@ class ExitPipViaExpandButtonClickTest(
pipApp.expandPipWindowToApp(wmHelper)
// Wait until the other app is no longer visible
wmHelper.StateSyncBuilder()
.withWindowSurfaceDisappeared(testApp.component)
.withWindowSurfaceDisappeared(testApp)
.waitForAndVerify()
}
}

View File

@@ -74,7 +74,7 @@ class ExitPipViaIntentTest(testSpec: FlickerTestParameter) : ExitPipToAppTransit
pipApp.exitPipToFullScreenViaIntent(wmHelper)
// Wait until the other app is no longer visible
wmHelper.StateSyncBuilder()
.withWindowSurfaceDisappeared(testApp.component)
.withWindowSurfaceDisappeared(testApp)
.waitForAndVerify()
}
}

View File

@@ -58,7 +58,7 @@ class ExitPipWithSwipeDownTest(testSpec: FlickerTestParameter) : ExitPipTransiti
get() = {
super.transition(this)
transitions {
val pipRegion = wmHelper.getWindowRegion(pipApp.component).bounds
val pipRegion = wmHelper.getWindowRegion(pipApp).bounds
val pipCenterX = pipRegion.centerX()
val pipCenterY = pipRegion.centerY()
val displayCenterX = device.displayWidth / 2
@@ -66,7 +66,7 @@ class ExitPipWithSwipeDownTest(testSpec: FlickerTestParameter) : ExitPipTransiti
// Wait until the other app is no longer visible
wmHelper.StateSyncBuilder()
.withPipGone()
.withWindowSurfaceDisappeared(pipApp.component)
.withWindowSurfaceDisappeared(pipApp)
.withAppTransitionIdle()
.waitForAndVerify()
}

View File

@@ -25,7 +25,7 @@ import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.annotation.Group3
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.traces.common.FlickerComponentName.Companion.LAUNCHER
import com.android.server.wm.traces.common.ComponentMatcher
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
@@ -69,7 +69,7 @@ class ExpandPipOnDoubleClickTest(testSpec: FlickerTestParameter) : PipTransition
@Presubmit
@Test
fun pipWindowRemainInsideVisibleBounds() {
testSpec.assertWmVisibleRegion(pipApp.component) {
testSpec.assertWmVisibleRegion(pipApp) {
coversAtMost(displayBounds)
}
}
@@ -81,7 +81,7 @@ class ExpandPipOnDoubleClickTest(testSpec: FlickerTestParameter) : PipTransition
@Presubmit
@Test
fun pipLayerRemainInsideVisibleBounds() {
testSpec.assertLayersVisibleRegion(pipApp.component) {
testSpec.assertLayersVisibleRegion(pipApp) {
coversAtMost(displayBounds)
}
}
@@ -93,7 +93,7 @@ class ExpandPipOnDoubleClickTest(testSpec: FlickerTestParameter) : PipTransition
@Test
fun pipWindowIsAlwaysVisible() {
testSpec.assertWm {
isAppWindowVisible(pipApp.component)
isAppWindowVisible(pipApp)
}
}
@@ -104,7 +104,7 @@ class ExpandPipOnDoubleClickTest(testSpec: FlickerTestParameter) : PipTransition
@Test
fun pipLayerIsAlwaysVisible() {
testSpec.assertLayers {
isVisible(pipApp.component)
isVisible(pipApp)
}
}
@@ -114,9 +114,8 @@ class ExpandPipOnDoubleClickTest(testSpec: FlickerTestParameter) : PipTransition
@FlakyTest(bugId = 228012337)
@Test
fun pipLayerExpands() {
val layerName = pipApp.component.toLayerName()
testSpec.assertLayers {
val pipLayerList = this.layers { it.name.contains(layerName) && it.isVisible }
val pipLayerList = this.layers { pipApp.layerMatchesAnyOf(it) && it.isVisible }
pipLayerList.zipWithNext { previous, current ->
current.visibleRegion.coversAtLeast(previous.visibleRegion.region)
}
@@ -126,9 +125,8 @@ class ExpandPipOnDoubleClickTest(testSpec: FlickerTestParameter) : PipTransition
@Presubmit
@Test
fun pipSameAspectRatio() {
val layerName = pipApp.component.toLayerName()
testSpec.assertLayers {
val pipLayerList = this.layers { it.name.contains(layerName) && it.isVisible }
val pipLayerList = this.layers { pipApp.layerMatchesAnyOf(it) && it.isVisible }
pipLayerList.zipWithNext { previous, current ->
current.visibleRegion.isSameAspectRatio(previous.visibleRegion)
}
@@ -142,18 +140,18 @@ class ExpandPipOnDoubleClickTest(testSpec: FlickerTestParameter) : PipTransition
@Test
fun windowIsAlwaysPinned() {
testSpec.assertWm {
this.invoke("hasPipWindow") { it.isPinned(pipApp.component) }
this.invoke("hasPipWindow") { it.isPinned(pipApp) }
}
}
/**
* Checks [LAUNCHER] layer remains visible throughout the animation
* Checks [ComponentMatcher.LAUNCHER] layer remains visible throughout the animation
*/
@Presubmit
@Test
fun launcherIsAlwaysVisible() {
testSpec.assertLayers {
isVisible(LAUNCHER)
isVisible(ComponentMatcher.LAUNCHER)
}
}

View File

@@ -44,7 +44,7 @@ abstract class MovePipShelfHeightTransition(
@Test
open fun pipWindowIsAlwaysVisible() {
testSpec.assertWm {
isAppWindowVisible(pipApp.component)
isAppWindowVisible(pipApp)
}
}
@@ -55,7 +55,7 @@ abstract class MovePipShelfHeightTransition(
@Test
open fun pipLayerIsAlwaysVisible() {
testSpec.assertLayers {
isVisible(pipApp.component)
isVisible(pipApp)
}
}
@@ -66,7 +66,7 @@ abstract class MovePipShelfHeightTransition(
@Presubmit
@Test
open fun pipWindowRemainInsideVisibleBounds() {
testSpec.assertWmVisibleRegion(pipApp.component) {
testSpec.assertWmVisibleRegion(pipApp) {
coversAtMost(displayBounds)
}
}
@@ -78,7 +78,7 @@ abstract class MovePipShelfHeightTransition(
@Presubmit
@Test
open fun pipLayerRemainInsideVisibleBounds() {
testSpec.assertLayersVisibleRegion(pipApp.component) {
testSpec.assertLayersVisibleRegion(pipApp) {
coversAtMost(displayBounds)
}
}
@@ -90,9 +90,8 @@ abstract class MovePipShelfHeightTransition(
@Presubmit
@Test
open fun pipWindowMoves() {
val windowName = pipApp.component.toWindowName()
testSpec.assertWm {
val pipWindowList = this.windowStates { it.name.contains(windowName) && it.isVisible }
val pipWindowList = this.windowStates { pipApp.windowMatchesAnyOf(it) && it.isVisible }
pipWindowList.zipWithNext { previous, current ->
assertRegionMovement(previous.frame, current.frame)
}
@@ -105,12 +104,11 @@ abstract class MovePipShelfHeightTransition(
@Presubmit
@Test
open fun pipLayerMoves() {
val layerName = pipApp.component.toLayerName()
testSpec.assertLayers {
val pipLayerList = this.layers { it.name.contains(layerName) && it.isVisible }
val pipLayerList = this.layers { pipApp.layerMatchesAnyOf(it) && it.isVisible }
pipLayerList.zipWithNext { previous, current ->
assertRegionMovement(previous.visibleRegion, current.visibleRegion)
}
}
}
}
}

View File

@@ -27,7 +27,7 @@ import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.server.wm.flicker.helpers.isShellTransitionsEnabled
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.ComponentMatcher
import com.android.wm.shell.flicker.helpers.ImeAppHelper
import org.junit.Assume.assumeFalse
import org.junit.Before
@@ -84,7 +84,7 @@ open class PipKeyboardTest(testSpec: FlickerTestParameter) : PipTransition(testS
@Presubmit
@Test
open fun pipInVisibleBounds() {
testSpec.assertWmVisibleRegion(pipApp.component) {
testSpec.assertWmVisibleRegion(pipApp) {
val displayBounds = WindowUtils.getDisplayBounds(testSpec.startRotation)
coversAtMost(displayBounds)
}
@@ -97,7 +97,7 @@ open class PipKeyboardTest(testSpec: FlickerTestParameter) : PipTransition(testS
@Test
open fun pipIsAboveAppWindow() {
testSpec.assertWmTag(TAG_IME_VISIBLE) {
isAboveWindow(FlickerComponentName.IME, pipApp.component)
isAboveWindow(ComponentMatcher.IME, pipApp)
}
}

View File

@@ -16,9 +16,9 @@
package com.android.wm.shell.flicker.pip
import android.platform.test.annotations.FlakyTest
import android.platform.test.annotations.Presubmit
import android.view.Surface
import android.platform.test.annotations.FlakyTest
import androidx.test.filters.RequiresDevice
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
@@ -101,7 +101,7 @@ open class PipRotationTest(testSpec: FlickerTestParameter) : PipTransition(testS
@Test
fun appLayerRotates_StartingBounds() {
testSpec.assertLayersStart {
visibleRegion(fixedApp.component).coversExactly(screenBoundsStart)
visibleRegion(fixedApp).coversExactly(screenBoundsStart)
}
}
@@ -112,7 +112,7 @@ open class PipRotationTest(testSpec: FlickerTestParameter) : PipTransition(testS
@Test
fun appLayerRotates_EndingBounds() {
testSpec.assertLayersEnd {
visibleRegion(fixedApp.component).coversExactly(screenBoundsEnd)
visibleRegion(fixedApp).coversExactly(screenBoundsEnd)
}
}
@@ -121,7 +121,7 @@ open class PipRotationTest(testSpec: FlickerTestParameter) : PipTransition(testS
*/
private fun pipLayerRotates_StartingBounds_internal() {
testSpec.assertLayersStart {
visibleRegion(pipApp.component).coversAtMost(screenBoundsStart)
visibleRegion(pipApp).coversAtMost(screenBoundsStart)
}
}
@@ -141,7 +141,7 @@ open class PipRotationTest(testSpec: FlickerTestParameter) : PipTransition(testS
@Test
fun pipLayerRotates_EndingBounds() {
testSpec.assertLayersEnd {
visibleRegion(pipApp.component).coversAtMost(screenBoundsEnd)
visibleRegion(pipApp).coversAtMost(screenBoundsEnd)
}
}
@@ -153,7 +153,7 @@ open class PipRotationTest(testSpec: FlickerTestParameter) : PipTransition(testS
@Test
fun pipIsAboveFixedAppWindow_Start() {
testSpec.assertWmStart {
isAboveWindow(pipApp.component, fixedApp.component)
isAboveWindow(pipApp, fixedApp)
}
}
@@ -165,7 +165,7 @@ open class PipRotationTest(testSpec: FlickerTestParameter) : PipTransition(testS
@Test
fun pipIsAboveFixedAppWindow_End() {
testSpec.assertWmEnd {
isAboveWindow(pipApp.component, fixedApp.component)
isAboveWindow(pipApp, fixedApp)
}
}

View File

@@ -88,7 +88,7 @@ open class SetRequestedOrientationWhilePinnedTest(
pipApp.launchViaIntent(wmHelper)
// System bar may fade out during fixed rotation.
wmHelper.StateSyncBuilder()
.withFullScreenApp(pipApp.component)
.withFullScreenApp(pipApp)
.withRotation(Surface.ROTATION_90)
.withAppTransitionIdle()
.withNavBarStatusBarVisible()
@@ -120,7 +120,7 @@ open class SetRequestedOrientationWhilePinnedTest(
@Test
fun pipWindowInsideDisplay() {
testSpec.assertWmStart {
frameRegion(pipApp.component).coversAtMost(startingBounds)
visibleRegion(pipApp).coversAtMost(startingBounds)
}
}
@@ -128,7 +128,7 @@ open class SetRequestedOrientationWhilePinnedTest(
@Test
fun pipAppShowsOnTop() {
testSpec.assertWmEnd {
isAppWindowOnTop(pipApp.component)
isAppWindowOnTop(pipApp)
}
}
@@ -136,7 +136,7 @@ open class SetRequestedOrientationWhilePinnedTest(
@Test
fun pipLayerInsideDisplay() {
testSpec.assertLayersStart {
visibleRegion(pipApp.component).coversAtMost(startingBounds)
visibleRegion(pipApp).coversAtMost(startingBounds)
}
}
@@ -144,7 +144,7 @@ open class SetRequestedOrientationWhilePinnedTest(
@Test
fun pipAlwaysVisible() {
testSpec.assertWm {
this.isAppWindowVisible(pipApp.component)
this.isAppWindowVisible(pipApp)
}
}
@@ -152,7 +152,7 @@ open class SetRequestedOrientationWhilePinnedTest(
@Test
fun pipAppLayerCoversFullScreen() {
testSpec.assertLayersEnd {
visibleRegion(pipApp.component).coversExactly(endingBounds)
visibleRegion(pipApp).coversExactly(endingBounds)
}
}

View File

@@ -83,30 +83,30 @@ class EnterSplitScreenByDragFromAllApps(
@Presubmit
@Test
fun primaryAppLayerIsVisibleAtEnd() = testSpec.layerIsVisibleAtEnd(primaryApp.component)
fun primaryAppLayerIsVisibleAtEnd() = testSpec.layerIsVisibleAtEnd(primaryApp)
@Presubmit
@Test
fun secondaryAppLayerBecomesVisible() = testSpec.layerBecomesVisible(secondaryApp.component)
fun secondaryAppLayerBecomesVisible() = testSpec.layerBecomesVisible(secondaryApp)
@Presubmit
@Test
fun primaryAppBoundsIsVisibleAtEnd() = testSpec.splitAppLayerBoundsIsVisibleAtEnd(
testSpec.endRotation, primaryApp.component, false /* splitLeftTop */)
testSpec.endRotation, primaryApp, false /* splitLeftTop */)
@Presubmit
@Test
fun secondaryAppBoundsBecomesVisible() = testSpec.splitAppLayerBoundsBecomesVisible(
testSpec.endRotation, secondaryApp.component, true /* splitLeftTop */)
testSpec.endRotation, secondaryApp, true /* splitLeftTop */)
@Presubmit
@Test
fun primaryAppWindowIsVisibleAtEnd() = testSpec.appWindowIsVisibleAtEnd(primaryApp.component)
fun primaryAppWindowIsVisibleAtEnd() = testSpec.appWindowIsVisibleAtEnd(primaryApp)
@Presubmit
@Test
fun secondaryAppWindowBecomesVisible() =
testSpec.appWindowBecomesVisible(secondaryApp.component)
testSpec.appWindowBecomesVisible(secondaryApp)
companion object {
@Parameterized.Parameters(name = "{0}")

View File

@@ -96,33 +96,33 @@ class EnterSplitScreenByDragFromNotification(
@Presubmit
@Test
fun primaryAppLayerIsVisibleAtEnd() = testSpec.layerIsVisibleAtEnd(primaryApp.component)
fun primaryAppLayerIsVisibleAtEnd() = testSpec.layerIsVisibleAtEnd(primaryApp)
@Presubmit
@Test
fun secondaryAppLayerBecomesVisible() =
testSpec.layerBecomesVisible(sendNotificationApp.component)
testSpec.layerBecomesVisible(sendNotificationApp)
@Presubmit
@Test
fun primaryAppBoundsIsVisibleAtEnd() = testSpec.splitAppLayerBoundsIsVisibleAtEnd(
testSpec.endRotation, primaryApp.component, false /* splitLeftTop */
testSpec.endRotation, primaryApp, false /* splitLeftTop */
)
@Presubmit
@Test
fun secondaryAppBoundsBecomesVisible() = testSpec.splitAppLayerBoundsBecomesVisible(
testSpec.endRotation, sendNotificationApp.component, true /* splitLeftTop */
testSpec.endRotation, sendNotificationApp, true /* splitLeftTop */
)
@Presubmit
@Test
fun primaryAppWindowIsVisibleAtEnd() = testSpec.appWindowIsVisibleAtEnd(primaryApp.component)
fun primaryAppWindowIsVisibleAtEnd() = testSpec.appWindowIsVisibleAtEnd(primaryApp)
@Presubmit
@Test
fun secondaryAppWindowIsVisibleAtEnd() =
testSpec.appWindowIsVisibleAtEnd(sendNotificationApp.component)
testSpec.appWindowIsVisibleAtEnd(sendNotificationApp)
companion object {
@Parameterized.Parameters(name = "{0}")

View File

@@ -88,32 +88,32 @@ class EnterSplitScreenByDragFromTaskbar(
@Presubmit
@Test
fun primaryAppLayerIsVisibleAtEnd() = testSpec.layerIsVisibleAtEnd(primaryApp.component)
fun primaryAppLayerIsVisibleAtEnd() = testSpec.layerIsVisibleAtEnd(primaryApp)
@Presubmit
@Test
fun secondaryAppLayerBecomesVisible() = testSpec.layerBecomesVisible(secondaryApp.component)
fun secondaryAppLayerBecomesVisible() = testSpec.layerBecomesVisible(secondaryApp)
@Presubmit
@Test
fun primaryAppBoundsIsVisibleAtEnd() = testSpec.splitAppLayerBoundsIsVisibleAtEnd(
testSpec.endRotation, primaryApp.component, false /* splitLeftTop */
testSpec.endRotation, primaryApp, splitLeftTop = false
)
@Presubmit
@Test
fun secondaryAppBoundsBecomesVisible() = testSpec.splitAppLayerBoundsBecomesVisible(
testSpec.endRotation, secondaryApp.component, true /* splitLeftTop */
testSpec.endRotation, secondaryApp, splitLeftTop = true
)
@Presubmit
@Test
fun primaryAppWindowIsVisibleAtEnd() = testSpec.appWindowIsVisibleAtEnd(primaryApp.component)
fun primaryAppWindowIsVisibleAtEnd() = testSpec.appWindowIsVisibleAtEnd(primaryApp)
@Presubmit
@Test
fun secondaryAppWindowBecomesVisible() =
testSpec.appWindowBecomesVisible(secondaryApp.component)
testSpec.appWindowBecomesVisible(secondaryApp)
companion object {
@Parameterized.Parameters(name = "{0}")

View File

@@ -19,25 +19,26 @@ package com.android.server.wm.flicker
import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.server.wm.flicker.traces.region.RegionSubject
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.ComponentMatcher
import com.android.server.wm.traces.common.IComponentMatcher
/**
* Checks that [FlickerComponentName.STATUS_BAR] window is visible and above the app windows in
* Checks that [ComponentMatcher.STATUS_BAR] window is visible and above the app windows in
* all WM trace entries
*/
fun FlickerTestParameter.statusBarWindowIsVisible() {
assertWm {
this.isAboveAppWindowVisible(FlickerComponentName.STATUS_BAR)
this.isAboveAppWindowVisible(ComponentMatcher.STATUS_BAR)
}
}
/**
* Checks that [FlickerComponentName.NAV_BAR] window is visible and above the app windows in
* Checks that [ComponentMatcher.NAV_BAR] window is visible and above the app windows in
* all WM trace entries
*/
fun FlickerTestParameter.navBarWindowIsVisible() {
assertWm {
this.isAboveAppWindowVisible(FlickerComponentName.NAV_BAR)
this.isAboveAppWindowVisible(ComponentMatcher.NAV_BAR)
}
}
@@ -75,59 +76,59 @@ fun FlickerTestParameter.entireScreenCovered(allStates: Boolean = true) {
}
/**
* Checks that [FlickerComponentName.NAV_BAR] layer is visible at the start and end of the SF
* Checks that [ComponentMatcher.NAV_BAR] layer is visible at the start and end of the SF
* trace
*/
fun FlickerTestParameter.navBarLayerIsVisible() {
assertLayersStart {
this.isVisible(FlickerComponentName.NAV_BAR)
this.isVisible(ComponentMatcher.NAV_BAR)
}
assertLayersEnd {
this.isVisible(FlickerComponentName.NAV_BAR)
this.isVisible(ComponentMatcher.NAV_BAR)
}
}
/**
* Checks that [FlickerComponentName.STATUS_BAR] layer is visible at the start and end of the SF
* Checks that [ComponentMatcher.STATUS_BAR] layer is visible at the start and end of the SF
* trace
*/
fun FlickerTestParameter.statusBarLayerIsVisible() {
assertLayersStart {
this.isVisible(FlickerComponentName.STATUS_BAR)
this.isVisible(ComponentMatcher.STATUS_BAR)
}
assertLayersEnd {
this.isVisible(FlickerComponentName.STATUS_BAR)
this.isVisible(ComponentMatcher.STATUS_BAR)
}
}
/**
* Asserts that the [FlickerComponentName.NAV_BAR] layer is at the correct position at the start
* Asserts that the [ComponentMatcher.NAV_BAR] layer is at the correct position at the start
* of the SF trace
*/
fun FlickerTestParameter.navBarLayerPositionStart() {
assertLayersStart {
val display = this.entry.displays.firstOrNull { !it.isVirtual }
?: error("There is no display!")
this.visibleRegion(FlickerComponentName.NAV_BAR)
this.visibleRegion(ComponentMatcher.NAV_BAR)
.coversExactly(WindowUtils.getNavigationBarPosition(display, isGesturalNavigation))
}
}
/**
* Asserts that the [FlickerComponentName.NAV_BAR] layer is at the correct position at the end
* Asserts that the [ComponentMatcher.NAV_BAR] layer is at the correct position at the end
* of the SF trace
*/
fun FlickerTestParameter.navBarLayerPositionEnd() {
assertLayersEnd {
val display = this.entry.displays.minByOrNull { it.id }
?: throw RuntimeException("There is no display!")
this.visibleRegion(FlickerComponentName.NAV_BAR)
this.visibleRegion(ComponentMatcher.NAV_BAR)
.coversExactly(WindowUtils.getNavigationBarPosition(display, isGesturalNavigation))
}
}
/**
* Asserts that the [FlickerComponentName.NAV_BAR] layer is at the correct position at the start
* Asserts that the [ComponentMatcher.NAV_BAR] layer is at the correct position at the start
* and end of the SF trace
*/
fun FlickerTestParameter.navBarLayerRotatesAndScales() {
@@ -136,33 +137,33 @@ fun FlickerTestParameter.navBarLayerRotatesAndScales() {
}
/**
* Asserts that the [FlickerComponentName.STATUS_BAR] layer is at the correct position at the start
* Asserts that the [ComponentMatcher.STATUS_BAR] layer is at the correct position at the start
* of the SF trace
*/
fun FlickerTestParameter.statusBarLayerPositionStart() {
assertLayersStart {
val display = this.entry.displays.minByOrNull { it.id }
?: throw RuntimeException("There is no display!")
this.visibleRegion(FlickerComponentName.STATUS_BAR)
this.visibleRegion(ComponentMatcher.STATUS_BAR)
.coversExactly(WindowUtils.getStatusBarPosition(display))
}
}
/**
* Asserts that the [FlickerComponentName.STATUS_BAR] layer is at the correct position at the end
* Asserts that the [ComponentMatcher.STATUS_BAR] layer is at the correct position at the end
* of the SF trace
*/
fun FlickerTestParameter.statusBarLayerPositionEnd() {
assertLayersEnd {
val display = this.entry.displays.minByOrNull { it.id }
?: throw RuntimeException("There is no display!")
this.visibleRegion(FlickerComponentName.STATUS_BAR)
this.visibleRegion(ComponentMatcher.STATUS_BAR)
.coversExactly(WindowUtils.getStatusBarPosition(display))
}
}
/**
* Asserts that the [FlickerComponentName.STATUS_BAR] layer is at the correct position at the start
* Asserts that the [ComponentMatcher.STATUS_BAR] layer is at the correct position at the start
* and end of the SF trace
*/
fun FlickerTestParameter.statusBarLayerRotatesScales() {
@@ -171,17 +172,17 @@ fun FlickerTestParameter.statusBarLayerRotatesScales() {
}
/**
* Asserts that the visibleRegion of the [FlickerComponentName.SNAPSHOT] layer can cover
* Asserts that the visibleRegion of the [ComponentMatcher.SNAPSHOT] layer can cover
* the visibleRegion of the given app component exactly
*/
fun FlickerTestParameter.snapshotStartingWindowLayerCoversExactlyOnApp(
component: FlickerComponentName
component: IComponentMatcher
) {
assertLayers {
invoke("snapshotStartingWindowLayerCoversExactlyOnApp") {
val snapshotLayers = it.subjects.filter { subject ->
subject.name.contains(
FlickerComponentName.SNAPSHOT.toLayerName()) && subject.isVisible
ComponentMatcher.SNAPSHOT.toLayerName()) && subject.isVisible
}
// Verify the size of snapshotRegion covers appVisibleRegion exactly in animation.
if (snapshotLayers.isNotEmpty()) {
@@ -218,8 +219,8 @@ fun FlickerTestParameter.snapshotStartingWindowLayerCoversExactlyOnApp(
* otherwise we won't and the layer must appear immediately.
*/
fun FlickerTestParameter.replacesLayer(
originalLayer: FlickerComponentName,
newLayer: FlickerComponentName,
originalLayer: IComponentMatcher,
newLayer: IComponentMatcher,
ignoreEntriesWithRotationLayer: Boolean = false,
ignoreSnapshot: Boolean = false,
ignoreSplashscreen: Boolean = true
@@ -228,10 +229,10 @@ fun FlickerTestParameter.replacesLayer(
val assertion = this.isVisible(originalLayer)
if (ignoreEntriesWithRotationLayer) {
assertion.then().isVisible(FlickerComponentName.ROTATION, isOptional = true)
assertion.then().isVisible(ComponentMatcher.ROTATION, isOptional = true)
}
if (ignoreSnapshot) {
assertion.then().isVisible(FlickerComponentName.SNAPSHOT, isOptional = true)
assertion.then().isVisible(ComponentMatcher.SNAPSHOT, isOptional = true)
}
if (ignoreSplashscreen) {
assertion.then().isSplashScreenVisibleFor(newLayer, isOptional = true)

View File

@@ -34,7 +34,7 @@ import com.android.server.wm.flicker.replacesLayer
import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.common.FlickerComponentName.Companion.LAUNCHER
import com.android.server.wm.traces.common.ComponentMatcher.Companion.LAUNCHER
import org.junit.Test
/**
@@ -165,7 +165,7 @@ abstract class CloseAppTransition(protected val testSpec: FlickerTestParameter)
@Test
open fun launcherReplacesAppWindowAsTopWindow() {
testSpec.assertWm {
this.isAppWindowOnTop(testApp.component)
this.isAppWindowOnTop(testApp)
.then()
.isAppWindowOnTop(LAUNCHER)
}
@@ -192,7 +192,7 @@ abstract class CloseAppTransition(protected val testSpec: FlickerTestParameter)
@Test
open fun launcherLayerReplacesApp() {
testSpec.replacesLayer(
testApp.component,
testApp,
LAUNCHER,
ignoreEntriesWithRotationLayer = testSpec.isLandscapeOrSeascapeAtStart
)

View File

@@ -26,7 +26,7 @@ import androidx.window.extensions.WindowExtensions
import androidx.window.extensions.WindowExtensionsProvider
import androidx.window.extensions.embedding.ActivityEmbeddingComponent
import com.android.server.wm.flicker.testapp.ActivityOptions
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.IComponentMatcher
import com.android.server.wm.traces.common.windowmanager.WindowManagerState.Companion.STATE_RESUMED
import com.android.server.wm.traces.parser.toFlickerComponent
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
@@ -35,7 +35,7 @@ import org.junit.Assume.assumeNotNull
class ActivityEmbeddingAppHelper @JvmOverloads constructor(
instr: Instrumentation,
launcherName: String = ActivityOptions.ACTIVITY_EMBEDDING_LAUNCHER_NAME,
component: FlickerComponentName = MAIN_ACTIVITY_COMPONENT,
component: IComponentMatcher = MAIN_ACTIVITY_COMPONENT,
launcherStrategy: ILauncherStrategy = LauncherStrategyFactory
.getInstance(instr)
.launcherStrategy

View File

@@ -20,15 +20,15 @@ import android.app.Instrumentation
import android.support.test.launcherhelper.ILauncherStrategy
import android.support.test.launcherhelper.LauncherStrategyFactory
import com.android.server.wm.flicker.testapp.ActivityOptions
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.IComponentMatcher
import com.android.server.wm.traces.parser.toFlickerComponent
class FixedOrientationAppHelper @JvmOverloads constructor(
class FixedOrientationAppHelper @JvmOverloads constructor(
instr: Instrumentation,
launcherName: String = ActivityOptions.PORTRAIT_ONLY_ACTIVITY_LAUNCHER_NAME,
component: FlickerComponentName =
component: IComponentMatcher =
ActivityOptions.PORTRAIT_ONLY_ACTIVITY_COMPONENT_NAME.toFlickerComponent(),
launcherStrategy: ILauncherStrategy = LauncherStrategyFactory
.getInstance(instr)
.launcherStrategy
) : StandardAppHelper(instr, launcherName, component, launcherStrategy)
) : StandardAppHelper(instr, launcherName, component, launcherStrategy)

View File

@@ -23,7 +23,7 @@ import android.view.WindowInsets.Type.statusBars
import androidx.test.uiautomator.By
import androidx.test.uiautomator.Until
import com.android.server.wm.flicker.testapp.ActivityOptions
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.IComponentMatcher
import com.android.server.wm.traces.parser.toFlickerComponent
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
import java.util.regex.Pattern
@@ -33,7 +33,7 @@ class ImeAppAutoFocusHelper @JvmOverloads constructor(
private val rotation: Int,
private val imePackageName: String = IME_PACKAGE,
launcherName: String = ActivityOptions.IME_ACTIVITY_AUTO_FOCUS_LAUNCHER_NAME,
component: FlickerComponentName =
component: IComponentMatcher =
ActivityOptions.IME_ACTIVITY_AUTO_FOCUS_COMPONENT_NAME.toFlickerComponent()
) : ImeAppHelper(instr, launcherName, component) {
override fun openIME(wmHelper: WindowManagerStateHelper) {

View File

@@ -22,14 +22,14 @@ import android.support.test.launcherhelper.LauncherStrategyFactory
import androidx.test.uiautomator.By
import androidx.test.uiautomator.Until
import com.android.server.wm.flicker.testapp.ActivityOptions
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.IComponentMatcher
import com.android.server.wm.traces.parser.toFlickerComponent
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
open class ImeAppHelper @JvmOverloads constructor(
instr: Instrumentation,
launcherName: String = ActivityOptions.IME_ACTIVITY_LAUNCHER_NAME,
component: FlickerComponentName =
component: IComponentMatcher =
ActivityOptions.IME_ACTIVITY_COMPONENT_NAME.toFlickerComponent(),
launcherStrategy: ILauncherStrategy = LauncherStrategyFactory
.getInstance(instr)
@@ -80,7 +80,7 @@ open class ImeAppHelper @JvmOverloads constructor(
}
finishButton.click()
wmHelper.StateSyncBuilder()
.withActivityRemoved(component)
.withActivityRemoved(this)
.waitForAndVerify()
}
}

View File

@@ -20,7 +20,7 @@ import android.app.Instrumentation
import androidx.test.uiautomator.By
import androidx.test.uiautomator.Until
import com.android.server.wm.flicker.testapp.ActivityOptions
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.IComponentMatcher
import com.android.server.wm.traces.parser.toFlickerComponent
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
@@ -29,7 +29,7 @@ class ImeEditorPopupDialogAppHelper @JvmOverloads constructor(
private val rotation: Int,
private val imePackageName: String = IME_PACKAGE,
launcherName: String = ActivityOptions.EDITOR_POPUP_DIALOG_ACTIVITY_LAUNCHER_NAME,
component: FlickerComponentName =
component: IComponentMatcher =
ActivityOptions.EDITOR_POPUP_DIALOG_ACTIVITY_COMPONENT_NAME.toFlickerComponent()
) : ImeAppHelper(instr, launcherName, component) {
override fun openIME(wmHelper: WindowManagerStateHelper) {

View File

@@ -20,15 +20,15 @@ import android.app.Instrumentation
import android.support.test.launcherhelper.ILauncherStrategy
import android.support.test.launcherhelper.LauncherStrategyFactory
import com.android.server.wm.flicker.testapp.ActivityOptions
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.IComponentMatcher
import com.android.server.wm.traces.parser.toFlickerComponent
class ImeStateInitializeHelper @JvmOverloads constructor(
instr: Instrumentation,
launcherName: String = ActivityOptions.IME_ACTIVITY_INITIALIZE_LAUNCHER_NAME,
component: FlickerComponentName =
component: IComponentMatcher =
ActivityOptions.IME_ACTIVITY_INITIALIZE_COMPONENT_NAME.toFlickerComponent(),
launcherStrategy: ILauncherStrategy = LauncherStrategyFactory
.getInstance(instr)
.launcherStrategy
) : StandardAppHelper(instr, launcherName, component, launcherStrategy)
) : StandardAppHelper(instr, launcherName, component, launcherStrategy)

View File

@@ -23,14 +23,14 @@ import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice
import androidx.test.uiautomator.Until
import com.android.server.wm.flicker.testapp.ActivityOptions
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.IComponentMatcher
import com.android.server.wm.traces.parser.toFlickerComponent
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
class NewTasksAppHelper @JvmOverloads constructor(
instr: Instrumentation,
launcherName: String = ActivityOptions.LAUNCH_NEW_TASK_ACTIVITY_LAUNCHER_NAME,
component: FlickerComponentName =
component: IComponentMatcher =
ActivityOptions.LAUNCH_NEW_TASK_ACTIVITY_COMPONENT_NAME.toFlickerComponent(),
launcherStrategy: ILauncherStrategy = LauncherStrategyFactory
.getInstance(instr)
@@ -47,7 +47,7 @@ class NewTasksAppHelper @JvmOverloads constructor(
}
button.click()
wmHelper.StateSyncBuilder()
.withFullScreenApp(component)
.withFullScreenApp(this)
.waitForAndVerify()
}
}

View File

@@ -20,15 +20,15 @@ import android.app.Instrumentation
import android.support.test.launcherhelper.ILauncherStrategy
import android.support.test.launcherhelper.LauncherStrategyFactory
import com.android.server.wm.flicker.testapp.ActivityOptions
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.IComponentMatcher
import com.android.server.wm.traces.parser.toFlickerComponent
class NonResizeableAppHelper @JvmOverloads constructor(
instr: Instrumentation,
launcherName: String = ActivityOptions.NON_RESIZEABLE_ACTIVITY_LAUNCHER_NAME,
component: FlickerComponentName =
component: IComponentMatcher =
ActivityOptions.NON_RESIZEABLE_ACTIVITY_COMPONENT_NAME.toFlickerComponent(),
launcherStrategy: ILauncherStrategy = LauncherStrategyFactory
.getInstance(instr)
.launcherStrategy
) : StandardAppHelper(instr, launcherName, component, launcherStrategy)
) : StandardAppHelper(instr, launcherName, component, launcherStrategy)

View File

@@ -22,14 +22,14 @@ import android.support.test.launcherhelper.LauncherStrategyFactory
import androidx.test.uiautomator.By
import androidx.test.uiautomator.Until
import com.android.server.wm.flicker.testapp.ActivityOptions
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.IComponentMatcher
import com.android.server.wm.traces.parser.toFlickerComponent
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
class NotificationAppHelper @JvmOverloads constructor(
instr: Instrumentation,
launcherName: String = ActivityOptions.NOTIFICATION_ACTIVITY_LAUNCHER_NAME,
component: FlickerComponentName =
component: IComponentMatcher =
ActivityOptions.NOTIFICATION_ACTIVITY_COMPONENT_NAME.toFlickerComponent(),
launcherStrategy: ILauncherStrategy = LauncherStrategyFactory
.getInstance(instr)

View File

@@ -20,15 +20,15 @@ import android.app.Instrumentation
import android.support.test.launcherhelper.ILauncherStrategy
import android.support.test.launcherhelper.LauncherStrategyFactory
import com.android.server.wm.flicker.testapp.ActivityOptions
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.IComponentMatcher
import com.android.server.wm.traces.parser.toFlickerComponent
class SeamlessRotationAppHelper @JvmOverloads constructor(
instr: Instrumentation,
launcherName: String = ActivityOptions.SEAMLESS_ACTIVITY_LAUNCHER_NAME,
component: FlickerComponentName =
component: IComponentMatcher =
ActivityOptions.SEAMLESS_ACTIVITY_COMPONENT_NAME.toFlickerComponent(),
launcherStrategy: ILauncherStrategy = LauncherStrategyFactory
.getInstance(instr)
.launcherStrategy
) : StandardAppHelper(instr, launcherName, component, launcherStrategy)
) : StandardAppHelper(instr, launcherName, component, launcherStrategy)

View File

@@ -20,15 +20,15 @@ import android.app.Instrumentation
import android.support.test.launcherhelper.ILauncherStrategy
import android.support.test.launcherhelper.LauncherStrategyFactory
import com.android.server.wm.flicker.testapp.ActivityOptions
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.IComponentMatcher
import com.android.server.wm.traces.parser.toFlickerComponent
class ShowWhenLockedAppHelper @JvmOverloads constructor(
instr: Instrumentation,
launcherName: String = ActivityOptions.SHOW_WHEN_LOCKED_ACTIVITY_LAUNCHER_NAME,
component: FlickerComponentName =
component: IComponentMatcher =
ActivityOptions.SHOW_WHEN_LOCKED_ACTIVITY_COMPONENT_NAME.toFlickerComponent(),
launcherStrategy: ILauncherStrategy = LauncherStrategyFactory
.getInstance(instr)
.launcherStrategy
) : StandardAppHelper(instr, launcherName, component, launcherStrategy)
) : StandardAppHelper(instr, launcherName, component, launcherStrategy)

View File

@@ -20,15 +20,15 @@ import android.app.Instrumentation
import android.support.test.launcherhelper.ILauncherStrategy
import android.support.test.launcherhelper.LauncherStrategyFactory
import com.android.server.wm.flicker.testapp.ActivityOptions
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.IComponentMatcher
import com.android.server.wm.traces.parser.toFlickerComponent
class SimpleAppHelper @JvmOverloads constructor(
instr: Instrumentation,
launcherName: String = ActivityOptions.SIMPLE_ACTIVITY_LAUNCHER_NAME,
component: FlickerComponentName =
component: IComponentMatcher =
ActivityOptions.SIMPLE_ACTIVITY_AUTO_FOCUS_COMPONENT_NAME.toFlickerComponent(),
launcherStrategy: ILauncherStrategy = LauncherStrategyFactory
.getInstance(instr)
.launcherStrategy
) : StandardAppHelper(instr, launcherName, component, launcherStrategy)
) : StandardAppHelper(instr, launcherName, component, launcherStrategy)

View File

@@ -23,14 +23,14 @@ import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice
import androidx.test.uiautomator.Until
import com.android.server.wm.flicker.testapp.ActivityOptions
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.IComponentMatcher
import com.android.server.wm.traces.parser.toFlickerComponent
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
class TwoActivitiesAppHelper @JvmOverloads constructor(
instr: Instrumentation,
launcherName: String = ActivityOptions.BUTTON_ACTIVITY_LAUNCHER_NAME,
component: FlickerComponentName =
component: IComponentMatcher =
ActivityOptions.BUTTON_ACTIVITY_COMPONENT_NAME.toFlickerComponent(),
launcherStrategy: ILauncherStrategy = LauncherStrategyFactory
.getInstance(instr)

View File

@@ -37,7 +37,7 @@ import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.ComponentMatcher
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
@@ -104,7 +104,7 @@ class CloseImeAutoOpenWindowToAppTest(private val testSpec: FlickerTestParameter
@Test
fun imeAppWindowIsAlwaysVisible() {
testSpec.assertWm {
this.isAppWindowOnTop(testApp.component)
this.isAppWindowOnTop(testApp)
}
}
@@ -124,7 +124,7 @@ class CloseImeAutoOpenWindowToAppTest(private val testSpec: FlickerTestParameter
@Test
fun imeLayerVisibleStart() {
testSpec.assertLayersStart {
this.isVisible(FlickerComponentName.IME)
this.isVisible(ComponentMatcher.IME)
}
}
@@ -132,7 +132,7 @@ class CloseImeAutoOpenWindowToAppTest(private val testSpec: FlickerTestParameter
@Test
fun imeLayerInvisibleEnd() {
testSpec.assertLayersEnd {
this.isInvisible(FlickerComponentName.IME)
this.isInvisible(ComponentMatcher.IME)
}
}
@@ -144,7 +144,7 @@ class CloseImeAutoOpenWindowToAppTest(private val testSpec: FlickerTestParameter
@Test
fun imeAppLayerIsAlwaysVisible() {
testSpec.assertLayers {
this.isVisible(testApp.component)
this.isVisible(testApp)
}
}

View File

@@ -37,7 +37,7 @@ import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.ComponentMatcher
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
@@ -108,9 +108,9 @@ class CloseImeAutoOpenWindowToHomeTest(private val testSpec: FlickerTestParamete
@Test
fun imeAppWindowBecomesInvisible() {
testSpec.assertWm {
this.isAppWindowOnTop(testApp.component)
this.isAppWindowOnTop(testApp)
.then()
.isAppWindowNotOnTop(testApp.component)
.isAppWindowNotOnTop(testApp)
}
}
@@ -122,7 +122,7 @@ class CloseImeAutoOpenWindowToHomeTest(private val testSpec: FlickerTestParamete
@Test
fun imeLayerVisibleStart() {
testSpec.assertLayersStart {
this.isVisible(FlickerComponentName.IME)
this.isVisible(ComponentMatcher.IME)
}
}
@@ -130,7 +130,7 @@ class CloseImeAutoOpenWindowToHomeTest(private val testSpec: FlickerTestParamete
@Test
fun imeLayerInvisibleEnd() {
testSpec.assertLayersEnd {
this.isInvisible(FlickerComponentName.IME)
this.isInvisible(ComponentMatcher.IME)
}
}
@@ -142,9 +142,9 @@ class CloseImeAutoOpenWindowToHomeTest(private val testSpec: FlickerTestParamete
@Test
fun imeAppLayerBecomesInvisible() {
testSpec.assertLayers {
this.isVisible(testApp.component)
this.isVisible(testApp)
.then()
.isInvisible(testApp.component)
.isInvisible(testApp)
}
}
@@ -169,8 +169,8 @@ class CloseImeAutoOpenWindowToHomeTest(private val testSpec: FlickerTestParamete
fun visibleLayersShownMoreThanOneConsecutiveEntry() {
testSpec.assertLayers {
this.visibleLayersShownMoreThanOneConsecutiveEntry(listOf(
FlickerComponentName.IME,
FlickerComponentName.SPLASH_SCREEN))
ComponentMatcher.IME,
ComponentMatcher.SPLASH_SCREEN))
}
}

View File

@@ -32,7 +32,7 @@ import com.android.server.wm.flicker.helpers.ImeEditorPopupDialogAppHelper
import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.flicker.traces.region.RegionSubject
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.ComponentMatcher
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
@@ -91,12 +91,12 @@ class CloseImeEditorPopupDialogTest(private val testSpec: FlickerTestParameter)
@Test
fun imeLayerAndImeSnapshotVisibleOnScreen() {
testSpec.assertLayers {
this.isVisible(FlickerComponentName.IME)
this.isVisible(ComponentMatcher.IME)
.then()
.isVisible(FlickerComponentName.IME_SNAPSHOT)
.isVisible(ComponentMatcher.IME_SNAPSHOT)
.then()
.isInvisible(FlickerComponentName.IME_SNAPSHOT, isOptional = true)
.isInvisible(FlickerComponentName.IME)
.isInvisible(ComponentMatcher.IME_SNAPSHOT, isOptional = true)
.isInvisible(ComponentMatcher.IME)
}
}
@@ -107,13 +107,13 @@ class CloseImeEditorPopupDialogTest(private val testSpec: FlickerTestParameter)
this.invoke("imeSnapshotAssociatedOnAppVisibleRegion") {
val imeSnapshotLayers = it.subjects.filter {
subject -> subject.name.contains(
FlickerComponentName.IME_SNAPSHOT.toLayerName()) && subject.isVisible
ComponentMatcher.IME_SNAPSHOT.toLayerName()) && subject.isVisible
}
if (imeSnapshotLayers.isNotEmpty()) {
val visibleAreas = imeSnapshotLayers.mapNotNull { imeSnapshotLayer ->
imeSnapshotLayer.layer?.visibleRegion }.toTypedArray()
val imeVisibleRegion = RegionSubject.assertThat(visibleAreas, this, timestamp)
val appVisibleRegion = it.visibleRegion(imeTestApp.component)
val appVisibleRegion = it.visibleRegion(imeTestApp)
if (imeVisibleRegion.region.isNotEmpty) {
imeVisibleRegion.coversAtMost(appVisibleRegion.region)
}

View File

@@ -34,7 +34,7 @@ import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.ComponentMatcher
import org.junit.Assume.assumeFalse
import org.junit.Assume.assumeTrue
import org.junit.FixMethodOrder
@@ -91,9 +91,9 @@ class CloseImeWindowToAppTest(private val testSpec: FlickerTestParameter) {
fun visibleWindowsShownMoreThanOneConsecutiveEntry() {
testSpec.assertWm {
this.visibleWindowsShownMoreThanOneConsecutiveEntry(listOf(
FlickerComponentName.IME,
FlickerComponentName.SPLASH_SCREEN,
FlickerComponentName.SNAPSHOT))
ComponentMatcher.IME,
ComponentMatcher.SPLASH_SCREEN,
ComponentMatcher.SNAPSHOT))
}
}
@@ -101,7 +101,7 @@ class CloseImeWindowToAppTest(private val testSpec: FlickerTestParameter) {
@Test
fun imeAppWindowIsAlwaysVisible() {
testSpec.assertWm {
this.isAppWindowOnTop(testApp.component)
this.isAppWindowOnTop(testApp)
}
}
@@ -151,7 +151,7 @@ class CloseImeWindowToAppTest(private val testSpec: FlickerTestParameter) {
@Test
fun imeAppLayerIsAlwaysVisible() {
testSpec.assertLayers {
this.isVisible(testApp.component)
this.isVisible(testApp)
}
}

View File

@@ -36,7 +36,7 @@ import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.ComponentMatcher
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
@@ -93,9 +93,9 @@ class CloseImeWindowToHomeTest(private val testSpec: FlickerTestParameter) {
fun visibleWindowsShownMoreThanOneConsecutiveEntry() {
testSpec.assertWm {
this.visibleWindowsShownMoreThanOneConsecutiveEntry(listOf(
FlickerComponentName.IME,
FlickerComponentName.SPLASH_SCREEN,
FlickerComponentName.SNAPSHOT))
ComponentMatcher.IME,
ComponentMatcher.SPLASH_SCREEN,
ComponentMatcher.SNAPSHOT))
}
}
@@ -107,9 +107,9 @@ class CloseImeWindowToHomeTest(private val testSpec: FlickerTestParameter) {
@Test
fun imeAppWindowBecomesInvisible() {
testSpec.assertWm {
this.isAppWindowVisible(testApp.component)
this.isAppWindowVisible(testApp)
.then()
.isAppWindowInvisible(testApp.component)
.isAppWindowInvisible(testApp)
}
}
@@ -133,9 +133,9 @@ class CloseImeWindowToHomeTest(private val testSpec: FlickerTestParameter) {
@Test
fun imeAppLayerBecomesInvisible() {
testSpec.assertLayers {
this.isVisible(testApp.component)
this.isVisible(testApp)
.then()
.isInvisible(testApp.component)
.isInvisible(testApp)
}
}
@@ -152,8 +152,8 @@ class CloseImeWindowToHomeTest(private val testSpec: FlickerTestParameter) {
fun visibleLayersShownMoreThanOneConsecutiveEntry() {
testSpec.assertLayers {
this.visibleLayersShownMoreThanOneConsecutiveEntry(listOf(
FlickerComponentName.IME,
FlickerComponentName.SPLASH_SCREEN))
ComponentMatcher.IME,
ComponentMatcher.SPLASH_SCREEN))
}
}

View File

@@ -18,52 +18,52 @@
package com.android.server.wm.flicker.ime
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.ComponentMatcher
fun FlickerTestParameter.imeLayerBecomesVisible() {
assertLayers {
this.isInvisible(FlickerComponentName.IME)
this.isInvisible(ComponentMatcher.IME)
.then()
.isVisible(FlickerComponentName.IME)
.isVisible(ComponentMatcher.IME)
}
}
fun FlickerTestParameter.imeLayerBecomesInvisible() {
assertLayers {
this.isVisible(FlickerComponentName.IME)
this.isVisible(ComponentMatcher.IME)
.then()
.isInvisible(FlickerComponentName.IME)
.isInvisible(ComponentMatcher.IME)
}
}
fun FlickerTestParameter.imeWindowIsAlwaysVisible(rotatesScreen: Boolean = false) {
if (rotatesScreen) {
assertWm {
this.isNonAppWindowVisible(FlickerComponentName.IME)
this.isNonAppWindowVisible(ComponentMatcher.IME)
.then()
.isNonAppWindowInvisible(FlickerComponentName.IME)
.isNonAppWindowInvisible(ComponentMatcher.IME)
.then()
.isNonAppWindowVisible(FlickerComponentName.IME)
.isNonAppWindowVisible(ComponentMatcher.IME)
}
} else {
assertWm {
this.isNonAppWindowVisible(FlickerComponentName.IME)
this.isNonAppWindowVisible(ComponentMatcher.IME)
}
}
}
fun FlickerTestParameter.imeWindowBecomesVisible() {
assertWm {
this.isNonAppWindowInvisible(FlickerComponentName.IME)
this.isNonAppWindowInvisible(ComponentMatcher.IME)
.then()
.isNonAppWindowVisible(FlickerComponentName.IME)
.isNonAppWindowVisible(ComponentMatcher.IME)
}
}
fun FlickerTestParameter.imeWindowBecomesInvisible() {
assertWm {
this.isNonAppWindowVisible(FlickerComponentName.IME)
this.isNonAppWindowVisible(ComponentMatcher.IME)
.then()
.isNonAppWindowInvisible(FlickerComponentName.IME)
.isNonAppWindowInvisible(ComponentMatcher.IME)
}
}

View File

@@ -32,7 +32,7 @@ import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.ImeAppAutoFocusHelper
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.ComponentMatcher
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.FixMethodOrder
@@ -81,31 +81,31 @@ class LaunchAppShowImeAndDialogThemeAppTest(private val testSpec: FlickerTestPar
}
/**
* Checks that [FlickerComponentName.IME] layer becomes visible during the transition
* Checks that [ComponentMatcher.IME] layer becomes visible during the transition
*/
@FlakyTest(bugId = 215884488)
@Test
fun imeWindowIsAlwaysVisible() = testSpec.imeWindowIsAlwaysVisible()
/**
* Checks that [FlickerComponentName.IME] layer is visible at the end of the transition
* Checks that [ComponentMatcher.IME] layer is visible at the end of the transition
*/
@FlakyTest(bugId = 227142436)
@Test
fun imeLayerExistsEnd() {
testSpec.assertLayersEnd {
this.isVisible(FlickerComponentName.IME)
this.isVisible(ComponentMatcher.IME)
}
}
/**
* Checks that [FlickerComponentName.IME_SNAPSHOT] layer is invisible always.
* Checks that [ComponentMatcher.IME_SNAPSHOT] layer is invisible always.
*/
@Presubmit
@Test
fun imeSnapshotNotVisible() {
testSpec.assertLayers {
this.isInvisible(FlickerComponentName.IME_SNAPSHOT)
this.isInvisible(ComponentMatcher.IME_SNAPSHOT)
}
}

View File

@@ -30,7 +30,7 @@ import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.ImeAppAutoFocusHelper
import com.android.server.wm.flicker.helpers.ImeStateInitializeHelper
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.ComponentMatcher
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
@@ -99,38 +99,38 @@ class LaunchAppShowImeOnStartTest(private val testSpec: FlickerTestParameter) {
}
/**
* Checks that [FlickerComponentName.IME] window becomes visible during the transition
* Checks that [ComponentMatcher.IME] window becomes visible during the transition
*/
@Presubmit
@Test
fun imeWindowBecomesVisible() = testSpec.imeWindowBecomesVisible()
/**
* Checks that [FlickerComponentName.IME] layer becomes visible during the transition
* Checks that [ComponentMatcher.IME] layer becomes visible during the transition
*/
@Presubmit
@Test
fun imeLayerBecomesVisible() = testSpec.imeLayerBecomesVisible()
/**
* Checks that [FlickerComponentName.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(FlickerComponentName.IME)
this.isInvisible(ComponentMatcher.IME)
}
}
/**
* Checks that [FlickerComponentName.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(FlickerComponentName.IME)
this.isVisible(ComponentMatcher.IME)
}
}

View File

@@ -114,7 +114,7 @@ class OpenImeWindowFromFixedOrientationAppTest(private val testSpec: FlickerTest
@Postsubmit
@Test
fun snapshotStartingWindowLayerCoversExactlyOnApp() {
testSpec.snapshotStartingWindowLayerCoversExactlyOnApp(imeTestApp.component)
testSpec.snapshotStartingWindowLayerCoversExactlyOnApp(imeTestApp)
}
companion object {

View File

@@ -94,7 +94,7 @@ class OpenImeWindowTest(private val testSpec: FlickerTestParameter) {
@Test
fun appWindowAlwaysVisibleOnTop() {
testSpec.assertWm {
this.isAppWindowOnTop(testApp.component)
this.isAppWindowOnTop(testApp)
}
}
@@ -118,7 +118,7 @@ class OpenImeWindowTest(private val testSpec: FlickerTestParameter) {
@Test
fun layerAlwaysVisible() {
testSpec.assertLayers {
this.isVisible(testApp.component)
this.isVisible(testApp)
}
}

View File

@@ -36,7 +36,7 @@ import com.android.server.wm.flicker.navBarLayerIsVisible
import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.ComponentMatcher
import com.android.server.wm.traces.common.WindowManagerConditionsFactory
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
import org.junit.Assume.assumeFalse
@@ -154,10 +154,10 @@ class OpenImeWindowToOverViewTest(private val testSpec: FlickerTestParameter) {
assumeTrue(testSpec.isGesturalNavigation)
assumeTrue(isShellTransitionsEnabled)
testSpec.assertLayersStart {
this.isVisible(FlickerComponentName.NAV_BAR)
this.isVisible(ComponentMatcher.NAV_BAR)
}
testSpec.assertLayersEnd {
this.isInvisible(FlickerComponentName.NAV_BAR)
this.isInvisible(ComponentMatcher.NAV_BAR)
}
}
@@ -173,10 +173,10 @@ class OpenImeWindowToOverViewTest(private val testSpec: FlickerTestParameter) {
fun statusBarLayerIsInvisibleInLandscape() {
assumeTrue(testSpec.isLandscapeOrSeascapeAtStart)
testSpec.assertLayersStart {
this.isVisible(FlickerComponentName.STATUS_BAR)
this.isVisible(ComponentMatcher.STATUS_BAR)
}
testSpec.assertLayersEnd {
this.isInvisible(FlickerComponentName.STATUS_BAR)
this.isInvisible(ComponentMatcher.STATUS_BAR)
}
}
@@ -184,16 +184,16 @@ class OpenImeWindowToOverViewTest(private val testSpec: FlickerTestParameter) {
@Test
fun imeLayerIsVisibleAndAssociatedWithAppWidow() {
testSpec.assertLayersStart {
isVisible(FlickerComponentName.IME).visibleRegion(FlickerComponentName.IME)
.coversAtMost(isVisible(imeTestApp.component)
.visibleRegion(imeTestApp.component).region)
isVisible(ComponentMatcher.IME).visibleRegion(ComponentMatcher.IME)
.coversAtMost(isVisible(imeTestApp)
.visibleRegion(imeTestApp).region)
}
testSpec.assertLayers {
this.invoke("imeLayerIsVisibleAndAlignAppWidow") {
val imeVisibleRegion = it.visibleRegion(FlickerComponentName.IME)
val appVisibleRegion = it.visibleRegion(imeTestApp.component)
val imeVisibleRegion = it.visibleRegion(ComponentMatcher.IME)
val appVisibleRegion = it.visibleRegion(imeTestApp)
if (imeVisibleRegion.region.isNotEmpty) {
it.isVisible(FlickerComponentName.IME)
it.isVisible(ComponentMatcher.IME)
imeVisibleRegion.coversAtMost(appVisibleRegion.region)
}
}

View File

@@ -39,8 +39,8 @@ import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.FlickerComponentName.Companion.LAUNCHER
import com.android.server.wm.traces.common.ComponentMatcher
import com.android.server.wm.traces.common.ComponentMatcher.Companion.LAUNCHER
import org.junit.Assume.assumeFalse
import org.junit.Assume.assumeTrue
import org.junit.Before
@@ -109,11 +109,11 @@ open class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) {
@Presubmit
@Test
fun visibleWindowsShownMoreThanOneConsecutiveEntry() {
val component = FlickerComponentName("", "RecentTaskScreenshotSurface")
val component = ComponentMatcher("", "RecentTaskScreenshotSurface")
testSpec.assertWm {
this.visibleWindowsShownMoreThanOneConsecutiveEntry(
ignoreWindows = listOf(FlickerComponentName.SPLASH_SCREEN,
FlickerComponentName.SNAPSHOT,
ignoreWindows = listOf(ComponentMatcher.SPLASH_SCREEN,
ComponentMatcher.SNAPSHOT,
component)
)
}
@@ -143,11 +143,11 @@ open class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) {
// 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.component)
this.isAppWindowVisible(testApp)
.then()
.isAppWindowInvisible(testApp.component)
.isAppWindowInvisible(testApp)
.then()
.isAppWindowVisible(testApp.component)
.isAppWindowVisible(testApp)
}
}
@@ -160,7 +160,7 @@ open class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) {
// and the app visibility are updated together, sometimes not, thus ignore activity
// check at the start
testSpec.assertWm {
this.isAppWindowVisible(testApp.component)
this.isAppWindowVisible(testApp)
}
}
@@ -182,11 +182,11 @@ open class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) {
fun imeLayerIsBecomesVisibleLegacy() {
assumeFalse(isShellTransitionsEnabled)
testSpec.assertLayers {
this.isVisible(FlickerComponentName.IME)
this.isVisible(ComponentMatcher.IME)
.then()
.isInvisible(FlickerComponentName.IME)
.isInvisible(ComponentMatcher.IME)
.then()
.isVisible(FlickerComponentName.IME)
.isVisible(ComponentMatcher.IME)
}
}
@@ -195,7 +195,7 @@ open class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) {
fun imeLayerIsBecomesVisible() {
assumeTrue(isShellTransitionsEnabled)
testSpec.assertLayers {
this.isVisible(FlickerComponentName.IME)
this.isVisible(ComponentMatcher.IME)
}
}
@@ -203,11 +203,11 @@ open class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) {
@Test
fun appLayerReplacesLauncher() {
testSpec.assertLayers {
this.isVisible(FlickerComponentName.LAUNCHER)
this.isVisible(ComponentMatcher.LAUNCHER)
.then()
.isVisible(FlickerComponentName.SNAPSHOT, isOptional = true)
.isVisible(ComponentMatcher.SNAPSHOT, isOptional = true)
.then()
.isVisible(testApp.component)
.isVisible(testApp)
}
}
@@ -224,11 +224,11 @@ open class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) {
fun visibleLayersShownMoreThanOneConsecutiveEntry() {
// depends on how much of the animation transactions are sent to SF at once
// sometimes this layer appears for 2-3 frames, sometimes for only 1
val recentTaskComponent = FlickerComponentName("", "RecentTaskScreenshotSurface")
val recentTaskComponent = ComponentMatcher("", "RecentTaskScreenshotSurface")
testSpec.assertLayers {
this.visibleLayersShownMoreThanOneConsecutiveEntry(
listOf(FlickerComponentName.SPLASH_SCREEN,
FlickerComponentName.SNAPSHOT, recentTaskComponent)
listOf(ComponentMatcher.SPLASH_SCREEN,
ComponentMatcher.SNAPSHOT, recentTaskComponent)
)
}
}

View File

@@ -35,7 +35,7 @@ import com.android.server.wm.flicker.helpers.isShellTransitionsEnabled
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.ComponentMatcher
import org.junit.Assume
import org.junit.Before
import org.junit.FixMethodOrder
@@ -72,12 +72,12 @@ open class SwitchImeWindowsFromGestureNavTest(private val testSpec: FlickerTestP
this.setRotation(testSpec.startRotation)
testApp.launchViaIntent(wmHelper)
wmHelper.StateSyncBuilder()
.withFullScreenApp(testApp.component)
.withFullScreenApp(testApp)
.waitForAndVerify()
imeTestApp.launchViaIntent(wmHelper)
wmHelper.StateSyncBuilder()
.withFullScreenApp(imeTestApp.component)
.withFullScreenApp(imeTestApp)
.waitForAndVerify()
imeTestApp.openIME(wmHelper)
@@ -101,7 +101,7 @@ open class SwitchImeWindowsFromGestureNavTest(private val testSpec: FlickerTestP
displayBounds.bounds.width, displayBounds.bounds.height, 50)
wmHelper.StateSyncBuilder()
.withFullScreenApp(testApp.component)
.withFullScreenApp(testApp)
.waitForAndVerify()
createTag(TAG_IME_INVISIBLE)
}
@@ -111,7 +111,7 @@ open class SwitchImeWindowsFromGestureNavTest(private val testSpec: FlickerTestP
device.swipe(displayBounds.bounds.width, displayBounds.bounds.height,
0, displayBounds.bounds.height, 50)
wmHelper.StateSyncBuilder()
.withFullScreenApp(imeTestApp.component)
.withFullScreenApp(imeTestApp)
.waitForAndVerify()
}
}
@@ -120,55 +120,55 @@ open class SwitchImeWindowsFromGestureNavTest(private val testSpec: FlickerTestP
@Test
fun imeAppWindowVisibility() {
testSpec.assertWm {
isAppWindowVisible(imeTestApp.component)
isAppWindowVisible(imeTestApp)
.then()
.isAppSnapshotStartingWindowVisibleFor(testApp.component, isOptional = true)
.isAppSnapshotStartingWindowVisibleFor(testApp, isOptional = true)
.then()
.isAppWindowVisible(testApp.component)
.isAppWindowVisible(testApp)
.then()
.isAppSnapshotStartingWindowVisibleFor(imeTestApp.component, isOptional = true)
.isAppSnapshotStartingWindowVisibleFor(imeTestApp, isOptional = true)
.then()
.isAppWindowVisible(imeTestApp.component)
.isAppWindowVisible(imeTestApp)
}
}
@Test
fun navBarLayerIsVisibleAroundSwitching() {
testSpec.assertLayersStart {
isVisible(FlickerComponentName.NAV_BAR)
isVisible(ComponentMatcher.NAV_BAR)
}
testSpec.assertLayersEnd {
isVisible(FlickerComponentName.NAV_BAR)
isVisible(ComponentMatcher.NAV_BAR)
}
}
@Test
fun statusBarLayerIsVisibleAroundSwitching() {
testSpec.assertLayersStart {
isVisible(FlickerComponentName.STATUS_BAR)
isVisible(ComponentMatcher.STATUS_BAR)
}
testSpec.assertLayersEnd {
isVisible(FlickerComponentName.STATUS_BAR)
isVisible(ComponentMatcher.STATUS_BAR)
}
}
@Test
fun imeLayerIsVisibleWhenSwitchingToImeApp() {
testSpec.assertLayersStart {
isVisible(FlickerComponentName.IME)
isVisible(ComponentMatcher.IME)
}
testSpec.assertLayersTag(TAG_IME_VISIBLE) {
isVisible(FlickerComponentName.IME)
isVisible(ComponentMatcher.IME)
}
testSpec.assertLayersEnd {
isVisible(FlickerComponentName.IME)
isVisible(ComponentMatcher.IME)
}
}
@Test
fun imeLayerIsInvisibleWhenSwitchingToTestApp() {
testSpec.assertLayersTag(TAG_IME_INVISIBLE) {
isInvisible(FlickerComponentName.IME)
isInvisible(ComponentMatcher.IME)
}
}

View File

@@ -30,7 +30,7 @@ import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.entireScreenCovered
import com.android.server.wm.flicker.helpers.TwoActivitiesAppHelper
import com.android.server.wm.flicker.testapp.ActivityOptions
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.ComponentMatcher
import com.android.server.wm.traces.parser.toFlickerComponent
import org.junit.FixMethodOrder
import org.junit.Test
@@ -86,7 +86,7 @@ class ActivitiesTransitionTest(val testSpec: FlickerTestParameter) {
testApp.openSecondActivity(device, wmHelper)
tapl.pressBack()
wmHelper.StateSyncBuilder()
.withFullScreenApp(testApp.component)
.withFullScreenApp(testApp)
.waitForAndVerify()
}
}
@@ -123,7 +123,7 @@ class ActivitiesTransitionTest(val testSpec: FlickerTestParameter) {
fun entireScreenCovered() = testSpec.entireScreenCovered()
/**
* Checks that the [FlickerComponentName.LAUNCHER] window is not on top. The launcher cannot be
* Checks that the [ComponentMatcher.LAUNCHER] window is not on top. The launcher cannot be
* asserted with `isAppWindowVisible` because it contains 2 windows with the exact same name,
* and both are never simultaneously visible
*/
@@ -131,17 +131,17 @@ class ActivitiesTransitionTest(val testSpec: FlickerTestParameter) {
@Test
fun launcherWindowNotOnTop() {
testSpec.assertWm {
this.isAppWindowNotOnTop(FlickerComponentName.LAUNCHER)
this.isAppWindowNotOnTop(ComponentMatcher.LAUNCHER)
}
}
/**
* Checks that the [FlickerComponentName.LAUNCHER] layer is never visible during the transition
* Checks that the [ComponentMatcher.LAUNCHER] layer is never visible during the transition
*/
@Presubmit
@Test
fun launcherLayerNotVisible() {
testSpec.assertLayers { this.isInvisible(FlickerComponentName.LAUNCHER) }
testSpec.assertLayers { this.isInvisible(ComponentMatcher.LAUNCHER) }
}
companion object {

View File

@@ -19,7 +19,7 @@ package com.android.server.wm.flicker.launch
import android.platform.test.annotations.Presubmit
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.replacesLayer
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.ComponentMatcher
import org.junit.Test
/**
@@ -40,17 +40,17 @@ abstract class OpenAppFromLauncherTransition(testSpec: FlickerTestParameter) :
}
/**
* Checks that [FlickerComponentName.LAUNCHER] layer is visible at the start of the transition,
* 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(FlickerComponentName.LAUNCHER, testApp.component,
testSpec.replacesLayer(ComponentMatcher.LAUNCHER, testApp,
ignoreEntriesWithRotationLayer = true, ignoreSnapshot = true,
ignoreSplashscreen = true)
}
/**
* Checks that [FlickerComponentName.LAUNCHER] window is visible at the start of the
* Checks that [ComponentMatcher.LAUNCHER] window is visible at the start of the
* transition, and is replaced by a snapshot or splash screen (optional), and finally, is
* replaced by [testApp], which remains visible until the end
*/
@@ -58,13 +58,13 @@ abstract class OpenAppFromLauncherTransition(testSpec: FlickerTestParameter) :
@Test
open fun appWindowReplacesLauncherAsTopWindow() {
testSpec.assertWm {
this.isAppWindowOnTop(FlickerComponentName.LAUNCHER)
.then()
.isAppWindowOnTop(
testApp.component
.or(FlickerComponentName.SNAPSHOT)
.or(FlickerComponentName.SPLASH_SCREEN)
)
this.isAppWindowOnTop(ComponentMatcher.LAUNCHER)
.then()
.isAppWindowOnTop(
testApp
.or(ComponentMatcher.SNAPSHOT)
.or(ComponentMatcher.SPLASH_SCREEN)
)
}
}
}

View File

@@ -26,7 +26,7 @@ import com.android.server.wm.flicker.annotation.Group1
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.navBarLayerPositionEnd
import com.android.server.wm.flicker.statusBarLayerPositionEnd
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.ComponentMatcher
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
@@ -83,11 +83,11 @@ open class OpenAppFromLockNotificationWarm(testSpec: FlickerTestParameter) :
testSpec.assertWm {
this.hasNoVisibleAppWindow()
.then()
.isAppWindowOnTop(FlickerComponentName.SNAPSHOT, isOptional = true)
.isAppWindowOnTop(ComponentMatcher.SNAPSHOT, isOptional = true)
.then()
.isAppWindowOnTop(FlickerComponentName.SPLASH_SCREEN, isOptional = true)
.isAppWindowOnTop(ComponentMatcher.SPLASH_SCREEN, isOptional = true)
.then()
.isAppWindowOnTop(testApp.component)
.isAppWindowOnTop(testApp)
}
}

View File

@@ -28,7 +28,7 @@ import com.android.server.wm.flicker.helpers.ShowWhenLockedAppHelper
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
import com.android.server.wm.flicker.navBarLayerPositionEnd
import com.android.server.wm.flicker.statusBarLayerPositionEnd
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.ComponentMatcher
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
@@ -67,7 +67,7 @@ class OpenAppFromLockNotificationWithLockOverlayApp(testSpec: FlickerTestParamet
// Launch an activity that is shown when the device is locked
showWhenLockedApp.launchViaIntent(wmHelper)
wmHelper.StateSyncBuilder()
.withFullScreenApp(showWhenLockedApp.component)
.withFullScreenApp(showWhenLockedApp)
.waitForAndVerify()
device.sleep()
@@ -90,9 +90,9 @@ class OpenAppFromLockNotificationWithLockOverlayApp(testSpec: FlickerTestParamet
testSpec.assertWm {
this.hasNoVisibleAppWindow()
.then()
.isAppWindowOnTop(FlickerComponentName.SNAPSHOT, isOptional = true)
.isAppWindowOnTop(ComponentMatcher.SNAPSHOT, isOptional = true)
.then()
.isAppWindowOnTop(showWhenLockedApp.component)
.isAppWindowOnTop(showWhenLockedApp)
}
}
@@ -100,11 +100,11 @@ class OpenAppFromLockNotificationWithLockOverlayApp(testSpec: FlickerTestParamet
@Postsubmit
fun showWhenLockedAppLayerBecomesVisible() {
testSpec.assertLayers {
this.isInvisible(showWhenLockedApp.component)
this.isInvisible(showWhenLockedApp)
.then()
.isVisible(FlickerComponentName.SNAPSHOT, isOptional = true)
.isVisible(ComponentMatcher.SNAPSHOT, isOptional = true)
.then()
.isVisible(showWhenLockedApp.component)
.isVisible(showWhenLockedApp)
}
}

View File

@@ -23,7 +23,7 @@ import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.navBarLayerPositionEnd
import com.android.server.wm.flicker.statusBarLayerPositionEnd
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.ComponentMatcher
import org.junit.Test
/**
@@ -77,17 +77,16 @@ abstract class OpenAppFromLockTransition(testSpec: FlickerTestParameter) :
testSpec.assertWm {
this.hasNoVisibleAppWindow()
.then()
.isAppWindowOnTop(FlickerComponentName.SNAPSHOT, isOptional = true)
.isAppWindowOnTop(ComponentMatcher.SNAPSHOT, isOptional = true)
.then()
.isAppWindowOnTop(FlickerComponentName.SPLASH_SCREEN, isOptional = true)
.isAppWindowOnTop(ComponentMatcher.SPLASH_SCREEN, isOptional = true)
.then()
.isAppWindowOnTop(testApp.component)
.isAppWindowOnTop(testApp)
}
}
/**
* Checks that the screen is locked at the start of the transition ([colorFadComponent])
* layer is visible
* Checks that the screen is locked at the start of the transition
*/
@Presubmit
@Test
@@ -131,7 +130,7 @@ abstract class OpenAppFromLockTransition(testSpec: FlickerTestParameter) :
@Test
override fun statusBarLayerIsVisible() {
testSpec.assertLayersEnd {
this.isVisible(FlickerComponentName.STATUS_BAR)
this.isVisible(ComponentMatcher.STATUS_BAR)
}
}
}

View File

@@ -68,7 +68,7 @@ open class OpenAppFromNotificationWarm(testSpec: FlickerTestParameter) :
eachRun {
testApp.launchViaIntent(wmHelper)
wmHelper.StateSyncBuilder()
.withFullScreenApp(testApp.component)
.withFullScreenApp(testApp)
.waitForAndVerify()
testApp.postNotification(wmHelper)
tapl.goHome()
@@ -108,7 +108,7 @@ open class OpenAppFromNotificationWarm(testSpec: FlickerTestParameter) :
// Wait for the app to launch
wmHelper.StateSyncBuilder()
.withFullScreenApp(testApp.component)
.withFullScreenApp(testApp)
.waitForAndVerify()
}
@@ -148,7 +148,7 @@ open class OpenAppFromNotificationWarm(testSpec: FlickerTestParameter) :
@Postsubmit
fun notificationAppWindowVisibleAtEnd() {
testSpec.assertWmEnd {
this.isAppWindowVisible(testApp.component)
this.isAppWindowVisible(testApp)
}
}
@@ -156,7 +156,7 @@ open class OpenAppFromNotificationWarm(testSpec: FlickerTestParameter) :
@Postsubmit
fun notificationAppWindowOnTopAtEnd() {
testSpec.assertWmEnd {
this.isAppWindowOnTop(testApp.component)
this.isAppWindowOnTop(testApp)
}
}
@@ -164,7 +164,7 @@ open class OpenAppFromNotificationWarm(testSpec: FlickerTestParameter) :
@Postsubmit
fun notificationAppLayerVisibleAtEnd() {
testSpec.assertLayersEnd {
this.isVisible(testApp.component)
this.isVisible(testApp)
}
}

View File

@@ -89,7 +89,7 @@ open class OpenAppFromOverviewTest(testSpec: FlickerTestParameter) :
transitions {
tapl.overview.currentTask.open()
wmHelper.StateSyncBuilder()
.withFullScreenApp(testApp.component)
.withFullScreenApp(testApp)
.waitForAndVerify()
}
}

View File

@@ -29,7 +29,7 @@ import com.android.server.wm.flicker.annotation.Group1
import com.android.server.wm.flicker.helpers.NonResizeableAppHelper
import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.server.wm.flicker.navBarLayerPositionEnd
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.ComponentMatcher
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
@@ -72,9 +72,9 @@ open class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) :
@Test
fun navBarLayerVisibilityChanges() {
testSpec.assertLayers {
this.isInvisible(FlickerComponentName.NAV_BAR)
this.isInvisible(ComponentMatcher.NAV_BAR)
.then()
.isVisible(FlickerComponentName.NAV_BAR)
.isVisible(ComponentMatcher.NAV_BAR)
}
}
@@ -85,7 +85,7 @@ open class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) :
@Test
fun appWindowBecomesVisibleAtEnd() {
testSpec.assertWmEnd {
this.isAppWindowVisible(testApp.component)
this.isAppWindowVisible(testApp)
}
}
@@ -97,9 +97,9 @@ open class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) :
@Test
fun navBarWindowsVisibilityChanges() {
testSpec.assertWm {
this.isNonAppWindowInvisible(FlickerComponentName.NAV_BAR)
this.isNonAppWindowInvisible(ComponentMatcher.NAV_BAR)
.then()
.isAboveAppWindowVisible(FlickerComponentName.NAV_BAR)
.isAboveAppWindowVisible(ComponentMatcher.NAV_BAR)
}
}
@@ -112,7 +112,7 @@ open class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) :
@Test
override fun statusBarLayerIsVisible() {
testSpec.assertLayersEnd {
this.isVisible(FlickerComponentName.STATUS_BAR)
this.isVisible(ComponentMatcher.STATUS_BAR)
}
}
@@ -128,7 +128,7 @@ open class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) :
testSpec.assertLayersEnd {
val display = this.entry.displays.minByOrNull { it.id }
?: error("There is no display!")
this.visibleRegion(FlickerComponentName.STATUS_BAR)
this.visibleRegion(ComponentMatcher.STATUS_BAR)
.coversExactly(WindowUtils.getStatusBarPosition(display))
}
}

View File

@@ -34,7 +34,7 @@ import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.ComponentMatcher
import org.junit.Test
/**
@@ -161,27 +161,27 @@ abstract class OpenAppTransition(protected val testSpec: FlickerTestParameter) {
protected fun appLayerBecomesVisible_coldStart() {
testSpec.assertLayers {
this.notContains(testApp.component)
this.notContains(testApp)
.then()
.isInvisible(testApp.component, isOptional = true)
.isInvisible(testApp, isOptional = true)
.then()
.isVisible(FlickerComponentName.SNAPSHOT, isOptional = true)
.isVisible(ComponentMatcher.SNAPSHOT, isOptional = true)
.then()
.isVisible(FlickerComponentName.SPLASH_SCREEN, isOptional = true)
.isVisible(ComponentMatcher.SPLASH_SCREEN, isOptional = true)
.then()
.isVisible(testApp.component)
.isVisible(testApp)
}
}
protected fun appLayerBecomesVisible_warmStart() {
testSpec.assertLayers {
this.isInvisible(testApp.component)
this.isInvisible(testApp)
.then()
.isVisible(FlickerComponentName.SNAPSHOT, isOptional = true)
.isVisible(ComponentMatcher.SNAPSHOT, isOptional = true)
.then()
.isVisible(FlickerComponentName.SPLASH_SCREEN, isOptional = true)
.isVisible(ComponentMatcher.SPLASH_SCREEN, isOptional = true)
.then()
.isVisible(testApp.component)
.isVisible(testApp)
}
}
@@ -198,23 +198,23 @@ abstract class OpenAppTransition(protected val testSpec: FlickerTestParameter) {
protected fun appWindowBecomesVisible_coldStart() {
testSpec.assertWm {
this.notContains(testApp.component)
this.notContains(testApp)
.then()
.isAppWindowInvisible(testApp.component, isOptional = true)
.isAppWindowInvisible(testApp, isOptional = true)
.then()
.isAppWindowVisible(testApp.component)
.isAppWindowVisible(testApp)
}
}
protected fun appWindowBecomesVisible_warmStart() {
testSpec.assertWm {
this.isAppWindowInvisible(testApp.component)
this.isAppWindowInvisible(testApp)
.then()
.isAppWindowVisible(FlickerComponentName.SNAPSHOT, isOptional = true)
.isAppWindowVisible(ComponentMatcher.SNAPSHOT, isOptional = true)
.then()
.isAppWindowVisible(FlickerComponentName.SPLASH_SCREEN, isOptional = true)
.isAppWindowVisible(ComponentMatcher.SPLASH_SCREEN, isOptional = true)
.then()
.isAppWindowVisible(testApp.component)
.isAppWindowVisible(testApp)
}
}
@@ -226,12 +226,12 @@ abstract class OpenAppTransition(protected val testSpec: FlickerTestParameter) {
@Test
open fun appWindowBecomesTopWindow() {
testSpec.assertWm {
this.isAppWindowNotOnTop(testApp.component)
this.isAppWindowNotOnTop(testApp)
.then()
.isAppWindowOnTop(
testApp.component
.or(FlickerComponentName.SNAPSHOT)
.or(FlickerComponentName.SPLASH_SCREEN)
testApp
.or(ComponentMatcher.SNAPSHOT)
.or(ComponentMatcher.SPLASH_SCREEN)
)
}
}
@@ -244,7 +244,7 @@ abstract class OpenAppTransition(protected val testSpec: FlickerTestParameter) {
@Test
open fun appWindowIsTopWindowAtEnd() {
testSpec.assertWmEnd {
this.isAppWindowOnTop(testApp.component)
this.isAppWindowOnTop(testApp)
}
}
}

View File

@@ -37,9 +37,10 @@ import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.flicker.testapp.ActivityOptions.LAUNCH_NEW_TASK_ACTIVITY_COMPONENT_NAME
import com.android.server.wm.flicker.testapp.ActivityOptions.SIMPLE_ACTIVITY_AUTO_FOCUS_COMPONENT_NAME
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.FlickerComponentName.Companion.SPLASH_SCREEN
import com.android.server.wm.traces.common.FlickerComponentName.Companion.WALLPAPER_BBQ_WRAPPER
import com.android.server.wm.traces.common.ComponentMatcher
import com.android.server.wm.traces.common.ComponentMatcher.Companion.SPLASH_SCREEN
import com.android.server.wm.traces.common.ComponentMatcher.Companion.WALLPAPER_BBQ_WRAPPER
import com.android.server.wm.traces.common.IComponentMatcher
import com.android.server.wm.traces.parser.toFlickerComponent
import org.junit.FixMethodOrder
import org.junit.Test
@@ -87,7 +88,7 @@ class TaskTransitionTest(val testSpec: FlickerTestParameter) {
mTestApp.openNewTask(device, wmHelper)
tapl.pressBack()
wmHelper.StateSyncBuilder()
.withFullScreenApp(mTestApp.component)
.withFullScreenApp(mTestApp)
.waitForAndVerify()
}
}
@@ -126,7 +127,7 @@ class TaskTransitionTest(val testSpec: FlickerTestParameter) {
@Test
fun launcherWindowIsNeverVisible() {
testSpec.assertWm {
this.isAppWindowInvisible(FlickerComponentName.LAUNCHER)
this.isAppWindowInvisible(ComponentMatcher.LAUNCHER)
}
}
@@ -138,7 +139,7 @@ class TaskTransitionTest(val testSpec: FlickerTestParameter) {
@Test
fun launcherLayerIsNeverVisible() {
testSpec.assertLayers {
this.isInvisible(FlickerComponentName.LAUNCHER)
this.isInvisible(ComponentMatcher.LAUNCHER)
}
}
@@ -148,7 +149,7 @@ class TaskTransitionTest(val testSpec: FlickerTestParameter) {
@Postsubmit
@Test
fun colorLayerIsVisibleDuringTransition() {
val bgColorLayer = FlickerComponentName("", "colorBackgroundLayer")
val bgColorLayer = ComponentMatcher("", "colorBackgroundLayer")
val displayBounds = WindowUtils.getDisplayBounds(testSpec.startRotation)
testSpec.assertLayers {
@@ -237,7 +238,7 @@ class TaskTransitionTest(val testSpec: FlickerTestParameter) {
LAUNCH_NEW_TASK_ACTIVITY_COMPONENT_NAME.toFlickerComponent()
private val SIMPLE_ACTIVITY = SIMPLE_ACTIVITY_AUTO_FOCUS_COMPONENT_NAME.toFlickerComponent()
private fun getWallpaperPackage(instrumentation: Instrumentation): FlickerComponentName? {
private fun getWallpaperPackage(instrumentation: Instrumentation): IComponentMatcher? {
val wallpaperManager = WallpaperManager.getInstance(instrumentation.targetContext)
return wallpaperManager.wallpaperInfo?.component?.toFlickerComponent()

View File

@@ -38,7 +38,7 @@ import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.ComponentMatcher
import com.android.server.wm.traces.common.Rect
import org.junit.Assume
import org.junit.Before
@@ -114,7 +114,7 @@ open class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestPa
@Test
fun startsWithApp2WindowsCoverFullScreen() {
testSpec.assertWmStart {
this.frameRegion(testApp2.component).coversExactly(startDisplayBounds)
this.visibleRegion(testApp2).coversExactly(startDisplayBounds)
}
}
@@ -126,7 +126,7 @@ open class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestPa
@Test
fun startsWithApp2LayersCoverFullScreen() {
testSpec.assertLayersStart {
this.visibleRegion(testApp2.component).coversExactly(startDisplayBounds)
this.visibleRegion(testApp2).coversExactly(startDisplayBounds)
}
}
@@ -137,7 +137,7 @@ open class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestPa
@Test
fun startsWithApp2WindowBeingOnTop() {
testSpec.assertWmStart {
this.isAppWindowOnTop(testApp2.component)
this.isAppWindowOnTop(testApp2)
}
}
@@ -149,7 +149,7 @@ open class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestPa
@Test
fun endsWithApp1WindowsCoveringFullScreen() {
testSpec.assertWmEnd {
this.frameRegion(testApp1.component).coversExactly(startDisplayBounds)
this.visibleRegion(testApp1).coversExactly(startDisplayBounds)
}
}
@@ -161,7 +161,7 @@ open class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestPa
@Test
fun endsWithApp1LayersCoveringFullScreen() {
testSpec.assertLayersEnd {
this.visibleRegion(testApp1.component).coversExactly(startDisplayBounds)
this.visibleRegion(testApp1).coversExactly(startDisplayBounds)
}
}
@@ -173,7 +173,7 @@ open class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestPa
@Test
fun endsWithApp1BeingOnTop() {
testSpec.assertWmEnd {
this.isAppWindowOnTop(testApp1.component)
this.isAppWindowOnTop(testApp1)
}
}
@@ -185,11 +185,11 @@ open class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestPa
@Test
fun app1WindowBecomesAndStaysVisible() {
testSpec.assertWm {
this.isAppWindowInvisible(testApp1.component)
this.isAppWindowInvisible(testApp1)
.then()
.isAppWindowVisible(FlickerComponentName.SNAPSHOT, isOptional = true)
.isAppWindowVisible(ComponentMatcher.SNAPSHOT, isOptional = true)
.then()
.isAppWindowVisible(testApp1.component)
.isAppWindowVisible(testApp1)
}
}
@@ -201,9 +201,9 @@ open class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestPa
@Test
fun app1LayerBecomesAndStaysVisible() {
testSpec.assertLayers {
this.isInvisible(testApp1.component)
this.isInvisible(testApp1)
.then()
.isVisible(testApp1.component)
.isVisible(testApp1)
}
}
@@ -215,9 +215,9 @@ open class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestPa
@Test
fun app2WindowBecomesAndStaysInvisible() {
testSpec.assertWm {
this.isAppWindowVisible(testApp2.component)
this.isAppWindowVisible(testApp2)
.then()
.isAppWindowInvisible(testApp2.component)
.isAppWindowInvisible(testApp2)
}
}
@@ -229,9 +229,9 @@ open class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestPa
@Test
fun app2LayerBecomesAndStaysInvisible() {
testSpec.assertLayers {
this.isVisible(testApp2.component)
this.isVisible(testApp2)
.then()
.isInvisible(testApp2.component)
.isInvisible(testApp2)
}
}
@@ -244,14 +244,14 @@ open class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestPa
@Test
fun app1WindowIsVisibleOnceApp2WindowIsInvisible() {
testSpec.assertWm {
this.isAppWindowVisible(testApp2.component)
this.isAppWindowVisible(testApp2)
.then()
// TODO: Do we actually want to test this? Seems too implementation specific...
.isAppWindowVisible(FlickerComponentName.LAUNCHER, isOptional = true)
.isAppWindowVisible(ComponentMatcher.LAUNCHER, isOptional = true)
.then()
.isAppWindowVisible(FlickerComponentName.SNAPSHOT, isOptional = true)
.isAppWindowVisible(ComponentMatcher.SNAPSHOT, isOptional = true)
.then()
.isAppWindowVisible(testApp1.component)
.isAppWindowVisible(testApp1)
}
}
@@ -264,13 +264,13 @@ open class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestPa
@Test
fun app1LayerIsVisibleOnceApp2LayerIsInvisible() {
testSpec.assertLayers {
this.isVisible(testApp2.component)
this.isVisible(testApp2)
.then()
.isVisible(FlickerComponentName.LAUNCHER, isOptional = true)
.isVisible(ComponentMatcher.LAUNCHER, isOptional = true)
.then()
.isVisible(FlickerComponentName.SNAPSHOT, isOptional = true)
.isVisible(ComponentMatcher.SNAPSHOT, isOptional = true)
.then()
.isVisible(testApp1.component)
.isVisible(testApp1)
}
}

View File

@@ -38,7 +38,7 @@ import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.ComponentMatcher
import com.android.server.wm.traces.common.Rect
import org.junit.Assume
import org.junit.Before
@@ -118,7 +118,7 @@ open class QuickSwitchBetweenTwoAppsForwardTest(private val testSpec: FlickerTes
@Test
open fun startsWithApp1WindowsCoverFullScreen() {
testSpec.assertWmStart {
this.frameRegion(testApp1.component, FlickerComponentName.LETTERBOX)
this.visibleRegion(testApp1.or(ComponentMatcher.LETTERBOX))
.coversExactly(startDisplayBounds)
}
}
@@ -131,7 +131,7 @@ open class QuickSwitchBetweenTwoAppsForwardTest(private val testSpec: FlickerTes
@Test
open fun startsWithApp1LayersCoverFullScreen() {
testSpec.assertLayersStart {
this.visibleRegion(testApp1.component).coversExactly(startDisplayBounds)
this.visibleRegion(testApp1).coversExactly(startDisplayBounds)
}
}
@@ -142,7 +142,7 @@ open class QuickSwitchBetweenTwoAppsForwardTest(private val testSpec: FlickerTes
@Test
open fun startsWithApp1WindowBeingOnTop() {
testSpec.assertWmStart {
this.isAppWindowOnTop(testApp1.component)
this.isAppWindowOnTop(testApp1)
}
}
@@ -154,7 +154,7 @@ open class QuickSwitchBetweenTwoAppsForwardTest(private val testSpec: FlickerTes
@Test
open fun endsWithApp2WindowsCoveringFullScreen() {
testSpec.assertWmEnd {
this.frameRegion(testApp2.component).coversExactly(startDisplayBounds)
this.visibleRegion(testApp2).coversExactly(startDisplayBounds)
}
}
@@ -166,7 +166,7 @@ open class QuickSwitchBetweenTwoAppsForwardTest(private val testSpec: FlickerTes
@Test
open fun endsWithApp2LayersCoveringFullScreen() {
testSpec.assertLayersEnd {
this.visibleRegion(testApp2.component, FlickerComponentName.LETTERBOX)
this.visibleRegion(testApp2.or(ComponentMatcher.LETTERBOX))
.coversExactly(startDisplayBounds)
}
}
@@ -179,7 +179,7 @@ open class QuickSwitchBetweenTwoAppsForwardTest(private val testSpec: FlickerTes
@Test
open fun endsWithApp2BeingOnTop() {
testSpec.assertWmEnd {
this.isAppWindowOnTop(testApp2.component)
this.isAppWindowOnTop(testApp2)
}
}
@@ -191,11 +191,11 @@ open class QuickSwitchBetweenTwoAppsForwardTest(private val testSpec: FlickerTes
@Test
open fun app2WindowBecomesAndStaysVisible() {
testSpec.assertWm {
this.isAppWindowInvisible(testApp2.component)
this.isAppWindowInvisible(testApp2)
.then()
.isAppWindowVisible(FlickerComponentName.SNAPSHOT, isOptional = true)
.isAppWindowVisible(ComponentMatcher.SNAPSHOT, isOptional = true)
.then()
.isAppWindowVisible(testApp2.component)
.isAppWindowVisible(testApp2)
}
}
@@ -207,9 +207,9 @@ open class QuickSwitchBetweenTwoAppsForwardTest(private val testSpec: FlickerTes
@Test
open fun app2LayerBecomesAndStaysVisible() {
testSpec.assertLayers {
this.isInvisible(testApp2.component)
this.isInvisible(testApp2)
.then()
.isVisible(testApp2.component)
.isVisible(testApp2)
}
}
@@ -221,9 +221,9 @@ open class QuickSwitchBetweenTwoAppsForwardTest(private val testSpec: FlickerTes
@Test
open fun app1WindowBecomesAndStaysInvisible() {
testSpec.assertWm {
this.isAppWindowVisible(testApp1.component)
this.isAppWindowVisible(testApp1)
.then()
.isAppWindowInvisible(testApp1.component)
.isAppWindowInvisible(testApp1)
}
}
@@ -235,9 +235,9 @@ open class QuickSwitchBetweenTwoAppsForwardTest(private val testSpec: FlickerTes
@Test
open fun app1LayerBecomesAndStaysInvisible() {
testSpec.assertLayers {
this.isVisible(testApp1.component)
this.isVisible(testApp1)
.then()
.isInvisible(testApp1.component)
.isInvisible(testApp1)
}
}
@@ -250,13 +250,13 @@ open class QuickSwitchBetweenTwoAppsForwardTest(private val testSpec: FlickerTes
@Test
open fun app2WindowIsVisibleOnceApp1WindowIsInvisible() {
testSpec.assertWm {
this.isAppWindowVisible(testApp1.component)
this.isAppWindowVisible(testApp1)
.then()
.isAppWindowVisible(FlickerComponentName.LAUNCHER, isOptional = true)
.isAppWindowVisible(ComponentMatcher.LAUNCHER, isOptional = true)
.then()
.isAppWindowVisible(FlickerComponentName.SNAPSHOT, isOptional = true)
.isAppWindowVisible(ComponentMatcher.SNAPSHOT, isOptional = true)
.then()
.isAppWindowVisible(testApp2.component)
.isAppWindowVisible(testApp2)
}
}
@@ -269,13 +269,13 @@ open class QuickSwitchBetweenTwoAppsForwardTest(private val testSpec: FlickerTes
@Test
open fun app2LayerIsVisibleOnceApp1LayerIsInvisible() {
testSpec.assertLayers {
this.isVisible(testApp1.component)
this.isVisible(testApp1)
.then()
.isVisible(FlickerComponentName.LAUNCHER, isOptional = true)
.isVisible(ComponentMatcher.LAUNCHER, isOptional = true)
.then()
.isVisible(FlickerComponentName.SNAPSHOT, isOptional = true)
.isVisible(ComponentMatcher.SNAPSHOT, isOptional = true)
.then()
.isVisible(testApp2.component)
.isVisible(testApp2)
}
}

View File

@@ -36,7 +36,7 @@ import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.ComponentMatcher
import com.android.server.wm.traces.common.Rect
import org.junit.FixMethodOrder
import org.junit.Test
@@ -79,7 +79,7 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
device.pressHome()
wmHelper.StateSyncBuilder()
.withHomeActivityVisible()
.withWindowSurfaceDisappeared(testApp.component)
.withWindowSurfaceDisappeared(testApp)
.waitForAndVerify()
startDisplayBounds = wmHelper.currentState.layerState
@@ -89,7 +89,7 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
transitions {
taplInstrumentation.workspace.quickSwitchToPreviousApp()
wmHelper.StateSyncBuilder()
.withFullScreenApp(testApp.component)
.withFullScreenApp(testApp)
.withNavBarStatusBarVisible()
.waitForAndVerify()
}
@@ -110,7 +110,7 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
@Test
fun endsWithAppWindowsCoveringFullScreen() {
testSpec.assertWmEnd {
this.frameRegion(testApp.component).coversExactly(startDisplayBounds)
this.visibleRegion(testApp).coversExactly(startDisplayBounds)
}
}
@@ -122,7 +122,7 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
@Test
fun endsWithAppLayersCoveringFullScreen() {
testSpec.assertLayersEnd {
this.visibleRegion(testApp.component).coversExactly(startDisplayBounds)
this.visibleRegion(testApp).coversExactly(startDisplayBounds)
}
}
@@ -134,7 +134,7 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
@Test
fun endsWithAppBeingOnTop() {
testSpec.assertWmEnd {
this.isAppWindowOnTop(testApp.component)
this.isAppWindowOnTop(testApp)
}
}
@@ -157,7 +157,7 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
@Test
fun startsWithLauncherWindowsCoverFullScreen() {
testSpec.assertWmStart {
this.frameRegion(FlickerComponentName.LAUNCHER).coversExactly(startDisplayBounds)
this.visibleRegion(ComponentMatcher.LAUNCHER).coversExactly(startDisplayBounds)
}
}
@@ -169,7 +169,7 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
@Test
fun startsWithLauncherLayersCoverFullScreen() {
testSpec.assertLayersStart {
this.visibleRegion(FlickerComponentName.LAUNCHER).coversExactly(startDisplayBounds)
this.visibleRegion(ComponentMatcher.LAUNCHER).coversExactly(startDisplayBounds)
}
}
@@ -180,7 +180,7 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
@Test
fun startsWithLauncherBeingOnTop() {
testSpec.assertWmStart {
this.isAppWindowOnTop(FlickerComponentName.LAUNCHER)
this.isAppWindowOnTop(ComponentMatcher.LAUNCHER)
}
}
@@ -204,9 +204,9 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
@Test
fun appWindowBecomesAndStaysVisible() {
testSpec.assertWm {
this.isAppWindowInvisible(testApp.component)
this.isAppWindowInvisible(testApp)
.then()
.isAppWindowVisible(testApp.component)
.isAppWindowVisible(testApp)
}
}
@@ -218,9 +218,9 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
@Test
fun appLayerBecomesAndStaysVisible() {
testSpec.assertLayers {
this.isInvisible(testApp.component)
this.isInvisible(testApp)
.then()
.isVisible(testApp.component)
.isVisible(testApp)
}
}
@@ -232,9 +232,9 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
@Test
fun launcherWindowBecomesAndStaysInvisible() {
testSpec.assertWm {
this.isAppWindowOnTop(FlickerComponentName.LAUNCHER)
this.isAppWindowOnTop(ComponentMatcher.LAUNCHER)
.then()
.isAppWindowNotOnTop(FlickerComponentName.LAUNCHER)
.isAppWindowNotOnTop(ComponentMatcher.LAUNCHER)
}
}
@@ -246,9 +246,9 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
@Test
fun launcherLayerBecomesAndStaysInvisible() {
testSpec.assertLayers {
this.isVisible(FlickerComponentName.LAUNCHER)
this.isVisible(ComponentMatcher.LAUNCHER)
.then()
.isInvisible(FlickerComponentName.LAUNCHER)
.isInvisible(ComponentMatcher.LAUNCHER)
}
}
@@ -260,11 +260,11 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
@Test
fun appWindowIsVisibleOnceLauncherWindowIsInvisible() {
testSpec.assertWm {
this.isAppWindowOnTop(FlickerComponentName.LAUNCHER)
this.isAppWindowOnTop(ComponentMatcher.LAUNCHER)
.then()
.isAppWindowVisible(FlickerComponentName.SNAPSHOT, isOptional = true)
.isAppWindowVisible(ComponentMatcher.SNAPSHOT, isOptional = true)
.then()
.isAppWindowVisible(testApp.component)
.isAppWindowVisible(testApp)
}
}
@@ -276,11 +276,11 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
@Test
fun appLayerIsVisibleOnceLauncherLayerIsInvisible() {
testSpec.assertLayers {
this.isVisible(FlickerComponentName.LAUNCHER)
this.isVisible(ComponentMatcher.LAUNCHER)
.then()
.isVisible(FlickerComponentName.SNAPSHOT, isOptional = true)
.isVisible(ComponentMatcher.SNAPSHOT, isOptional = true)
.then()
.isVisible(testApp.component)
.isVisible(testApp)
}
}

View File

@@ -16,8 +16,8 @@
package com.android.server.wm.flicker.rotation
import android.platform.test.annotations.Presubmit
import android.platform.test.annotations.FlakyTest
import android.platform.test.annotations.Presubmit
import androidx.test.filters.RequiresDevice
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
@@ -28,7 +28,7 @@ import com.android.server.wm.flicker.helpers.SimpleAppHelper
import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.ComponentMatcher
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
@@ -102,22 +102,22 @@ class ChangeAppRotationTest(
}
/**
* Checks that the [FlickerComponentName.ROTATION] layer appears during the transition,
* Checks that the [ComponentMatcher.ROTATION] layer appears during the transition,
* doesn't flicker, and disappears before the transition is complete
*/
fun rotationLayerAppearsAndVanishesAssertion() {
testSpec.assertLayers {
this.isVisible(testApp.component)
this.isVisible(testApp)
.then()
.isVisible(FlickerComponentName.ROTATION)
.isVisible(ComponentMatcher.ROTATION)
.then()
.isVisible(testApp.component)
.isInvisible(FlickerComponentName.ROTATION)
.isVisible(testApp)
.isInvisible(ComponentMatcher.ROTATION)
}
}
/**
* Checks that the [FlickerComponentName.ROTATION] layer appears during the transition,
* Checks that the [ComponentMatcher.ROTATION] layer appears during the transition,
* doesn't flicker, and disappears before the transition is complete
*/
@Presubmit

View File

@@ -28,7 +28,7 @@ import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.flicker.navBarLayerIsVisible
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.ComponentMatcher
import org.junit.Test
/**
@@ -101,9 +101,9 @@ abstract class RotationTransition(protected val testSpec: FlickerTestParameter)
open fun visibleLayersShownMoreThanOneConsecutiveEntry() {
testSpec.assertLayers {
this.visibleLayersShownMoreThanOneConsecutiveEntry(
ignoreLayers = listOf(FlickerComponentName.SPLASH_SCREEN,
FlickerComponentName.SNAPSHOT,
FlickerComponentName("", "SecondaryHomeHandle")
ignoreLayers = listOf(ComponentMatcher.SPLASH_SCREEN,
ComponentMatcher.SNAPSHOT,
ComponentMatcher("", "SecondaryHomeHandle")
)
)
}
@@ -136,7 +136,7 @@ abstract class RotationTransition(protected val testSpec: FlickerTestParameter)
open fun appLayerRotates_StartingPos() {
testSpec.assertLayersStart {
this.entry.displays.map { display ->
this.visibleRegion(testApp.component).coversExactly(display.layerStackSpace)
this.visibleRegion(testApp).coversExactly(display.layerStackSpace)
}
}
}
@@ -149,7 +149,7 @@ abstract class RotationTransition(protected val testSpec: FlickerTestParameter)
open fun appLayerRotates_EndingPos() {
testSpec.assertLayersEnd {
this.entry.displays.map { display ->
this.visibleRegion(testApp.component).coversExactly(display.layerStackSpace)
this.visibleRegion(testApp).coversExactly(display.layerStackSpace)
}
}
}

View File

@@ -16,10 +16,10 @@
package com.android.server.wm.flicker.rotation
import android.platform.test.annotations.FlakyTest
import android.platform.test.annotations.Presubmit
import android.platform.test.annotations.RequiresDevice
import android.view.WindowManager
import android.platform.test.annotations.FlakyTest
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
@@ -27,7 +27,7 @@ import com.android.server.wm.flicker.annotation.Group3
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.SeamlessRotationAppHelper
import com.android.server.wm.flicker.testapp.ActivityOptions
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.ComponentMatcher
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
@@ -136,7 +136,7 @@ open class SeamlessAppRotationTest(
@Test
fun appLayerAlwaysVisible() {
testSpec.assertLayers {
isVisible(testApp.component)
isVisible(testApp)
}
}
@@ -149,33 +149,34 @@ open class SeamlessAppRotationTest(
testSpec.assertLayers {
this.invoke("entireScreenCovered") { entry ->
entry.entry.displays.map { display ->
entry.visibleRegion(testApp.component).coversExactly(display.layerStackSpace)
entry.visibleRegion(testApp)
.coversExactly(display.layerStackSpace)
}
}
}
}
/**
* Checks that the [FlickerComponentName.STATUS_BAR] window is invisible during the whole
* Checks that the [ComponentMatcher.STATUS_BAR] window is invisible during the whole
* transition
*/
@Presubmit
@Test
fun statusBarWindowIsAlwaysInvisible() {
testSpec.assertWm {
this.isAboveAppWindowInvisible(FlickerComponentName.STATUS_BAR)
this.isAboveAppWindowInvisible(ComponentMatcher.STATUS_BAR)
}
}
/**
* Checks that the [FlickerComponentName.STATUS_BAR] layer is invisible during the whole
* Checks that the [ComponentMatcher.STATUS_BAR] layer is invisible during the whole
* transition
*/
@Presubmit
@Test
fun statusBarLayerIsAlwaysInvisible() {
testSpec.assertLayers {
this.isInvisible(FlickerComponentName.STATUS_BAR)
this.isInvisible(ComponentMatcher.STATUS_BAR)
}
}