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

Commit 77a4620a authored by Nataniel Borges's avatar Nataniel Borges
Browse files

Update enter pip focus change test

Previously focus didn't change when entering PIP. On the latest versions it should transition to launcher.

Bug: 198124027
Test: atest WMShellFlickerTests
Change-Id: I323a455f23e912afd9eb6e43b365a289c5159331
parent 2a3e5441
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ class PipAppHelper(instrumentation: Instrumentation) : BaseAppHelper(
        stringExtras: Map<String, String>
    ) {
        super.launchViaIntent(wmHelper, expectedWindowName, action, stringExtras)
        wmHelper.waitFor("hasPipWindow") { it.wmState.hasPipWindow() }
        wmHelper.waitPipShown()
    }

    private fun focusOnObject(selector: BySelector): Boolean {
@@ -88,7 +88,7 @@ class PipAppHelper(instrumentation: Instrumentation) : BaseAppHelper(
        clickObject(ENTER_PIP_BUTTON_ID)

        // Wait on WMHelper or simply wait for 3 seconds
        wmHelper?.waitFor("hasPipWindow") { it.wmState.hasPipWindow() } ?: SystemClock.sleep(3_000)
        wmHelper?.waitPipShown() ?: SystemClock.sleep(3_000)
        // when entering pip, the dismiss button is visible at the start. to ensure the pip
        // animation is complete, wait until the pip dismiss button is no longer visible. 
        // b/176822698: dismiss-only state will be removed in the future
@@ -148,7 +148,7 @@ class PipAppHelper(instrumentation: Instrumentation) : BaseAppHelper(
        }

        // Wait for animation to complete.
        wmHelper.waitFor("!hasPipWindow") { !it.wmState.hasPipWindow() }
        wmHelper.waitPipGone()
        wmHelper.waitForHomeActivityVisible()
    }

@@ -165,7 +165,7 @@ class PipAppHelper(instrumentation: Instrumentation) : BaseAppHelper(
                ?: error("PIP window expand button not found")
        val expandButtonBounds = expandPipObject.visibleBounds
        uiDevice.click(expandButtonBounds.centerX(), expandButtonBounds.centerY())
        wmHelper.waitFor("!hasPipWindow") { !it.wmState.hasPipWindow() }
        wmHelper.waitPipGone()
        wmHelper.waitForAppTransitionIdle()
    }

+6 −4
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.wm.shell.flicker.pip

import android.platform.test.annotations.Postsubmit
import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.FlakyTest
@@ -181,13 +182,14 @@ class EnterPipTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) {
    }

    /**
     * Checks the focus doesn't change during the animation
     * Checks that the focus changes between the [pipApp] window and the launcher when
     * closing the pip window
     */
    @FlakyTest
    @Postsubmit
    @Test
    fun focusDoesNotChange() {
    fun focusChanges() {
        testSpec.assertEventLog {
            this.focusDoesNotChange()
            this.focusChanges(pipApp.`package`, "NexusLauncherActivity")
        }
    }

+1 −1
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ class EnterPipToOtherOrientationTest(
                // Enter PiP, and assert that the PiP is within bounds now that the device is back
                // in portrait
                broadcastActionTrigger.doAction(ACTION_ENTER_PIP)
                wmHelper.waitFor { it.wmState.hasPipWindow() }
                wmHelper.waitPipShown()
                wmHelper.waitForAppTransitionIdle()
                // during rotation the status bar becomes invisible and reappears at the end
                wmHelper.waitForNavBarStatusBarVisible()
+5 −6
Original line number Diff line number Diff line
@@ -16,9 +16,9 @@

package com.android.wm.shell.flicker.pip

import android.platform.test.annotations.Postsubmit
import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.FlakyTest
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.LAUNCHER_COMPONENT
import com.android.server.wm.flicker.dsl.FlickerBuilder
@@ -96,14 +96,13 @@ abstract class ExitPipTransition(testSpec: FlickerTestParameter) : PipTransition
    }

    /**
     * Checks that the focus changes between the [pipApp] window and the launcher when
     * closing the pip window
     * Checks that the focus doesn't change between windows during the transition
     */
    @FlakyTest(bugId = 151179149)
    @Postsubmit
    @Test
    open fun focusChanges() {
    open fun focusDoesNotChange() {
        testSpec.assertEventLog {
            this.focusChanges(pipApp.launcherName, "NexusLauncherActivity")
            this.focusDoesNotChange()
        }
    }
}
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ class ExitPipWithSwipeDownTest(testSpec: FlickerTestParameter) : ExitPipTransiti
                val pipCenterY = pipRegion.centerY()
                val displayCenterX = device.displayWidth / 2
                device.swipe(pipCenterX, pipCenterY, displayCenterX, device.displayHeight, 10)
                wmHelper.waitFor("!hasPipWindow") { !it.wmState.hasPipWindow() }
                wmHelper.waitPipGone()
                wmHelper.waitForWindowSurfaceDisappeared(pipApp.component)
                wmHelper.waitForAppTransitionIdle()
            }
Loading