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

Commit 761740a3 authored by Hongwei Wang's avatar Hongwei Wang Committed by Android (Google) Code Review
Browse files

Merge "Wait on aspect ratio change for flicker test" into main

parents 0dab2dc4 164310db
Loading
Loading
Loading
Loading
+1 −18
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import android.tools.flicker.junit.FlickerParametersRunnerFactory
import android.tools.flicker.legacy.FlickerBuilder
import android.tools.flicker.legacy.LegacyFlickerTest
import android.tools.flicker.legacy.LegacyFlickerTestFactory
import androidx.test.filters.FlakyTest
import com.android.wm.shell.flicker.pip.common.PipTransition
import org.junit.FixMethodOrder
import org.junit.Test
@@ -36,7 +35,7 @@ import org.junit.runners.Parameterized
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class PipAspectRatioChangeTest(flicker: LegacyFlickerTest) : PipTransition(flicker) {
    override val thisTransition: FlickerBuilder.() -> Unit = {
        transitions { pipApp.changeAspectRatio() }
        transitions { pipApp.changeAspectRatio(wmHelper) }
    }

    @Presubmit
@@ -46,22 +45,6 @@ class PipAspectRatioChangeTest(flicker: LegacyFlickerTest) : PipTransition(flick
        flicker.assertLayersEnd { this.visibleRegion(pipApp).isSameAspectRatio(1, 2) }
    }

    @FlakyTest(bugId = 358278071)
    override fun hasAtMostOnePipDismissOverlayWindow() =
        super.hasAtMostOnePipDismissOverlayWindow()

    @FlakyTest(bugId = 358278071)
    override fun statusBarLayerPositionAtStartAndEnd() =
        super.statusBarLayerPositionAtStartAndEnd()

    @FlakyTest(bugId = 358278071)
    override fun taskBarWindowIsAlwaysVisible() =
        super.taskBarWindowIsAlwaysVisible()

    @FlakyTest(bugId = 358278071)
    override fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
        super.visibleWindowsShownMoreThanOneConsecutiveEntry()

    companion object {
        /**
         * Creates the test configurations.
+15 −1
Original line number Diff line number Diff line
@@ -269,9 +269,23 @@ open class PipAppHelper(instrumentation: Instrumentation) :
    /** Expand the PIP window back to full screen via intent and wait until the app is visible */
    fun exitPipToFullScreenViaIntent(wmHelper: WindowManagerStateHelper) = launchViaIntent(wmHelper)

    fun changeAspectRatio() {
    fun changeAspectRatio(wmHelper: WindowManagerStateHelper) {
        val intent = Intent("com.android.wm.shell.flicker.testapp.ASPECT_RATIO")
        context.sendBroadcast(intent)
        // Wait on WMHelper on size change upon aspect ratio change
        val windowRect = getWindowRect(wmHelper)
        wmHelper
            .StateSyncBuilder()
            .add("pipAspectRatioChanged") {
                val pipAppWindow =
                    it.wmState.visibleWindows.firstOrNull { window ->
                        this.windowMatchesAnyOf(window)
                    }
                        ?: return@add false
                val pipRegion = pipAppWindow.frameRegion
                return@add pipRegion != Region(windowRect)
            }
            .waitForAndVerify()
    }

    fun clickEnterPipButton(wmHelper: WindowManagerStateHelper) {