summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2021-02-09 08:43:22 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-02-09 08:43:22 +0000
commita9048d72decae1ea5b7c204b5a4d372ad159776f (patch)
tree168492a39f63f087949e023189d30b00ab6829a7
parent545262b45791bcb890a6f8d1b5c5e76934236073 (diff)
parent9edca34c6b7d48c69cd6df8f8e173a0ea236d457 (diff)
Merge "Update app launch tests to new DSL format" into sc-dev
-rw-r--r--tests/FlickerTests/src/com/android/server/wm/flicker/launch/CommonAssertions.kt10
-rw-r--r--tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppColdTest.kt63
-rw-r--r--tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromOverviewTest.kt75
-rw-r--r--tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppWarmTest.kt64
4 files changed, 127 insertions, 85 deletions
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/CommonAssertions.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/CommonAssertions.kt
index 1bd1190313d8..be3fa5fa3cdf 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/CommonAssertions.kt
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/CommonAssertions.kt
@@ -17,14 +17,10 @@
package com.android.server.wm.flicker.launch
import android.platform.helpers.IAppHelper
-import com.android.server.wm.flicker.dsl.WmAssertionBuilderLegacy
+import com.android.server.wm.flicker.dsl.WmAssertionBuilder
-fun WmAssertionBuilderLegacy.appWindowReplacesLauncherAsTopWindow(
- testApp: IAppHelper,
- bugId: Int = 0,
- enabled: Boolean = bugId == 0
-) {
- all("appWindowReplacesLauncherAsTopWindow", bugId, enabled) {
+fun WmAssertionBuilder.appWindowReplacesLauncherAsTopWindow(testApp: IAppHelper, bugId: Int = 0) {
+ all("appWindowReplacesLauncherAsTopWindow", bugId) {
this.showsAppWindowOnTop("Launcher")
.then()
.showsAppWindowOnTop("Snapshot", testApp.getPackage())
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppColdTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppColdTest.kt
index 010ebf2c2788..0ec0b04339cd 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppColdTest.kt
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppColdTest.kt
@@ -16,7 +16,6 @@
package com.android.server.wm.flicker.launch
-import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
@@ -51,7 +50,6 @@ import org.junit.runners.Parameterized
* Test cold launch app from launcher.
* To run this test: `atest FlickerTests:OpenAppColdTest`
*/
-@Presubmit
@RequiresDevice
@RunWith(Parameterized::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@@ -66,7 +64,7 @@ class OpenAppColdTest(
val testApp = SimpleAppHelper(instrumentation)
return FlickerTestRunnerFactory.getInstance()
.buildTest(instrumentation) { configuration ->
- withTestName { buildTestTag("openAppCold", testApp, configuration) }
+ withTestName { buildTestTag(configuration) }
repeat { configuration.repetitions }
setup {
test {
@@ -88,33 +86,48 @@ class OpenAppColdTest(
}
}
assertions {
- windowManagerTrace {
- navBarWindowIsAlwaysVisible()
- statusBarWindowIsAlwaysVisible()
- visibleWindowsShownMoreThanOneConsecutiveEntry()
+ val isRotated = configuration.startRotation.isRotated()
- appWindowReplacesLauncherAsTopWindow(testApp)
- wallpaperWindowBecomesInvisible()
- }
+ presubmit {
+ windowManagerTrace {
+ navBarWindowIsAlwaysVisible()
+ statusBarWindowIsAlwaysVisible()
+ visibleWindowsShownMoreThanOneConsecutiveEntry()
+ appWindowReplacesLauncherAsTopWindow(testApp)
+ wallpaperWindowBecomesInvisible()
+ }
+
+ layersTrace {
+ // During testing the launcher is always in portrait mode
+ noUncoveredRegions(Surface.ROTATION_0, configuration.endRotation)
+ navBarLayerIsAlwaysVisible()
+ statusBarLayerIsAlwaysVisible()
+ appLayerReplacesWallpaperLayer(testApp.`package`)
- layersTrace {
- // During testing the launcher is always in portrait mode
- 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()
- statusBarLayerIsAlwaysVisible()
- visibleLayersShownMoreThanOneConsecutiveEntry(enabled = false)
+ if (!isRotated) {
+ navBarLayerRotatesAndScales(Surface.ROTATION_0,
+ configuration.endRotation)
+ statusBarLayerRotatesScales(Surface.ROTATION_0,
+ configuration.endRotation)
+ }
+ }
- appLayerReplacesWallpaperLayer(testApp.`package`)
+ eventLog {
+ focusChanges("NexusLauncherActivity", testApp.`package`)
+ }
}
- eventLog {
- focusChanges("NexusLauncherActivity", testApp.`package`)
+ flaky {
+ layersTrace {
+ visibleLayersShownMoreThanOneConsecutiveEntry()
+
+ if (isRotated) {
+ navBarLayerRotatesAndScales(Surface.ROTATION_0,
+ configuration.endRotation)
+ statusBarLayerRotatesScales(Surface.ROTATION_0,
+ configuration.endRotation)
+ }
+ }
}
}
}
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromOverviewTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromOverviewTest.kt
index 5e08921c2253..84cc8e3ab058 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromOverviewTest.kt
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromOverviewTest.kt
@@ -16,7 +16,6 @@
package com.android.server.wm.flicker.launch
-import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.RequiresDevice
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)
* To run this test: `atest FlickerTests:OpenAppFromOverviewTest`
*/
-@Presubmit
@RequiresDevice
@RunWith(Parameterized::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@@ -67,7 +65,7 @@ class OpenAppFromOverviewTest(
val testApp = SimpleAppHelper(instrumentation)
return FlickerTestRunnerFactory.getInstance()
.buildTest(instrumentation, repetitions = 5) { configuration ->
- withTestName { buildTestTag("openAppFromOverview", configuration) }
+ withTestName { buildTestTag(configuration) }
repeat { configuration.repetitions }
setup {
test {
@@ -92,36 +90,57 @@ class OpenAppFromOverviewTest(
}
}
assertions {
- windowManagerTrace {
- navBarWindowIsAlwaysVisible()
- statusBarWindowIsAlwaysVisible()
- visibleWindowsShownMoreThanOneConsecutiveEntry()
+ val isRotated = configuration.startRotation.isRotated()
- appWindowReplacesLauncherAsTopWindow(testApp)
- wallpaperWindowBecomesInvisible()
- }
+ presubmit {
+ windowManagerTrace {
+ navBarWindowIsAlwaysVisible()
+ statusBarWindowIsAlwaysVisible()
+ appWindowReplacesLauncherAsTopWindow(testApp)
+ wallpaperWindowBecomesInvisible()
+ }
+
+ layersTrace {
+ appLayerReplacesWallpaperLayer(testApp.`package`)
- 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)
+ if (!isRotated) {
+ navBarLayerRotatesAndScales(Surface.ROTATION_0,
+ configuration.endRotation)
+ statusBarLayerRotatesScales(Surface.ROTATION_0,
+ configuration.endRotation)
+ } else {
+ statusBarLayerIsAlwaysVisible()
+ navBarLayerIsAlwaysVisible()
+ }
+ }
- appLayerReplacesWallpaperLayer(testApp.`package`)
+ eventLog {
+ focusChanges("NexusLauncherActivity", testApp.`package`)
+ }
}
- eventLog {
- 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()
+ }
+ }
}
}
}
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppWarmTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppWarmTest.kt
index 092cd4d2dad6..1f375a5cdea8 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppWarmTest.kt
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppWarmTest.kt
@@ -16,7 +16,6 @@
package com.android.server.wm.flicker.launch
-import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
@@ -51,7 +50,6 @@ import org.junit.runners.Parameterized
* Test warm launch app.
* To run this test: `atest FlickerTests:OpenAppWarmTest`
*/
-@Presubmit
@RequiresDevice
@RunWith(Parameterized::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@@ -64,7 +62,7 @@ class OpenAppWarmTest(testSpec: FlickerTestRunnerFactory.TestSpec) : FlickerTest
val testApp = SimpleAppHelper(instrumentation)
return FlickerTestRunnerFactory.getInstance()
.buildTest(instrumentation) { configuration ->
- withTestName { buildTestTag("openAppWarm", testApp, configuration) }
+ withTestName { buildTestTag(configuration) }
repeat { configuration.repetitions }
setup {
test {
@@ -91,33 +89,49 @@ class OpenAppWarmTest(testSpec: FlickerTestRunnerFactory.TestSpec) : FlickerTest
}
}
assertions {
- windowManagerTrace {
- navBarWindowIsAlwaysVisible()
- statusBarWindowIsAlwaysVisible()
- visibleWindowsShownMoreThanOneConsecutiveEntry()
+ val isRotated = configuration.startRotation.isRotated()
- appWindowReplacesLauncherAsTopWindow(testApp)
- wallpaperWindowBecomesInvisible()
- }
+ presubmit {
+ windowManagerTrace {
+ navBarWindowIsAlwaysVisible()
+ statusBarWindowIsAlwaysVisible()
+ visibleWindowsShownMoreThanOneConsecutiveEntry()
+
+ appWindowReplacesLauncherAsTopWindow(testApp)
+ wallpaperWindowBecomesInvisible()
+ }
- layersTrace {
- // During testing the launcher is always in portrait mode
- 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()
- statusBarLayerIsAlwaysVisible()
- visibleLayersShownMoreThanOneConsecutiveEntry(enabled = false)
+ layersTrace {
+ // During testing the launcher is always in portrait mode
+ noUncoveredRegions(Surface.ROTATION_0, configuration.endRotation)
+ navBarLayerIsAlwaysVisible()
+ statusBarLayerIsAlwaysVisible()
+ appLayerReplacesWallpaperLayer(testApp.`package`)
- appLayerReplacesWallpaperLayer(testApp.`package`)
+ if (!isRotated) {
+ navBarLayerRotatesAndScales(Surface.ROTATION_0,
+ configuration.endRotation)
+ statusBarLayerRotatesScales(Surface.ROTATION_0,
+ configuration.endRotation)
+ }
+ }
+
+ eventLog {
+ focusChanges("NexusLauncherActivity", testApp.`package`)
+ }
}
- eventLog {
- focusChanges("NexusLauncherActivity", testApp.`package`)
+ flaky {
+ layersTrace {
+ visibleLayersShownMoreThanOneConsecutiveEntry()
+
+ if (isRotated) {
+ navBarLayerRotatesAndScales(Surface.ROTATION_0,
+ configuration.endRotation)
+ statusBarLayerRotatesScales(Surface.ROTATION_0,
+ configuration.endRotation)
+ }
+ }
}
}
}