Merge "Update rotation tests to new DSL format" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-02-09 08:42:23 +00:00
committed by Android (Google) Code Review
2 changed files with 96 additions and 91 deletions

View File

@@ -17,7 +17,6 @@
package com.android.server.wm.flicker.rotation package com.android.server.wm.flicker.rotation
import android.os.Bundle import android.os.Bundle
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.FlickerTestRunner import com.android.server.wm.flicker.FlickerTestRunner
@@ -48,7 +47,6 @@ import org.junit.runners.Parameterized
* Cycle through supported app rotations. * Cycle through supported app rotations.
* To run this test: `atest FlickerTests:ChangeAppRotationTest` * To run this test: `atest FlickerTests:ChangeAppRotationTest`
*/ */
@Presubmit
@RequiresDevice @RequiresDevice
@RunWith(Parameterized::class) @RunWith(Parameterized::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING) @FixMethodOrder(MethodSorters.NAME_ASCENDING)
@@ -67,51 +65,56 @@ class ChangeAppRotationTest(
@JvmStatic @JvmStatic
fun getParams(): Collection<Array<Any>> { fun getParams(): Collection<Array<Any>> {
val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration -> val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration ->
withTestName { buildTestTag("changeAppRotation", configuration) } withTestName { buildTestTag(configuration) }
assertions { assertions {
windowManagerTrace { presubmit {
navBarWindowIsAlwaysVisible() windowManagerTrace {
statusBarWindowIsAlwaysVisible() navBarWindowIsAlwaysVisible()
visibleWindowsShownMoreThanOneConsecutiveEntry() statusBarWindowIsAlwaysVisible()
} visibleWindowsShownMoreThanOneConsecutiveEntry()
layersTrace {
navBarLayerIsAlwaysVisible(bugId = 140855415)
statusBarLayerIsAlwaysVisible(bugId = 140855415)
noUncoveredRegions(configuration.startRotation,
configuration.endRotation, allStates = false)
navBarLayerRotatesAndScales(configuration.startRotation,
configuration.endRotation, bugId = 140855415)
statusBarLayerRotatesScales(configuration.startRotation,
configuration.endRotation, bugId = 140855415)
visibleLayersShownMoreThanOneConsecutiveEntry(bugId = 140855415)
}
layersTrace {
val startingPos = WindowUtils.getDisplayBounds(
configuration.startRotation)
val endingPos = WindowUtils.getDisplayBounds(
configuration.endRotation)
start("appLayerRotates_StartingPos", bugId = 140855415) {
this.hasVisibleRegion(testApp.getPackage(), startingPos)
} }
end("appLayerRotates_EndingPos", bugId = 140855415) { layersTrace {
this.hasVisibleRegion(testApp.getPackage(), endingPos) noUncoveredRegions(configuration.startRotation,
} configuration.endRotation, allStates = false)
all("screenshotLayerBecomesInvisible") { all("screenshotLayerBecomesInvisible") {
this.showsLayer(testApp.getPackage()) this.showsLayer(testApp.getPackage())
.then() .then()
.showsLayer(SCREENSHOT_LAYER) .showsLayer(SCREENSHOT_LAYER)
.then() .then()
.showsLayer(testApp.getPackage()) .showsLayer(testApp.getPackage())
}
} }
} }
eventLog { flaky {
focusDoesNotChange(bugId = 151179149) layersTrace {
navBarLayerIsAlwaysVisible(bugId = 140855415)
statusBarLayerIsAlwaysVisible(bugId = 140855415)
navBarLayerRotatesAndScales(configuration.startRotation,
configuration.endRotation, bugId = 140855415)
statusBarLayerRotatesScales(configuration.startRotation,
configuration.endRotation, bugId = 140855415)
visibleLayersShownMoreThanOneConsecutiveEntry(bugId = 140855415)
val startingPos = WindowUtils.getDisplayBounds(
configuration.startRotation)
val endingPos = WindowUtils.getDisplayBounds(
configuration.endRotation)
start("appLayerRotates_StartingPos", bugId = 140855415) {
this.hasVisibleRegion(testApp.getPackage(), startingPos)
}
end("appLayerRotates_EndingPos", bugId = 140855415) {
this.hasVisibleRegion(testApp.getPackage(), endingPos)
}
}
eventLog {
focusDoesNotChange(bugId = 151179149)
}
} }
} }
} }

View File

@@ -17,7 +17,6 @@
package com.android.server.wm.flicker.rotation package com.android.server.wm.flicker.rotation
import android.os.Bundle import android.os.Bundle
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.FlickerTestRunner import com.android.server.wm.flicker.FlickerTestRunner
@@ -51,7 +50,6 @@ import org.junit.runners.Parameterized
* Cycle through supported app rotations using seamless rotations. * Cycle through supported app rotations using seamless rotations.
* To run this test: `atest FlickerTests:SeamlessAppRotationTest` * To run this test: `atest FlickerTests:SeamlessAppRotationTest`
*/ */
@Presubmit
@RequiresDevice @RequiresDevice
@RunWith(Parameterized::class) @RunWith(Parameterized::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING) @FixMethodOrder(MethodSorters.NAME_ASCENDING)
@@ -97,63 +95,67 @@ class SeamlessAppRotationTest(
} else { } else {
"" ""
} }
buildTestTag("seamlessRotation", configuration, extraInfo = extra) buildTestTag(configuration, extraInfo = extra)
} }
assertions { assertions {
windowManagerTrace { val startingBounds = WindowUtils.getDisplayBounds(configuration.startRotation)
navBarWindowIsAlwaysVisible(bugId = 140855415) val endingBounds = WindowUtils.getDisplayBounds(configuration.endRotation)
statusBarWindowIsAlwaysVisible(bugId = 140855415)
visibleWindowsShownMoreThanOneConsecutiveEntry()
appWindowAlwaysVisibleOnTop(testApp.`package`)
}
layersTrace { presubmit {
navBarLayerIsAlwaysVisible(bugId = 140855415) windowManagerTrace {
statusBarLayerIsAlwaysVisible(bugId = 140855415) visibleWindowsShownMoreThanOneConsecutiveEntry()
noUncoveredRegions(configuration.startRotation, appWindowAlwaysVisibleOnTop(testApp.`package`)
configuration.endRotation, allStates = false, bugId = 147659548)
navBarLayerRotatesAndScales(configuration.startRotation,
configuration.endRotation,
enabled = false)
statusBarLayerRotatesScales(configuration.startRotation,
configuration.endRotation, enabled = false)
visibleLayersShownMoreThanOneConsecutiveEntry(
enabled = configuration.startRotation == configuration.endRotation)
layerAlwaysVisible(testApp.`package`)
}
layersTrace {
val startingBounds = WindowUtils
.getDisplayBounds(configuration.startRotation)
val endingBounds = WindowUtils
.getDisplayBounds(configuration.endRotation)
all("appLayerRotates", bugId = 147659548) {
if (startingBounds == endingBounds) {
this.hasVisibleRegion(
testApp.`package`, startingBounds)
} else {
this.hasVisibleRegion(testApp.`package`,
startingBounds)
.then()
.hasVisibleRegion(testApp.`package`,
endingBounds)
}
} }
all("noUncoveredRegions", bugId = 147659548) { layersTrace {
if (startingBounds == endingBounds) { layerAlwaysVisible(testApp.`package`)
this.coversAtLeastRegion(startingBounds)
} else {
this.coversAtLeastRegion(startingBounds)
.then()
.coversAtLeastRegion(endingBounds)
}
} }
} }
eventLog { flaky {
focusDoesNotChange(bugId = 151179149) windowManagerTrace {
navBarWindowIsAlwaysVisible(bugId = 140855415)
statusBarWindowIsAlwaysVisible(bugId = 140855415)
}
layersTrace {
navBarLayerIsAlwaysVisible(bugId = 140855415)
statusBarLayerIsAlwaysVisible(bugId = 140855415)
noUncoveredRegions(configuration.startRotation,
configuration.endRotation, allStates = false, bugId = 147659548)
navBarLayerRotatesAndScales(configuration.startRotation,
configuration.endRotation)
statusBarLayerRotatesScales(configuration.startRotation,
configuration.endRotation)
visibleLayersShownMoreThanOneConsecutiveEntry()
all("appLayerRotates", bugId = 147659548) {
if (startingBounds == endingBounds) {
this.hasVisibleRegion(
testApp.`package`, startingBounds)
} else {
this.hasVisibleRegion(testApp.`package`,
startingBounds)
.then()
.hasVisibleRegion(testApp.`package`,
endingBounds)
}
}
all("noUncoveredRegions", bugId = 147659548) {
if (startingBounds == endingBounds) {
this.coversAtLeastRegion(startingBounds)
} else {
this.coversAtLeastRegion(startingBounds)
.then()
.coversAtLeastRegion(endingBounds)
}
}
}
eventLog {
focusDoesNotChange(bugId = 151179149)
}
} }
} }
} }