Merge changes I08071058,I9a64a7ab into sc-dev

* changes:
  Update app pairs tests to new DSL format
  Create common assertions for new tests
This commit is contained in:
TreeHugger Robot
2021-02-09 08:41:44 +00:00
committed by Android (Google) Code Review
8 changed files with 585 additions and 162 deletions

View File

@@ -18,12 +18,116 @@ package com.android.wm.shell.flicker
import android.graphics.Region import android.graphics.Region
import android.view.Surface import android.view.Surface
import com.android.server.wm.flicker.dsl.LayersAssertionBuilder
import com.android.server.wm.flicker.dsl.LayersAssertionBuilderLegacy import com.android.server.wm.flicker.dsl.LayersAssertionBuilderLegacy
import com.android.server.wm.flicker.APP_PAIR_SPLIT_DIVIDER import com.android.server.wm.flicker.APP_PAIR_SPLIT_DIVIDER
import com.android.server.wm.flicker.DOCKED_STACK_DIVIDER import com.android.server.wm.flicker.DOCKED_STACK_DIVIDER
import com.android.server.wm.flicker.helpers.WindowUtils import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.server.wm.flicker.traces.layers.getVisibleBounds import com.android.server.wm.flicker.traces.layers.getVisibleBounds
@JvmOverloads
fun LayersAssertionBuilder.appPairsDividerIsVisible(bugId: Int = 0) {
end("appPairsDividerIsVisible", bugId) {
this.isVisible(APP_PAIR_SPLIT_DIVIDER)
}
}
@JvmOverloads
fun LayersAssertionBuilder.appPairsDividerIsInvisible(bugId: Int = 0) {
end("appPairsDividerIsInVisible", bugId) {
this.notExists(APP_PAIR_SPLIT_DIVIDER)
}
}
@JvmOverloads
fun LayersAssertionBuilder.appPairsDividerBecomesVisible(bugId: Int = 0) {
all("dividerLayerBecomesVisible", bugId) {
this.hidesLayer(DOCKED_STACK_DIVIDER)
.then()
.showsLayer(DOCKED_STACK_DIVIDER)
}
}
@JvmOverloads
fun LayersAssertionBuilder.dockedStackDividerIsVisible(bugId: Int = 0) {
end("dockedStackDividerIsVisible", bugId) {
this.isVisible(DOCKED_STACK_DIVIDER)
}
}
@JvmOverloads
fun LayersAssertionBuilder.dockedStackDividerBecomesVisible(bugId: Int = 0) {
all("dividerLayerBecomesVisible", bugId) {
this.hidesLayer(DOCKED_STACK_DIVIDER)
.then()
.showsLayer(DOCKED_STACK_DIVIDER)
}
}
@JvmOverloads
fun LayersAssertionBuilder.dockedStackDividerBecomesInvisible(bugId: Int = 0) {
all("dividerLayerBecomesInvisible", bugId) {
this.showsLayer(DOCKED_STACK_DIVIDER)
.then()
.hidesLayer(DOCKED_STACK_DIVIDER)
}
}
@JvmOverloads
fun LayersAssertionBuilder.dockedStackDividerIsInvisible(bugId: Int = 0) {
end("dockedStackDividerIsInvisible", bugId) {
this.notExists(DOCKED_STACK_DIVIDER)
}
}
@JvmOverloads
fun LayersAssertionBuilder.appPairsPrimaryBoundsIsVisible(
rotation: Int,
primaryLayerName: String,
bugId: Int = 0
) {
end("PrimaryAppBounds", bugId) {
val dividerRegion = entry.getVisibleBounds(APP_PAIR_SPLIT_DIVIDER)
this.hasVisibleRegion(primaryLayerName, getPrimaryRegion(dividerRegion, rotation))
}
}
@JvmOverloads
fun LayersAssertionBuilder.appPairsSecondaryBoundsIsVisible(
rotation: Int,
secondaryLayerName: String,
bugId: Int = 0
) {
end("SecondaryAppBounds", bugId) {
val dividerRegion = entry.getVisibleBounds(APP_PAIR_SPLIT_DIVIDER)
this.hasVisibleRegion(secondaryLayerName, getSecondaryRegion(dividerRegion, rotation))
}
}
@JvmOverloads
fun LayersAssertionBuilder.dockedStackPrimaryBoundsIsVisible(
rotation: Int,
primaryLayerName: String,
bugId: Int = 0
) {
end("PrimaryAppBounds", bugId) {
val dividerRegion = entry.getVisibleBounds(DOCKED_STACK_DIVIDER)
this.hasVisibleRegion(primaryLayerName, getPrimaryRegion(dividerRegion, rotation))
}
}
@JvmOverloads
fun LayersAssertionBuilder.dockedStackSecondaryBoundsIsVisible(
rotation: Int,
secondaryLayerName: String,
bugId: Int = 0
) {
end("SecondaryAppBounds", bugId) {
val dividerRegion = entry.getVisibleBounds(DOCKED_STACK_DIVIDER)
this.hasVisibleRegion(secondaryLayerName, getSecondaryRegion(dividerRegion, rotation))
}
}
@JvmOverloads @JvmOverloads
fun LayersAssertionBuilderLegacy.appPairsDividerIsVisible( fun LayersAssertionBuilderLegacy.appPairsDividerIsVisible(
bugId: Int = 0, bugId: Int = 0,
@@ -51,8 +155,8 @@ fun LayersAssertionBuilderLegacy.appPairsDividerBecomesVisible(
) { ) {
all("dividerLayerBecomesVisible", bugId, enabled) { all("dividerLayerBecomesVisible", bugId, enabled) {
this.hidesLayer(DOCKED_STACK_DIVIDER) this.hidesLayer(DOCKED_STACK_DIVIDER)
.then() .then()
.showsLayer(DOCKED_STACK_DIVIDER) .showsLayer(DOCKED_STACK_DIVIDER)
} }
} }
@@ -73,8 +177,8 @@ fun LayersAssertionBuilderLegacy.dockedStackDividerBecomesVisible(
) { ) {
all("dividerLayerBecomesVisible", bugId, enabled) { all("dividerLayerBecomesVisible", bugId, enabled) {
this.hidesLayer(DOCKED_STACK_DIVIDER) this.hidesLayer(DOCKED_STACK_DIVIDER)
.then() .then()
.showsLayer(DOCKED_STACK_DIVIDER) .showsLayer(DOCKED_STACK_DIVIDER)
} }
} }
@@ -85,8 +189,8 @@ fun LayersAssertionBuilderLegacy.dockedStackDividerBecomesInvisible(
) { ) {
all("dividerLayerBecomesInvisible", bugId, enabled) { all("dividerLayerBecomesInvisible", bugId, enabled) {
this.showsLayer(DOCKED_STACK_DIVIDER) this.showsLayer(DOCKED_STACK_DIVIDER)
.then() .then()
.hidesLayer(DOCKED_STACK_DIVIDER) .hidesLayer(DOCKED_STACK_DIVIDER)
} }
} }

