Merge "Update app launch tests to new DSL format" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
a9048d72de
@@ -17,14 +17,10 @@
|
|||||||
package com.android.server.wm.flicker.launch
|
package com.android.server.wm.flicker.launch
|
||||||
|
|
||||||
import android.platform.helpers.IAppHelper
|
import android.platform.helpers.IAppHelper
|
||||||
import com.android.server.wm.flicker.dsl.WmAssertionBuilderLegacy
|
import com.android.server.wm.flicker.dsl.WmAssertionBuilder
|
||||||
|
|
||||||
fun WmAssertionBuilderLegacy.appWindowReplacesLauncherAsTopWindow(
|
fun WmAssertionBuilder.appWindowReplacesLauncherAsTopWindow(testApp: IAppHelper, bugId: Int = 0) {
|
||||||
testApp: IAppHelper,
|
all("appWindowReplacesLauncherAsTopWindow", bugId) {
|
||||||
bugId: Int = 0,
|
|
||||||
enabled: Boolean = bugId == 0
|
|
||||||
) {
|
|
||||||
all("appWindowReplacesLauncherAsTopWindow", bugId, enabled) {
|
|
||||||
this.showsAppWindowOnTop("Launcher")
|
this.showsAppWindowOnTop("Launcher")
|
||||||
.then()
|
.then()
|
||||||
.showsAppWindowOnTop("Snapshot", testApp.getPackage())
|
.showsAppWindowOnTop("Snapshot", testApp.getPackage())
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package com.android.server.wm.flicker.launch
|
package com.android.server.wm.flicker.launch
|
||||||
|
|
||||||
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
|
||||||
@@ -51,7 +50,6 @@ import org.junit.runners.Parameterized
|
|||||||
* Test cold launch app from launcher.
|
* Test cold launch app from launcher.
|
||||||
* To run this test: `atest FlickerTests:OpenAppColdTest`
|
* To run this test: `atest FlickerTests:OpenAppColdTest`
|
||||||
*/
|
*/
|
||||||
@Presubmit
|
|
||||||
@RequiresDevice
|
@RequiresDevice
|
||||||
@RunWith(Parameterized::class)
|
@RunWith(Parameterized::class)
|
||||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||||
@@ -66,7 +64,7 @@ class OpenAppColdTest(
|
|||||||
val testApp = SimpleAppHelper(instrumentation)
|
val testApp = SimpleAppHelper(instrumentation)
|
||||||
return FlickerTestRunnerFactory.getInstance()
|
return FlickerTestRunnerFactory.getInstance()
|
||||||
.buildTest(instrumentation) { configuration ->
|
.buildTest(instrumentation) { configuration ->
|
||||||
withTestName { buildTestTag("openAppCold", testApp, configuration) }
|
withTestName { buildTestTag(configuration) }
|
||||||
repeat { configuration.repetitions }
|
repeat { configuration.repetitions }
|
||||||
setup {
|
setup {
|
||||||
test {
|
test {
|
||||||
@@ -88,11 +86,13 @@ class OpenAppColdTest(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
assertions {
|
assertions {
|
||||||
|
val isRotated = configuration.startRotation.isRotated()
|
||||||
|
|
||||||
|
presubmit {
|
||||||
windowManagerTrace {
|
windowManagerTrace {
|
||||||
navBarWindowIsAlwaysVisible()
|
navBarWindowIsAlwaysVisible()
|
||||||
statusBarWindowIsAlwaysVisible()
|
statusBarWindowIsAlwaysVisible()
|
||||||
visibleWindowsShownMoreThanOneConsecutiveEntry()
|
visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||||
|
|
||||||
appWindowReplacesLauncherAsTopWindow(testApp)
|
appWindowReplacesLauncherAsTopWindow(testApp)
|
||||||
wallpaperWindowBecomesInvisible()
|
wallpaperWindowBecomesInvisible()
|
||||||
}
|
}
|
||||||
@@ -100,23 +100,36 @@ class OpenAppColdTest(
|
|||||||
layersTrace {
|
layersTrace {
|
||||||
// During testing the launcher is always in portrait mode
|
// During testing the launcher is always in portrait mode
|
||||||
noUncoveredRegions(Surface.ROTATION_0, configuration.endRotation)
|
noUncoveredRegions(Surface.ROTATION_0, configuration.endRotation)
|
||||||
navBarLayerRotatesAndScales(Surface.ROTATION_0,
|
|
||||||
configuration.endRotation,
|
|
||||||
enabled = !configuration.startRotation.isRotated())
|
|
||||||
statusBarLayerRotatesScales(Surface.ROTATION_0,
|
|
||||||
configuration.endRotation,
|
|
||||||
enabled = !configuration.startRotation.isRotated())
|
|
||||||
navBarLayerIsAlwaysVisible()
|
navBarLayerIsAlwaysVisible()
|
||||||
statusBarLayerIsAlwaysVisible()
|
statusBarLayerIsAlwaysVisible()
|
||||||
visibleLayersShownMoreThanOneConsecutiveEntry(enabled = false)
|
|
||||||
|
|
||||||
appLayerReplacesWallpaperLayer(testApp.`package`)
|
appLayerReplacesWallpaperLayer(testApp.`package`)
|
||||||
|
|
||||||
|
if (!isRotated) {
|
||||||
|
navBarLayerRotatesAndScales(Surface.ROTATION_0,
|
||||||
|
configuration.endRotation)
|
||||||
|
statusBarLayerRotatesScales(Surface.ROTATION_0,
|
||||||
|
configuration.endRotation)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
eventLog {
|
eventLog {
|
||||||
focusChanges("NexusLauncherActivity", testApp.`package`)
|
focusChanges("NexusLauncherActivity", testApp.`package`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flaky {
|
||||||
|
layersTrace {
|
||||||
|
visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||||
|
|
||||||
|
if (isRotated) {
|
||||||
|
navBarLayerRotatesAndScales(Surface.ROTATION_0,
|
||||||
|
configuration.endRotation)
|
||||||
|
statusBarLayerRotatesScales(Surface.ROTATION_0,
|
||||||
|
configuration.endRotation)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package com.android.server.wm.flicker.launch
|
package com.android.server.wm.flicker.launch
|
||||||
|
|
||||||
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
|
||||||
@@ -52,7 +51,6 @@ import org.junit.runners.Parameterized
|
|||||||
* Launch an app from the recents app view (the overview)
|
* Launch an app from the recents app view (the overview)
|
||||||
* To run this test: `atest FlickerTests:OpenAppFromOverviewTest`
|
* To run this test: `atest FlickerTests:OpenAppFromOverviewTest`
|
||||||
*/
|
*/
|
||||||
@Presubmit
|
|
||||||
@RequiresDevice
|
@RequiresDevice
|
||||||
@RunWith(Parameterized::class)
|
@RunWith(Parameterized::class)
|
||||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||||
@@ -67,7 +65,7 @@ class OpenAppFromOverviewTest(
|
|||||||
val testApp = SimpleAppHelper(instrumentation)
|
val testApp = SimpleAppHelper(instrumentation)
|
||||||
return FlickerTestRunnerFactory.getInstance()
|
return FlickerTestRunnerFactory.getInstance()
|
||||||
.buildTest(instrumentation, repetitions = 5) { configuration ->
|
.buildTest(instrumentation, repetitions = 5) { configuration ->
|
||||||
withTestName { buildTestTag("openAppFromOverview", configuration) }
|
withTestName { buildTestTag(configuration) }
|
||||||
repeat { configuration.repetitions }
|
repeat { configuration.repetitions }
|
||||||
setup {
|
setup {
|
||||||
test {
|
test {
|
||||||
@@ -92,38 +90,59 @@ class OpenAppFromOverviewTest(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
assertions {
|
assertions {
|
||||||
|
val isRotated = configuration.startRotation.isRotated()
|
||||||
|
|
||||||
|
presubmit {
|
||||||
windowManagerTrace {
|
windowManagerTrace {
|
||||||
navBarWindowIsAlwaysVisible()
|
navBarWindowIsAlwaysVisible()
|
||||||
statusBarWindowIsAlwaysVisible()
|
statusBarWindowIsAlwaysVisible()
|
||||||
visibleWindowsShownMoreThanOneConsecutiveEntry()
|
|
||||||
|
|
||||||
appWindowReplacesLauncherAsTopWindow(testApp)
|
appWindowReplacesLauncherAsTopWindow(testApp)
|
||||||
wallpaperWindowBecomesInvisible()
|
wallpaperWindowBecomesInvisible()
|
||||||
}
|
}
|
||||||
|
|
||||||
layersTrace {
|
layersTrace {
|
||||||
noUncoveredRegions(Surface.ROTATION_0, configuration.endRotation,
|
|
||||||
bugId = 141361128)
|
|
||||||
navBarLayerRotatesAndScales(Surface.ROTATION_0,
|
|
||||||
configuration.endRotation,
|
|
||||||
enabled = !configuration.startRotation.isRotated())
|
|
||||||
statusBarLayerRotatesScales(Surface.ROTATION_0,
|
|
||||||
configuration.endRotation,
|
|
||||||
enabled = !configuration.startRotation.isRotated())
|
|
||||||
statusBarLayerIsAlwaysVisible(
|
|
||||||
enabled = Surface.ROTATION_0 == configuration.endRotation)
|
|
||||||
navBarLayerIsAlwaysVisible(
|
|
||||||
enabled = Surface.ROTATION_0 == configuration.endRotation)
|
|
||||||
visibleLayersShownMoreThanOneConsecutiveEntry(
|
|
||||||
enabled = false)
|
|
||||||
|
|
||||||
appLayerReplacesWallpaperLayer(testApp.`package`)
|
appLayerReplacesWallpaperLayer(testApp.`package`)
|
||||||
|
|
||||||
|
if (!isRotated) {
|
||||||
|
navBarLayerRotatesAndScales(Surface.ROTATION_0,
|
||||||
|
configuration.endRotation)
|
||||||
|
statusBarLayerRotatesScales(Surface.ROTATION_0,
|
||||||
|
configuration.endRotation)
|
||||||
|
} else {
|
||||||
|
statusBarLayerIsAlwaysVisible()
|
||||||
|
navBarLayerIsAlwaysVisible()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
eventLog {
|
eventLog {
|
||||||
focusChanges("NexusLauncherActivity", testApp.`package`)
|
focusChanges("NexusLauncherActivity", testApp.`package`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
postsubmit {
|
||||||
|
windowManagerTrace {
|
||||||
|
visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
flaky {
|
||||||
|
layersTrace {
|
||||||
|
visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||||
|
noUncoveredRegions(Surface.ROTATION_0, configuration.endRotation,
|
||||||
|
bugId = 141361128)
|
||||||
|
|
||||||
|
if (isRotated) {
|
||||||
|
navBarLayerRotatesAndScales(Surface.ROTATION_0,
|
||||||
|
configuration.endRotation)
|
||||||
|
statusBarLayerRotatesScales(Surface.ROTATION_0,
|
||||||
|
configuration.endRotation)
|
||||||
|
} else {
|
||||||
|
statusBarLayerIsAlwaysVisible()
|
||||||
|
navBarLayerIsAlwaysVisible()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package com.android.server.wm.flicker.launch
|
package com.android.server.wm.flicker.launch
|
||||||
|
|
||||||
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
|
||||||
@@ -51,7 +50,6 @@ import org.junit.runners.Parameterized
|
|||||||
* Test warm launch app.
|
* Test warm launch app.
|
||||||
* To run this test: `atest FlickerTests:OpenAppWarmTest`
|
* To run this test: `atest FlickerTests:OpenAppWarmTest`
|
||||||
*/
|
*/
|
||||||
@Presubmit
|
|
||||||
@RequiresDevice
|
@RequiresDevice
|
||||||
@RunWith(Parameterized::class)
|
@RunWith(Parameterized::class)
|
||||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||||
@@ -64,7 +62,7 @@ class OpenAppWarmTest(testSpec: FlickerTestRunnerFactory.TestSpec) : FlickerTest
|
|||||||
val testApp = SimpleAppHelper(instrumentation)
|
val testApp = SimpleAppHelper(instrumentation)
|
||||||
return FlickerTestRunnerFactory.getInstance()
|
return FlickerTestRunnerFactory.getInstance()
|
||||||
.buildTest(instrumentation) { configuration ->
|
.buildTest(instrumentation) { configuration ->
|
||||||
withTestName { buildTestTag("openAppWarm", testApp, configuration) }
|
withTestName { buildTestTag(configuration) }
|
||||||
repeat { configuration.repetitions }
|
repeat { configuration.repetitions }
|
||||||
setup {
|
setup {
|
||||||
test {
|
test {
|
||||||
@@ -91,6 +89,9 @@ class OpenAppWarmTest(testSpec: FlickerTestRunnerFactory.TestSpec) : FlickerTest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
assertions {
|
assertions {
|
||||||
|
val isRotated = configuration.startRotation.isRotated()
|
||||||
|
|
||||||
|
presubmit {
|
||||||
windowManagerTrace {
|
windowManagerTrace {
|
||||||
navBarWindowIsAlwaysVisible()
|
navBarWindowIsAlwaysVisible()
|
||||||
statusBarWindowIsAlwaysVisible()
|
statusBarWindowIsAlwaysVisible()
|
||||||
@@ -103,23 +104,36 @@ class OpenAppWarmTest(testSpec: FlickerTestRunnerFactory.TestSpec) : FlickerTest
|
|||||||
layersTrace {
|
layersTrace {
|
||||||
// During testing the launcher is always in portrait mode
|
// During testing the launcher is always in portrait mode
|
||||||
noUncoveredRegions(Surface.ROTATION_0, configuration.endRotation)
|
noUncoveredRegions(Surface.ROTATION_0, configuration.endRotation)
|
||||||
navBarLayerRotatesAndScales(Surface.ROTATION_0,
|
|
||||||
configuration.endRotation,
|
|
||||||
enabled = !configuration.startRotation.isRotated())
|
|
||||||
statusBarLayerRotatesScales(Surface.ROTATION_0,
|
|
||||||
configuration.endRotation,
|
|
||||||
enabled = !configuration.startRotation.isRotated())
|
|
||||||
navBarLayerIsAlwaysVisible()
|
navBarLayerIsAlwaysVisible()
|
||||||
statusBarLayerIsAlwaysVisible()
|
statusBarLayerIsAlwaysVisible()
|
||||||
visibleLayersShownMoreThanOneConsecutiveEntry(enabled = false)
|
|
||||||
|
|
||||||
appLayerReplacesWallpaperLayer(testApp.`package`)
|
appLayerReplacesWallpaperLayer(testApp.`package`)
|
||||||
|
|
||||||
|
if (!isRotated) {
|
||||||
|
navBarLayerRotatesAndScales(Surface.ROTATION_0,
|
||||||
|
configuration.endRotation)
|
||||||
|
statusBarLayerRotatesScales(Surface.ROTATION_0,
|
||||||
|
configuration.endRotation)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
eventLog {
|
eventLog {
|
||||||
focusChanges("NexusLauncherActivity", testApp.`package`)
|
focusChanges("NexusLauncherActivity", testApp.`package`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flaky {
|
||||||
|
layersTrace {
|
||||||
|
visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||||
|
|
||||||
|
if (isRotated) {
|
||||||
|
navBarLayerRotatesAndScales(Surface.ROTATION_0,
|
||||||
|
configuration.endRotation)
|
||||||
|
statusBarLayerRotatesScales(Surface.ROTATION_0,
|
||||||
|
configuration.endRotation)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user