Merge "Update enter pip focus change test"

This commit is contained in:
Nataniel Borges
2022-01-18 12:48:44 +00:00
committed by Android (Google) Code Review
7 changed files with 21 additions and 19 deletions

View File

@@ -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()
}

View File

@@ -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")
}
}

View File

@@ -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()

View File

@@ -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()
}
}
}

View File

@@ -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()
}

View File

@@ -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
@@ -148,7 +149,7 @@ class ExpandPipOnDoubleClickTest(testSpec: FlickerTestParameter) : PipTransition
/**
* Checks that the focus doesn't change between windows during the transition
*/
@FlakyTest
@Postsubmit
@Test
fun focusDoesNotChange() {
testSpec.assertEventLog {

View File

@@ -125,13 +125,13 @@ abstract class PipTransition(protected val testSpec: FlickerTestParameter) {
removeAllTasksButHome()
if (!eachRun) {
pipApp.launchViaIntent(wmHelper, stringExtras = stringExtras)
wmHelper.waitFor { it.wmState.hasPipWindow() }
wmHelper.waitPipShown()
}
}
eachRun {
if (eachRun) {
pipApp.launchViaIntent(wmHelper, stringExtras = stringExtras)
wmHelper.waitFor { it.wmState.hasPipWindow() }
wmHelper.waitPipShown()
}
}
}