View File

@@ -17,7 +17,6 @@
package com.android.wm.shell.flicker.apppairs package com.android.wm.shell.flicker.apppairs
import android.os.Bundle import android.os.Bundle
import android.platform.test.annotations.Presubmit
import android.os.SystemClock import android.os.SystemClock
import androidx.test.filters.RequiresDevice import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry import androidx.test.platform.app.InstrumentationRegistry
@@ -40,7 +39,6 @@ import org.junit.runners.Parameterized
* Test cold launch app from launcher. * Test cold launch app from launcher.
* To run this test: `atest WMShellFlickerTests:AppPairsTestCannotPairNonResizeableApps` * To run this test: `atest WMShellFlickerTests:AppPairsTestCannotPairNonResizeableApps`
*/ */
@Presubmit
@RequiresDevice @RequiresDevice
@RunWith(Parameterized::class) @RunWith(Parameterized::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING) @FixMethodOrder(MethodSorters.NAME_ASCENDING)
@@ -51,10 +49,9 @@ class AppPairsTestCannotPairNonResizeableApps(
@Parameterized.Parameters(name = "{0}") @Parameterized.Parameters(name = "{0}")
@JvmStatic @JvmStatic
fun getParams(): List<Array<Any>> { fun getParams(): List<Array<Any>> {
val testTag = "testAppPairs_cannotPairNonResizeableApps"
val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration -> val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration ->
withTestName { withTestName {
buildTestTag(testTag, configuration) buildTestTag(configuration)
} }
transitions { transitions {
nonResizeableApp?.launchViaIntent(wmHelper) nonResizeableApp?.launchViaIntent(wmHelper)
@@ -64,17 +61,20 @@ class AppPairsTestCannotPairNonResizeableApps(
SystemClock.sleep(AppPairsHelper.TIMEOUT_MS) SystemClock.sleep(AppPairsHelper.TIMEOUT_MS)
} }
assertions { assertions {
layersTrace { presubmit {
appPairsDividerIsInvisible() layersTrace {
} appPairsDividerIsInvisible()
windowManagerTrace { }
end("onlyResizeableAppWindowVisible") { windowManagerTrace {
val nonResizeableApp = nonResizeableApp val nonResizeableApp = nonResizeableApp
require(nonResizeableApp != null) { require(nonResizeableApp != null) {
"Non resizeable app not initialized" "Non resizeable app not initialized"
} }
isVisible(nonResizeableApp.defaultWindowName)
isInvisible(primaryApp.defaultWindowName) end("onlyResizeableAppWindowVisible") {
isVisible(nonResizeableApp.defaultWindowName)
isInvisible(primaryApp.defaultWindowName)
}
} }
} }
} }

View File

@@ -18,7 +18,6 @@ package com.android.wm.shell.flicker.apppairs
import android.os.Bundle import android.os.Bundle
import android.os.SystemClock import android.os.SystemClock
import android.platform.test.annotations.Presubmit
import androidx.test.filters.RequiresDevice import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.APP_PAIR_SPLIT_DIVIDER import com.android.server.wm.flicker.APP_PAIR_SPLIT_DIVIDER
@@ -38,7 +37,6 @@ import org.junit.runners.Parameterized
* Test cold launch app from launcher. * Test cold launch app from launcher.
* To run this test: `atest WMShellFlickerTests:AppPairsTestPairPrimaryAndSecondaryApps` * To run this test: `atest WMShellFlickerTests:AppPairsTestPairPrimaryAndSecondaryApps`
*/ */
@Presubmit
@RequiresDevice @RequiresDevice
@RunWith(Parameterized::class) @RunWith(Parameterized::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING) @FixMethodOrder(MethodSorters.NAME_ASCENDING)
@@ -49,10 +47,9 @@ class AppPairsTestPairPrimaryAndSecondaryApps(
@Parameterized.Parameters(name = "{0}") @Parameterized.Parameters(name = "{0}")
@JvmStatic @JvmStatic
fun getParams(): List<Array<Any>> { fun getParams(): List<Array<Any>> {
val testTag = "testAppPairs_pairPrimaryAndSecondaryApps"
val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration -> val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration ->
withTestName { withTestName {
buildTestTag(testTag, configuration) buildTestTag(configuration)
} }
transitions { transitions {
// TODO pair apps through normal UX flow // TODO pair apps through normal UX flow
@@ -61,20 +58,27 @@ class AppPairsTestPairPrimaryAndSecondaryApps(
SystemClock.sleep(AppPairsHelper.TIMEOUT_MS) SystemClock.sleep(AppPairsHelper.TIMEOUT_MS)
} }
assertions { assertions {
layersTrace { presubmit {
appPairsDividerIsVisible() layersTrace {
end("appsEndingBounds", enabled = false) { appPairsDividerIsVisible()
val dividerRegion = entry.getVisibleBounds(APP_PAIR_SPLIT_DIVIDER) }
this.hasVisibleRegion(primaryApp.defaultWindowName, windowManagerTrace {
appPairsHelper.getPrimaryBounds(dividerRegion)) end("bothAppWindowsVisible") {
.hasVisibleRegion(secondaryApp.defaultWindowName, isVisible(primaryApp.defaultWindowName)
appPairsHelper.getSecondaryBounds(dividerRegion)) isVisible(secondaryApp.defaultWindowName)
}
} }
} }
windowManagerTrace {
end("bothAppWindowsVisible") { flaky {
isVisible(primaryApp.defaultWindowName) layersTrace {
isVisible(secondaryApp.defaultWindowName) end("appsEndingBounds") {
val dividerRegion = entry.getVisibleBounds(APP_PAIR_SPLIT_DIVIDER)
this.hasVisibleRegion(primaryApp.defaultWindowName,
appPairsHelper.getPrimaryBounds(dividerRegion))
.hasVisibleRegion(secondaryApp.defaultWindowName,
appPairsHelper.getSecondaryBounds(dividerRegion))
}
} }
} }
} }

View File

@@ -18,7 +18,6 @@ package com.android.wm.shell.flicker.apppairs
import android.os.Bundle import android.os.Bundle
import android.os.SystemClock import android.os.SystemClock
import android.platform.test.annotations.Presubmit
import androidx.test.filters.RequiresDevice import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.APP_PAIR_SPLIT_DIVIDER import com.android.server.wm.flicker.APP_PAIR_SPLIT_DIVIDER
@@ -38,7 +37,6 @@ import org.junit.runners.Parameterized
* Test cold launch app from launcher. * Test cold launch app from launcher.
* To run this test: `atest WMShellFlickerTests:AppPairsTestUnpairPrimaryAndSecondaryApps` * To run this test: `atest WMShellFlickerTests:AppPairsTestUnpairPrimaryAndSecondaryApps`
*/ */
@Presubmit
@RequiresDevice @RequiresDevice
@RunWith(Parameterized::class) @RunWith(Parameterized::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING) @FixMethodOrder(MethodSorters.NAME_ASCENDING)
@@ -49,10 +47,9 @@ class AppPairsTestUnpairPrimaryAndSecondaryApps(
@Parameterized.Parameters(name = "{0}") @Parameterized.Parameters(name = "{0}")
@JvmStatic @JvmStatic
fun getParams(): List<Array<Any>> { fun getParams(): List<Array<Any>> {
val testTag = "testAppPairs_unpairPrimaryAndSecondaryApps"
val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration -> val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration ->
withTestName { withTestName {
buildTestTag(testTag, configuration) buildTestTag(configuration)
} }
setup { setup {
executeShellCommand( executeShellCommand(
@@ -66,24 +63,31 @@ class AppPairsTestUnpairPrimaryAndSecondaryApps(
SystemClock.sleep(AppPairsHelper.TIMEOUT_MS) SystemClock.sleep(AppPairsHelper.TIMEOUT_MS)
} }
assertions { assertions {
layersTrace { presubmit {
appPairsDividerIsInvisible() layersTrace {
start("appsStartingBounds", enabled = false) { appPairsDividerIsInvisible()
val dividerRegion = entry.getVisibleBounds(APP_PAIR_SPLIT_DIVIDER)
this.hasVisibleRegion(primaryApp.defaultWindowName,
appPairsHelper.getPrimaryBounds(dividerRegion))
.hasVisibleRegion(secondaryApp.defaultWindowName,
appPairsHelper.getSecondaryBounds(dividerRegion))
} }
end("appsEndingBounds", enabled = false) { windowManagerTrace {
this.notExists(primaryApp.defaultWindowName) end("bothAppWindowsInvisible") {
.notExists(secondaryApp.defaultWindowName) isInvisible(primaryApp.defaultWindowName)
isInvisible(secondaryApp.defaultWindowName)
}
} }
} }
windowManagerTrace {
end("bothAppWindowsInvisible") { flaky {
isInvisible(primaryApp.defaultWindowName) layersTrace {
isInvisible(secondaryApp.defaultWindowName) start("appsStartingBounds") {
val dividerRegion = entry.getVisibleBounds(APP_PAIR_SPLIT_DIVIDER)
this.hasVisibleRegion(primaryApp.defaultWindowName,
appPairsHelper.getPrimaryBounds(dividerRegion))
.hasVisibleRegion(secondaryApp.defaultWindowName,
appPairsHelper.getSecondaryBounds(dividerRegion))
}
end("appsEndingBounds") {
this.notExists(primaryApp.defaultWindowName)
.notExists(secondaryApp.defaultWindowName)
}
} }
} }
} }

View File

@@ -18,7 +18,6 @@ package com.android.wm.shell.flicker.apppairs
import android.os.Bundle import android.os.Bundle
import android.os.SystemClock import android.os.SystemClock
import android.platform.test.annotations.Presubmit
import android.view.Surface import android.view.Surface
import androidx.test.filters.RequiresDevice import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry import androidx.test.platform.app.InstrumentationRegistry
@@ -46,7 +45,6 @@ import org.junit.runners.Parameterized
* Test open apps to app pairs and rotate. * Test open apps to app pairs and rotate.
* To run this test: `atest WMShellFlickerTests:RotateTwoLaunchedAppsInAppPairsMode` * To run this test: `atest WMShellFlickerTests:RotateTwoLaunchedAppsInAppPairsMode`
*/ */
@Presubmit
@RequiresDevice @RequiresDevice
@RunWith(Parameterized::class) @RunWith(Parameterized::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING) @FixMethodOrder(MethodSorters.NAME_ASCENDING)
@@ -60,7 +58,7 @@ class RotateTwoLaunchedAppsInAppPairsMode(
fun getParams(): Collection<Array<Any>> { fun getParams(): Collection<Array<Any>> {
val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration -> val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration ->
withTestName { withTestName {
buildTestTag("testRotateTwoLaunchedAppsInAppPairsMode", configuration) buildTestTag(configuration)
} }
transitions { transitions {
executeShellCommand(composePairsCommand( executeShellCommand(composePairsCommand(
@@ -69,23 +67,28 @@ class RotateTwoLaunchedAppsInAppPairsMode(
setRotation(configuration.endRotation) setRotation(configuration.endRotation)
} }
assertions { assertions {
layersTrace { presubmit {
navBarLayerRotatesAndScales(Surface.ROTATION_0, configuration.endRotation, windowManagerTrace {
enabled = false) navBarWindowIsAlwaysVisible()
statusBarLayerRotatesScales(Surface.ROTATION_0, configuration.endRotation, statusBarWindowIsAlwaysVisible()
enabled = false) end("bothAppWindowsVisible") {
appPairsDividerIsVisible(enabled = false) isVisible(primaryApp.defaultWindowName)
appPairsPrimaryBoundsIsVisible(configuration.endRotation, .isVisible(secondaryApp.defaultWindowName)
primaryApp.defaultWindowName, bugId = 172776659) }
appPairsSecondaryBoundsIsVisible(configuration.endRotation, }
secondaryApp.defaultWindowName, bugId = 172776659)
} }
windowManagerTrace {
navBarWindowIsAlwaysVisible() flaky {
statusBarWindowIsAlwaysVisible() layersTrace {
end("bothAppWindowsVisible") { appPairsDividerIsVisible()
isVisible(primaryApp.defaultWindowName) navBarLayerRotatesAndScales(Surface.ROTATION_0,
.isVisible(secondaryApp.defaultWindowName) configuration.endRotation)
statusBarLayerRotatesScales(Surface.ROTATION_0,
configuration.endRotation)
appPairsPrimaryBoundsIsVisible(configuration.endRotation,
primaryApp.defaultWindowName, bugId = 172776659)
appPairsSecondaryBoundsIsVisible(configuration.endRotation,
secondaryApp.defaultWindowName, bugId = 172776659)
} }
} }
} }

View File

@@ -62,7 +62,7 @@ class RotateTwoLaunchedAppsRotateAndEnterAppPairsMode(
fun getParams(): Collection<Array<Any>> { fun getParams(): Collection<Array<Any>> {
val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration -> val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration ->
withTestName { withTestName {
buildTestTag("testRotateAndEnterAppPairsMode", configuration) buildTestTag(configuration)
} }
transitions { transitions {
this.setRotation(configuration.endRotation) this.setRotation(configuration.endRotation)
@@ -71,22 +71,37 @@ class RotateTwoLaunchedAppsRotateAndEnterAppPairsMode(
SystemClock.sleep(AppPairsHelper.TIMEOUT_MS) SystemClock.sleep(AppPairsHelper.TIMEOUT_MS)
} }
assertions { assertions {
layersTrace { val isRotated = configuration.startRotation.isRotated()
navBarLayerRotatesAndScales(Surface.ROTATION_0, configuration.endRotation, presubmit {
enabled = !configuration.startRotation.isRotated()) layersTrace {
statusBarLayerRotatesScales(Surface.ROTATION_0, configuration.endRotation) statusBarLayerRotatesScales(Surface.ROTATION_0,
appPairsDividerIsVisible() configuration.endRotation)
appPairsPrimaryBoundsIsVisible(configuration.endRotation, appPairsDividerIsVisible()
primaryApp.defaultWindowName, 172776659) if (!isRotated) {
appPairsSecondaryBoundsIsVisible(configuration.endRotation, navBarLayerRotatesAndScales(Surface.ROTATION_0,
secondaryApp.defaultWindowName, 172776659) configuration.endRotation)
}
}
windowManagerTrace {
navBarWindowIsAlwaysVisible()
statusBarWindowIsAlwaysVisible()
end("bothAppWindowsVisible") {
isVisible(primaryApp.defaultWindowName)
isVisible(secondaryApp.defaultWindowName)
}
}
} }
windowManagerTrace { flaky {
navBarWindowIsAlwaysVisible() layersTrace {
statusBarWindowIsAlwaysVisible() appPairsPrimaryBoundsIsVisible(configuration.endRotation,
end("bothAppWindowsVisible") { primaryApp.defaultWindowName, 172776659)
isVisible(primaryApp.defaultWindowName) appPairsSecondaryBoundsIsVisible(configuration.endRotation,
isVisible(secondaryApp.defaultWindowName) secondaryApp.defaultWindowName, 172776659)
if (isRotated) {
navBarLayerRotatesAndScales(Surface.ROTATION_0,
configuration.endRotation)
}
} }
} }
} }

View File

@@ -17,8 +17,11 @@
package com.android.server.wm.flicker package com.android.server.wm.flicker
import android.platform.helpers.IAppHelper import android.platform.helpers.IAppHelper
import com.android.server.wm.flicker.dsl.EventLogAssertionBuilder
import com.android.server.wm.flicker.dsl.EventLogAssertionBuilderLegacy import com.android.server.wm.flicker.dsl.EventLogAssertionBuilderLegacy
import com.android.server.wm.flicker.dsl.LayersAssertionBuilder
import com.android.server.wm.flicker.dsl.LayersAssertionBuilderLegacy import com.android.server.wm.flicker.dsl.LayersAssertionBuilderLegacy
import com.android.server.wm.flicker.dsl.WmAssertionBuilder
import com.android.server.wm.flicker.dsl.WmAssertionBuilderLegacy import com.android.server.wm.flicker.dsl.WmAssertionBuilderLegacy
import com.android.server.wm.flicker.helpers.WindowUtils import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper.Companion.NAV_BAR_LAYER_NAME import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper.Companion.NAV_BAR_LAYER_NAME
@@ -31,115 +34,88 @@ const val DOCKED_STACK_DIVIDER = "DockedStackDivider"
const val WALLPAPER_TITLE = "Wallpaper" const val WALLPAPER_TITLE = "Wallpaper"
@JvmOverloads @JvmOverloads
fun WmAssertionBuilderLegacy.statusBarWindowIsAlwaysVisible( fun WmAssertionBuilder.statusBarWindowIsAlwaysVisible(bugId: Int = 0) {
bugId: Int = 0, all("statusBarWindowIsAlwaysVisible", bugId) {
enabled: Boolean = bugId == 0 this.showsAboveAppWindow(NAV_BAR_LAYER_NAME)
) {
all("statusBarWindowIsAlwaysVisible", bugId, enabled) {
this.showsAboveAppWindow(STATUS_BAR_WINDOW_NAME)
} }
} }
@JvmOverloads @JvmOverloads
fun WmAssertionBuilderLegacy.navBarWindowIsAlwaysVisible( fun WmAssertionBuilder.navBarWindowIsAlwaysVisible(bugId: Int = 0) {
bugId: Int = 0, all("navBarWindowIsAlwaysVisible", bugId) {
enabled: Boolean = bugId == 0 this.showsAboveAppWindow(NAV_BAR_LAYER_NAME)
) {
all("navBarWindowIsAlwaysVisible", bugId, enabled) {
this.showsAboveAppWindow(NAV_BAR_WINDOW_NAME)
} }
} }
fun WmAssertionBuilderLegacy.visibleWindowsShownMoreThanOneConsecutiveEntry( fun WmAssertionBuilder.visibleWindowsShownMoreThanOneConsecutiveEntry(
ignoreWindows: List<String> = emptyList(), ignoreWindows: List<String> = emptyList(),
bugId: Int = 0, bugId: Int = 0
enabled: Boolean = bugId == 0
) { ) {
all("visibleWindowsShownMoreThanOneConsecutiveEntry", bugId, enabled) { all("visibleWindowsShownMoreThanOneConsecutiveEntry", bugId) {
this.visibleWindowsShownMoreThanOneConsecutiveEntry(ignoreWindows) this.visibleWindowsShownMoreThanOneConsecutiveEntry(ignoreWindows)
} }
} }
fun WmAssertionBuilderLegacy.launcherReplacesAppWindowAsTopWindow( fun WmAssertionBuilder.launcherReplacesAppWindowAsTopWindow(testApp: IAppHelper, bugId: Int = 0) {
testApp: IAppHelper, all("launcherReplacesAppWindowAsTopWindow", bugId) {
bugId: Int = 0,
enabled: Boolean = bugId == 0
) {
all("launcherReplacesAppWindowAsTopWindow", bugId, enabled) {
this.showsAppWindowOnTop(testApp.getPackage()) this.showsAppWindowOnTop(testApp.getPackage())
.then() .then()
.showsAppWindowOnTop("Launcher") .showsAppWindowOnTop("Launcher")
} }
} }
fun WmAssertionBuilderLegacy.wallpaperWindowBecomesVisible( fun WmAssertionBuilder.wallpaperWindowBecomesVisible(bugId: Int = 0) {
bugId: Int = 0, all("wallpaperWindowBecomesVisible", bugId) {
enabled: Boolean = bugId == 0
) {
all("wallpaperWindowBecomesVisible", bugId, enabled) {
this.hidesBelowAppWindow(WALLPAPER_TITLE) this.hidesBelowAppWindow(WALLPAPER_TITLE)
.then() .then()
.showsBelowAppWindow(WALLPAPER_TITLE) .showsBelowAppWindow(WALLPAPER_TITLE)
} }
} }
fun WmAssertionBuilderLegacy.wallpaperWindowBecomesInvisible( fun WmAssertionBuilder.wallpaperWindowBecomesInvisible(bugId: Int = 0) {
bugId: Int = 0, all("wallpaperWindowBecomesInvisible", bugId) {
enabled: Boolean = bugId == 0
) {
all("wallpaperWindowBecomesInvisible", bugId, enabled) {
this.showsBelowAppWindow("Wallpaper") this.showsBelowAppWindow("Wallpaper")
.then() .then()
.hidesBelowAppWindow("Wallpaper") .hidesBelowAppWindow("Wallpaper")
} }
} }
fun WmAssertionBuilderLegacy.appWindowAlwaysVisibleOnTop( fun WmAssertionBuilder.appWindowAlwaysVisibleOnTop(
packageName: String, packageName: String,
bugId: Int = 0, bugId: Int = 0
enabled: Boolean = bugId == 0
) { ) {
all("appWindowAlwaysVisibleOnTop", bugId, enabled) { all("appWindowAlwaysVisibleOnTop", bugId) {
this.showsAppWindowOnTop(packageName) this.showsAppWindowOnTop(packageName)
} }
} }
fun WmAssertionBuilderLegacy.appWindowBecomesVisible( fun WmAssertionBuilder.appWindowBecomesVisible(appName: String, bugId: Int = 0) {
appName: String, all("appWindowBecomesVisible", bugId) {
bugId: Int = 0,
enabled: Boolean = bugId == 0
) {
all("appWindowBecomesVisible", bugId, enabled) {
this.hidesAppWindow(appName) this.hidesAppWindow(appName)
.then() .then()
.showsAppWindow(appName) .showsAppWindow(appName)
} }
} }
fun WmAssertionBuilderLegacy.appWindowBecomesInVisible( fun WmAssertionBuilder.appWindowBecomesInVisible(appName: String, bugId: Int = 0) {
appName: String, all("appWindowBecomesInVisible", bugId) {
bugId: Int = 0,
enabled: Boolean = bugId == 0
) {
all("appWindowBecomesInVisible", bugId, enabled) {
this.showsAppWindow(appName) this.showsAppWindow(appName)
.then() .then()
.hidesAppWindow(appName) .hidesAppWindow(appName)
} }
} }
@JvmOverloads @JvmOverloads
fun LayersAssertionBuilderLegacy.noUncoveredRegions( fun LayersAssertionBuilder.noUncoveredRegions(
beginRotation: Int, beginRotation: Int,
endRotation: Int = beginRotation, endRotation: Int = beginRotation,
allStates: Boolean = true, allStates: Boolean = true,
bugId: Int = 0, bugId: Int = 0
enabled: Boolean = bugId == 0
) { ) {
val startingBounds = WindowUtils.getDisplayBounds(beginRotation) val startingBounds = WindowUtils.getDisplayBounds(beginRotation)
val endingBounds = WindowUtils.getDisplayBounds(endRotation) val endingBounds = WindowUtils.getDisplayBounds(endRotation)
if (allStates) { if (allStates) {
all("noUncoveredRegions", bugId, enabled) { all("noUncoveredRegions", bugId) {
if (startingBounds == endingBounds) { if (startingBounds == endingBounds) {
this.coversAtLeastRegion(startingBounds) this.coversAtLeastRegion(startingBounds)
} else { } else {
@@ -158,6 +134,284 @@ fun LayersAssertionBuilderLegacy.noUncoveredRegions(
} }
} }
@JvmOverloads
fun LayersAssertionBuilder.navBarLayerIsAlwaysVisible(
rotatesScreen: Boolean = false,
bugId: Int = 0
) {
if (rotatesScreen) {
all("navBarLayerIsAlwaysVisible", bugId) {
this.showsLayer(NAV_BAR_LAYER_NAME)
.then()
.hidesLayer(NAV_BAR_LAYER_NAME)
.then()
.showsLayer(NAV_BAR_LAYER_NAME)
}
} else {
all("navBarLayerIsAlwaysVisible", bugId) {
this.showsLayer(NAV_BAR_LAYER_NAME)
}
}
}
@JvmOverloads
fun LayersAssertionBuilder.statusBarLayerIsAlwaysVisible(
rotatesScreen: Boolean = false,
bugId: Int = 0
) {
if (rotatesScreen) {
all("statusBarLayerIsAlwaysVisible", bugId) {
this.showsLayer(STATUS_BAR_WINDOW_NAME)
.then()
hidesLayer(STATUS_BAR_WINDOW_NAME)
.then()
.showsLayer(STATUS_BAR_WINDOW_NAME)
}
} else {
all("statusBarLayerIsAlwaysVisible", bugId) {
this.showsLayer(STATUS_BAR_WINDOW_NAME)
}
}
}
@JvmOverloads
fun LayersAssertionBuilder.navBarLayerRotatesAndScales(
beginRotation: Int,
endRotation: Int = beginRotation,
bugId: Int = 0
) {
val startingPos = WindowUtils.getNavigationBarPosition(beginRotation)
val endingPos = WindowUtils.getNavigationBarPosition(endRotation)
start("navBarLayerRotatesAndScales_StartingPos", bugId) {
this.hasVisibleRegion(NAV_BAR_LAYER_NAME, startingPos)
}
end("navBarLayerRotatesAndScales_EndingPost", bugId) {
this.hasVisibleRegion(NAV_BAR_LAYER_NAME, endingPos)
}
/*if (startingPos == endingPos) {
all("navBarLayerRotatesAndScales", enabled = false, bugId = 167747321) {
this.hasVisibleRegion(NAVIGATION_BAR_WINDOW_TITLE, startingPos)
}
}*/
}
@JvmOverloads
fun LayersAssertionBuilder.statusBarLayerRotatesScales(
beginRotation: Int,
endRotation: Int = beginRotation,
bugId: Int = 0
) {
val startingPos = WindowUtils.getStatusBarPosition(beginRotation)
val endingPos = WindowUtils.getStatusBarPosition(endRotation)
start("statusBarLayerRotatesScales_StartingPos", bugId) {
this.hasVisibleRegion(STATUS_BAR_WINDOW_NAME, startingPos)
}
end("statusBarLayerRotatesScales_EndingPos", bugId) {
this.hasVisibleRegion(STATUS_BAR_WINDOW_NAME, endingPos)
}
}
fun LayersAssertionBuilder.visibleLayersShownMoreThanOneConsecutiveEntry(
ignoreLayers: List<String> = emptyList(),
bugId: Int = 0
) {
all("visibleLayersShownMoreThanOneConsecutiveEntry", bugId) {
this.visibleLayersShownMoreThanOneConsecutiveEntry(ignoreLayers)
}
}
fun LayersAssertionBuilder.appLayerReplacesWallpaperLayer(appName: String, bugId: Int = 0) {
all("appLayerReplacesWallpaperLayer", bugId) {
this.showsLayer("Wallpaper")
.then()
.replaceVisibleLayer("Wallpaper", appName)
}
}
fun LayersAssertionBuilder.wallpaperLayerReplacesAppLayer(testApp: IAppHelper, bugId: Int = 0) {
all("appLayerReplacesWallpaperLayer", bugId) {
this.showsLayer(testApp.getPackage())
.then()
.replaceVisibleLayer(testApp.getPackage(), WALLPAPER_TITLE)
}
}
fun LayersAssertionBuilder.layerAlwaysVisible(packageName: String, bugId: Int = 0) {
all("layerAlwaysVisible", bugId) {
this.showsLayer(packageName)
}
}
fun LayersAssertionBuilder.layerBecomesVisible(packageName: String, bugId: Int = 0) {
all("layerBecomesVisible", bugId) {
this.hidesLayer(packageName)
.then()
.showsLayer(packageName)
}
}
fun LayersAssertionBuilder.layerBecomesInvisible(packageName: String, bugId: Int = 0) {
all("layerBecomesInvisible", bugId) {
this.showsLayer(packageName)
.then()
.hidesLayer(packageName)
}
}
fun EventLogAssertionBuilder.focusChanges(vararg windows: String, bugId: Int = 0) {
all("focusChanges", bugId) {
this.focusChanges(windows)
}
}
fun EventLogAssertionBuilder.focusDoesNotChange(bugId: Int = 0) {
all("focusDoesNotChange", bugId) {
this.focusDoesNotChange()
}
}
@JvmOverloads
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
fun WmAssertionBuilderLegacy.statusBarWindowIsAlwaysVisible(
bugId: Int = 0,
enabled: Boolean = bugId == 0
) {
all("statusBarWindowIsAlwaysVisible", bugId, enabled) {
this.showsAboveAppWindow(STATUS_BAR_WINDOW_NAME)
}
}
@JvmOverloads
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
fun WmAssertionBuilderLegacy.navBarWindowIsAlwaysVisible(
bugId: Int = 0,
enabled: Boolean = bugId == 0
) {
all("navBarWindowIsAlwaysVisible", bugId, enabled) {
this.showsAboveAppWindow(NAV_BAR_WINDOW_NAME)
}
}
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
fun WmAssertionBuilderLegacy.visibleWindowsShownMoreThanOneConsecutiveEntry(
ignoreWindows: List<String> = emptyList(),
bugId: Int = 0,
enabled: Boolean = bugId == 0
) {
all("visibleWindowsShownMoreThanOneConsecutiveEntry", bugId, enabled) {
this.visibleWindowsShownMoreThanOneConsecutiveEntry(ignoreWindows)
}
}
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
fun WmAssertionBuilderLegacy.launcherReplacesAppWindowAsTopWindow(
testApp: IAppHelper,
bugId: Int = 0,
enabled: Boolean = bugId == 0
) {
all("launcherReplacesAppWindowAsTopWindow", bugId, enabled) {
this.showsAppWindowOnTop(testApp.getPackage())
.then()
.showsAppWindowOnTop("Launcher")
}
}
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
fun WmAssertionBuilderLegacy.wallpaperWindowBecomesVisible(
bugId: Int = 0,
enabled: Boolean = bugId == 0
) {
all("wallpaperWindowBecomesVisible", bugId, enabled) {
this.hidesBelowAppWindow(WALLPAPER_TITLE)
.then()
.showsBelowAppWindow(WALLPAPER_TITLE)
}
}
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
fun WmAssertionBuilderLegacy.wallpaperWindowBecomesInvisible(
bugId: Int = 0,
enabled: Boolean = bugId == 0
) {
all("wallpaperWindowBecomesInvisible", bugId, enabled) {
this.showsBelowAppWindow("Wallpaper")
.then()
.hidesBelowAppWindow("Wallpaper")
}
}
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
fun WmAssertionBuilderLegacy.appWindowAlwaysVisibleOnTop(
packageName: String,
bugId: Int = 0,
enabled: Boolean = bugId == 0
) {
all("appWindowAlwaysVisibleOnTop", bugId, enabled) {
this.showsAppWindowOnTop(packageName)
}
}
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
fun WmAssertionBuilderLegacy.appWindowBecomesVisible(
appName: String,
bugId: Int = 0,
enabled: Boolean = bugId == 0
) {
all("appWindowBecomesVisible", bugId, enabled) {
this.hidesAppWindow(appName)
.then()
.showsAppWindow(appName)
}
}
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
fun WmAssertionBuilderLegacy.appWindowBecomesInVisible(
appName: String,
bugId: Int = 0,
enabled: Boolean = bugId == 0
) {
all("appWindowBecomesInVisible", bugId, enabled) {
this.showsAppWindow(appName)
.then()
.hidesAppWindow(appName)
}
}
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
@JvmOverloads
fun LayersAssertionBuilderLegacy.noUncoveredRegions(
beginRotation: Int,
endRotation: Int = beginRotation,
allStates: Boolean = true,
bugId: Int = 0,
enabled: Boolean = bugId == 0
) {
val startingBounds = WindowUtils.getDisplayBounds(beginRotation)
val endingBounds = WindowUtils.getDisplayBounds(endRotation)
if (allStates) {
all("noUncoveredRegions", bugId, enabled) {
if (startingBounds == endingBounds) {
this.coversAtLeastRegion(startingBounds)
} else {
this.coversAtLeastRegion(startingBounds)
.then()
.coversAtLeastRegion(endingBounds)
}
}
} else {
start("noUncoveredRegions_StartingPos") {
this.coversAtLeastRegion(startingBounds)
}
end("noUncoveredRegions_EndingPos") {
this.coversAtLeastRegion(endingBounds)
}
}
}
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
@JvmOverloads @JvmOverloads
fun LayersAssertionBuilderLegacy.navBarLayerIsAlwaysVisible( fun LayersAssertionBuilderLegacy.navBarLayerIsAlwaysVisible(
rotatesScreen: Boolean = false, rotatesScreen: Boolean = false,
@@ -167,10 +421,10 @@ fun LayersAssertionBuilderLegacy.navBarLayerIsAlwaysVisible(
if (rotatesScreen) { if (rotatesScreen) {
all("navBarLayerIsAlwaysVisible", bugId, enabled) { all("navBarLayerIsAlwaysVisible", bugId, enabled) {
this.showsLayer(NAV_BAR_LAYER_NAME) this.showsLayer(NAV_BAR_LAYER_NAME)
.then() .then()
.hidesLayer(NAV_BAR_LAYER_NAME) .hidesLayer(NAV_BAR_LAYER_NAME)
.then() .then()
.showsLayer(NAV_BAR_LAYER_NAME) .showsLayer(NAV_BAR_LAYER_NAME)
} }
} else { } else {
all("navBarLayerIsAlwaysVisible", bugId, enabled) { all("navBarLayerIsAlwaysVisible", bugId, enabled) {
@@ -179,6 +433,7 @@ fun LayersAssertionBuilderLegacy.navBarLayerIsAlwaysVisible(
} }
} }
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
@JvmOverloads @JvmOverloads
fun LayersAssertionBuilderLegacy.statusBarLayerIsAlwaysVisible( fun LayersAssertionBuilderLegacy.statusBarLayerIsAlwaysVisible(
rotatesScreen: Boolean = false, rotatesScreen: Boolean = false,
@@ -188,10 +443,10 @@ fun LayersAssertionBuilderLegacy.statusBarLayerIsAlwaysVisible(
if (rotatesScreen) { if (rotatesScreen) {
all("statusBarLayerIsAlwaysVisible", bugId, enabled) { all("statusBarLayerIsAlwaysVisible", bugId, enabled) {
this.showsLayer(STATUS_BAR_LAYER_NAME) this.showsLayer(STATUS_BAR_LAYER_NAME)
.then() .then()
hidesLayer(STATUS_BAR_LAYER_NAME) .hidesLayer(STATUS_BAR_LAYER_NAME)
.then() .then()
.showsLayer(STATUS_BAR_LAYER_NAME) .showsLayer(STATUS_BAR_LAYER_NAME)
} }
} else { } else {
all("statusBarLayerIsAlwaysVisible", bugId, enabled) { all("statusBarLayerIsAlwaysVisible", bugId, enabled) {
@@ -200,6 +455,7 @@ fun LayersAssertionBuilderLegacy.statusBarLayerIsAlwaysVisible(
} }
} }
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
@JvmOverloads @JvmOverloads
fun LayersAssertionBuilderLegacy.navBarLayerRotatesAndScales( fun LayersAssertionBuilderLegacy.navBarLayerRotatesAndScales(
beginRotation: Int, beginRotation: Int,
@@ -224,6 +480,7 @@ fun LayersAssertionBuilderLegacy.navBarLayerRotatesAndScales(
} }
} }
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
@JvmOverloads @JvmOverloads
fun LayersAssertionBuilderLegacy.statusBarLayerRotatesScales( fun LayersAssertionBuilderLegacy.statusBarLayerRotatesScales(
beginRotation: Int, beginRotation: Int,
@@ -242,8 +499,9 @@ fun LayersAssertionBuilderLegacy.statusBarLayerRotatesScales(
} }
} }
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
fun LayersAssertionBuilderLegacy.visibleLayersShownMoreThanOneConsecutiveEntry( fun LayersAssertionBuilderLegacy.visibleLayersShownMoreThanOneConsecutiveEntry(
ignoreLayers: List<String> = emptyList(), ignoreLayers: List<String> = kotlin.collections.emptyList(),
bugId: Int = 0, bugId: Int = 0,
enabled: Boolean = bugId == 0 enabled: Boolean = bugId == 0
) { ) {
@@ -252,6 +510,7 @@ fun LayersAssertionBuilderLegacy.visibleLayersShownMoreThanOneConsecutiveEntry(
} }
} }
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
fun LayersAssertionBuilderLegacy.appLayerReplacesWallpaperLayer( fun LayersAssertionBuilderLegacy.appLayerReplacesWallpaperLayer(
appName: String, appName: String,
bugId: Int = 0, bugId: Int = 0,
@@ -259,11 +518,12 @@ fun LayersAssertionBuilderLegacy.appLayerReplacesWallpaperLayer(
) { ) {
all("appLayerReplacesWallpaperLayer", bugId, enabled) { all("appLayerReplacesWallpaperLayer", bugId, enabled) {
this.showsLayer("Wallpaper") this.showsLayer("Wallpaper")
.then() .then()
.replaceVisibleLayer("Wallpaper", appName) .replaceVisibleLayer("Wallpaper", appName)
} }
} }
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
fun LayersAssertionBuilderLegacy.wallpaperLayerReplacesAppLayer( fun LayersAssertionBuilderLegacy.wallpaperLayerReplacesAppLayer(
testApp: IAppHelper, testApp: IAppHelper,
bugId: Int = 0, bugId: Int = 0,
@@ -271,11 +531,12 @@ fun LayersAssertionBuilderLegacy.wallpaperLayerReplacesAppLayer(
) { ) {
all("appLayerReplacesWallpaperLayer", bugId, enabled) { all("appLayerReplacesWallpaperLayer", bugId, enabled) {
this.showsLayer(testApp.getPackage()) this.showsLayer(testApp.getPackage())
.then() .then()
.replaceVisibleLayer(testApp.getPackage(), WALLPAPER_TITLE) .replaceVisibleLayer(testApp.getPackage(), WALLPAPER_TITLE)
} }
} }
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
fun LayersAssertionBuilderLegacy.layerAlwaysVisible( fun LayersAssertionBuilderLegacy.layerAlwaysVisible(
packageName: String, packageName: String,
bugId: Int = 0, bugId: Int = 0,
@@ -286,6 +547,7 @@ fun LayersAssertionBuilderLegacy.layerAlwaysVisible(
} }
} }
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
fun LayersAssertionBuilderLegacy.layerBecomesVisible( fun LayersAssertionBuilderLegacy.layerBecomesVisible(
packageName: String, packageName: String,
bugId: Int = 0, bugId: Int = 0,
@@ -293,11 +555,12 @@ fun LayersAssertionBuilderLegacy.layerBecomesVisible(
) { ) {
all("layerBecomesVisible", bugId, enabled) { all("layerBecomesVisible", bugId, enabled) {
this.hidesLayer(packageName) this.hidesLayer(packageName)
.then() .then()
.showsLayer(packageName) .showsLayer(packageName)
} }
} }
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
fun LayersAssertionBuilderLegacy.layerBecomesInvisible( fun LayersAssertionBuilderLegacy.layerBecomesInvisible(
packageName: String, packageName: String,
bugId: Int = 0, bugId: Int = 0,
@@ -305,11 +568,12 @@ fun LayersAssertionBuilderLegacy.layerBecomesInvisible(
) { ) {
all("layerBecomesInvisible", bugId, enabled) { all("layerBecomesInvisible", bugId, enabled) {
this.showsLayer(packageName) this.showsLayer(packageName)
.then() .then()
.hidesLayer(packageName) .hidesLayer(packageName)
} }
} }
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
fun EventLogAssertionBuilderLegacy.focusChanges( fun EventLogAssertionBuilderLegacy.focusChanges(
vararg windows: String, vararg windows: String,
bugId: Int = 0, bugId: Int = 0,
@@ -320,6 +584,7 @@ fun EventLogAssertionBuilderLegacy.focusChanges(
} }
} }
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
fun EventLogAssertionBuilderLegacy.focusDoesNotChange( fun EventLogAssertionBuilderLegacy.focusDoesNotChange(
bugId: Int = 0, bugId: Int = 0,
enabled: Boolean = bugId == 0 enabled: Boolean = bugId == 0

View File

@@ -43,7 +43,7 @@ fun Flicker.setRotation(rotation: Int) {
wmHelper.waitForAppTransitionIdle() wmHelper.waitForAppTransitionIdle()
// Ensure WindowManagerService wait until all animations have completed // Ensure WindowManagerService wait until all animations have completed
instrumentation.getUiAutomation().syncInputTransactions() instrumentation.uiAutomation.syncInputTransactions()
} catch (e: RemoteException) { } catch (e: RemoteException) {
throw RuntimeException(e) throw RuntimeException(e)
} }
@@ -71,8 +71,8 @@ fun buildTestTag(
/** /**
* Build a test tag for the test * Build a test tag for the test
* @param testName Name of the transition(s) being tested * @param testName Name of the transition(s) being tested
* @param app App being launcher
* @param configuration Configuration for the test * @param configuration Configuration for the test
* @param extraInfo Additional information to append to the tag
* *
* @return test tag with pattern <NAME>__<APP>__<BEGIN_ROTATION>-<END_ROTATION> * @return test tag with pattern <NAME>__<APP>__<BEGIN_ROTATION>-<END_ROTATION>
</END_ROTATION></BEGIN_ROTATION></APP></NAME> */ </END_ROTATION></BEGIN_ROTATION></APP></NAME> */
@@ -90,11 +90,32 @@ fun buildTestTag(
extraInfo = extraInfo) extraInfo = extraInfo)
} }
/**
* Build a test tag for the test
* @param configuration Configuration for the test
* @param extraInfo Additional information to append to the tag
*
* @return test tag with pattern <NAME>__<APP>__<BEGIN_ROTATION>-<END_ROTATION>
</END_ROTATION></BEGIN_ROTATION></APP></NAME> */
@JvmOverloads
fun buildTestTag(
configuration: Bundle,
extraInfo: String = ""
): String {
return buildTestTag(testName = null,
app = null,
beginRotation = configuration.startRotation,
endRotation = configuration.endRotation,
app2 = null,
extraInfo = extraInfo)
}
/** /**
* Build a test tag for the test * Build a test tag for the test
* @param testName Name of the transition(s) being tested * @param testName Name of the transition(s) being tested
* @param app App being launcher * @param app App being launcher
* @param configuration Configuration for the test * @param configuration Configuration for the test
* @param extraInfo Additional information to append to the tag
* *
* @return test tag with pattern <NAME>__<APP>__<BEGIN_ROTATION>-<END_ROTATION> * @return test tag with pattern <NAME>__<APP>__<BEGIN_ROTATION>-<END_ROTATION>
</END_ROTATION></BEGIN_ROTATION></APP></NAME> */ </END_ROTATION></BEGIN_ROTATION></APP></NAME> */
@@ -121,14 +142,17 @@ fun buildTestTag(
* @return test tag with pattern <NAME>__<APP></APP>(S)>__<ROTATION></ROTATION>(S)>[__<EXTRA>] * @return test tag with pattern <NAME>__<APP></APP>(S)>__<ROTATION></ROTATION>(S)>[__<EXTRA>]
</EXTRA></NAME> */ </EXTRA></NAME> */
fun buildTestTag( fun buildTestTag(
testName: String, testName: String?,
app: String?, app: String?,
beginRotation: Int, beginRotation: Int,
endRotation: Int, endRotation: Int,
app2: String?, app2: String?,
extraInfo: String extraInfo: String
): String { ): String {
var testTag = testName var testTag = ""
if (testName != null) {
testTag += testName
}
if (app != null) { if (app != null) {
testTag += "__$app" testTag += "__$app"
} }
@@ -142,5 +166,9 @@ fun buildTestTag(
if (extraInfo.isNotEmpty()) { if (extraInfo.isNotEmpty()) {
testTag += "__$extraInfo" testTag += "__$extraInfo"
} }
if (testTag.startsWith("__")) {
testTag = testTag.drop(2)
}
return testTag return testTag
} }