Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1fda638b authored by Nataniel Borges's avatar Nataniel Borges
Browse files

Update rotation tests to new DSL format

Move the existing assertions into presubmit and flaky blocks

Bug: 162923992
Test: atest FlickerTests
Change-Id: Iedeecf28ad3721f8bf216e721d954a2095ef40aa
parent 0d56c0f5
Loading
Loading
Loading
Loading
+41 −38
Original line number Original line Diff line number Diff line
@@ -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,8 +65,9 @@ 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 {
                    presubmit {
                        windowManagerTrace {
                        windowManagerTrace {
                            navBarWindowIsAlwaysVisible()
                            navBarWindowIsAlwaysVisible()
                            statusBarWindowIsAlwaysVisible()
                            statusBarWindowIsAlwaysVisible()
@@ -76,18 +75,29 @@ class ChangeAppRotationTest(
                        }
                        }


                        layersTrace {
                        layersTrace {
                        navBarLayerIsAlwaysVisible(bugId = 140855415)
                        statusBarLayerIsAlwaysVisible(bugId = 140855415)
                            noUncoveredRegions(configuration.startRotation,
                            noUncoveredRegions(configuration.startRotation,
                                configuration.endRotation, allStates = false)
                                configuration.endRotation, allStates = false)

                            all("screenshotLayerBecomesInvisible") {
                                this.showsLayer(testApp.getPackage())
                                    .then()
                                    .showsLayer(SCREENSHOT_LAYER)
                                    .then()
                                    .showsLayer(testApp.getPackage())
                            }
                        }
                    }

                    flaky {
                        layersTrace {
                            navBarLayerIsAlwaysVisible(bugId = 140855415)
                            statusBarLayerIsAlwaysVisible(bugId = 140855415)
                            navBarLayerRotatesAndScales(configuration.startRotation,
                            navBarLayerRotatesAndScales(configuration.startRotation,
                                configuration.endRotation, bugId = 140855415)
                                configuration.endRotation, bugId = 140855415)
                            statusBarLayerRotatesScales(configuration.startRotation,
                            statusBarLayerRotatesScales(configuration.startRotation,
                                configuration.endRotation, bugId = 140855415)
                                configuration.endRotation, bugId = 140855415)
                            visibleLayersShownMoreThanOneConsecutiveEntry(bugId = 140855415)
                            visibleLayersShownMoreThanOneConsecutiveEntry(bugId = 140855415)
                    }


                    layersTrace {
                            val startingPos = WindowUtils.getDisplayBounds(
                            val startingPos = WindowUtils.getDisplayBounds(
                                configuration.startRotation)
                                configuration.startRotation)
                            val endingPos = WindowUtils.getDisplayBounds(
                            val endingPos = WindowUtils.getDisplayBounds(
@@ -100,14 +110,6 @@ class ChangeAppRotationTest(
                            end("appLayerRotates_EndingPos", bugId = 140855415) {
                            end("appLayerRotates_EndingPos", bugId = 140855415) {
                                this.hasVisibleRegion(testApp.getPackage(), endingPos)
                                this.hasVisibleRegion(testApp.getPackage(), endingPos)
                            }
                            }

                        all("screenshotLayerBecomesInvisible") {
                            this.showsLayer(testApp.getPackage())
                                .then()
                                .showsLayer(SCREENSHOT_LAYER)
                                .then()
                                .showsLayer(testApp.getPackage())
                        }
                        }
                        }


                        eventLog {
                        eventLog {
@@ -115,6 +117,7 @@ class ChangeAppRotationTest(
                        }
                        }
                    }
                    }
                }
                }
            }


            return FlickerTestRunnerFactory.getInstance()
            return FlickerTestRunnerFactory.getInstance()
                .buildRotationTest(instrumentation, transition, testSpec, repetitions = 5)
                .buildRotationTest(instrumentation, transition, testSpec, repetitions = 5)
+51 −49
Original line number Original line Diff line number Diff line
@@ -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,36 +95,39 @@ class SeamlessAppRotationTest(
                    } else {
                    } else {
                        ""
                        ""
                    }
                    }
                    buildTestTag("seamlessRotation", configuration, extraInfo = extra)
                    buildTestTag(configuration, extraInfo = extra)
                }
                }
                assertions {
                assertions {
                    val startingBounds = WindowUtils.getDisplayBounds(configuration.startRotation)
                    val endingBounds = WindowUtils.getDisplayBounds(configuration.endRotation)

                    presubmit {
                        windowManagerTrace {
                        windowManagerTrace {
                        navBarWindowIsAlwaysVisible(bugId = 140855415)
                        statusBarWindowIsAlwaysVisible(bugId = 140855415)
                            visibleWindowsShownMoreThanOneConsecutiveEntry()
                            visibleWindowsShownMoreThanOneConsecutiveEntry()
                            appWindowAlwaysVisibleOnTop(testApp.`package`)
                            appWindowAlwaysVisibleOnTop(testApp.`package`)
                        }
                        }


                        layersTrace {
                            layerAlwaysVisible(testApp.`package`)
                        }
                    }

                    flaky {
                        windowManagerTrace {
                            navBarWindowIsAlwaysVisible(bugId = 140855415)
                            statusBarWindowIsAlwaysVisible(bugId = 140855415)
                        }

                        layersTrace {
                        layersTrace {
                            navBarLayerIsAlwaysVisible(bugId = 140855415)
                            navBarLayerIsAlwaysVisible(bugId = 140855415)
                            statusBarLayerIsAlwaysVisible(bugId = 140855415)
                            statusBarLayerIsAlwaysVisible(bugId = 140855415)
                            noUncoveredRegions(configuration.startRotation,
                            noUncoveredRegions(configuration.startRotation,
                                configuration.endRotation, allStates = false, bugId = 147659548)
                                configuration.endRotation, allStates = false, bugId = 147659548)
                            navBarLayerRotatesAndScales(configuration.startRotation,
                            navBarLayerRotatesAndScales(configuration.startRotation,
                            configuration.endRotation,
                                configuration.endRotation)
                            enabled = false)
                            statusBarLayerRotatesScales(configuration.startRotation,
                            statusBarLayerRotatesScales(configuration.startRotation,
                            configuration.endRotation, enabled = false)
                                configuration.endRotation)
                        visibleLayersShownMoreThanOneConsecutiveEntry(
                            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) {
                            all("appLayerRotates", bugId = 147659548) {
                                if (startingBounds == endingBounds) {
                                if (startingBounds == endingBounds) {
@@ -157,6 +158,7 @@ class SeamlessAppRotationTest(
                        }
                        }
                    }
                    }
                }
                }
            }


            return testFactory.buildRotationTest(instrumentation, transition, testSpec,
            return testFactory.buildRotationTest(instrumentation, transition, testSpec,
                deviceConfigurations = configurations, repetitions = 2)
                deviceConfigurations = configurations, repetitions = 2)