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

Commit 7f7b20e0 authored by Nataniel Borges's avatar Nataniel Borges Committed by Android (Google) Code Review
Browse files

Merge "Crash test when wait condition not met" into tm-dev

parents 673d54f6 798fe83b
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.wm.shell.flicker.apppairs

import android.platform.test.annotations.Presubmit
import android.view.Display
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
@@ -24,6 +25,7 @@ import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.annotation.Group1
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.traces.common.WindowManagerConditionsFactory
import com.android.wm.shell.flicker.appPairsDividerIsVisibleAtEnd
import com.android.wm.shell.flicker.helpers.AppPairsHelper
import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.resetMultiWindowConfig
@@ -60,7 +62,18 @@ class AppPairsTestSupportPairNonResizeableApps(
                // TODO pair apps through normal UX flow
                executeShellCommand(
                        composePairsCommand(primaryTaskId, nonResizeableTaskId, pair = true))
                nonResizeableApp?.run { wmHelper.waitForFullScreenApp(nonResizeableApp.component) }
                val waitConditions = mutableListOf(
                    WindowManagerConditionsFactory.isWindowVisible(primaryApp.component),
                    WindowManagerConditionsFactory.isLayerVisible(primaryApp.component),
                    WindowManagerConditionsFactory.isAppTransitionIdle(Display.DEFAULT_DISPLAY))

                nonResizeableApp?.let {
                    waitConditions.add(
                        WindowManagerConditionsFactory.isWindowVisible(nonResizeableApp.component))
                    waitConditions.add(
                        WindowManagerConditionsFactory.isLayerVisible(nonResizeableApp.component))
                }
                wmHelper.waitFor(*waitConditions.toTypedArray())
            }
        }

+2 −2
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ open class ImeAppHelper(instrumentation: Instrumentation) : BaseAppHelper(
        if (wmHelper == null) {
            device.waitForIdle()
        } else {
            require(wmHelper.waitImeShown()) { "IME did not appear" }
            wmHelper.waitImeShown()
        }
    }

@@ -79,7 +79,7 @@ open class ImeAppHelper(instrumentation: Instrumentation) : BaseAppHelper(
            if (wmHelper == null) {
                uiDevice.waitForIdle()
            } else {
                require(wmHelper.waitImeGone()) { "IME did did not close" }
                wmHelper.waitImeGone()
            }
        } else {
            // While pressing the back button should close the IME on TV as well, it may also lead
+16 −6
Original line number Diff line number Diff line
@@ -58,17 +58,27 @@ class PipAppHelper(instrumentation: Instrumentation) : BaseAppHelper(
        }
    }

    /** {@inheritDoc}  */
    override fun launchViaIntent(
    /**
     * Launches the app through an intent instead of interacting with the launcher and waits
     * until the app window is in PIP mode
     */
    @JvmOverloads
    fun launchViaIntentAndWaitForPip(
        wmHelper: WindowManagerStateHelper,
        expectedWindowName: String,
        action: String?,
        expectedWindowName: String = "",
        action: String? = null,
        stringExtras: Map<String, String>
    ) {
        super.launchViaIntent(wmHelper, expectedWindowName, action, stringExtras)
        wmHelper.waitPipShown()
        launchViaIntentAndWaitShown(wmHelper, expectedWindowName, action, stringExtras,
            waitConditions = arrayOf(WindowManagerStateHelper.pipShownCondition))
    }

    /**
     * Expand the PIP window back to full screen via intent and wait until the app is visible
     */
    fun exitPipToFullScreenViaIntent(wmHelper: WindowManagerStateHelper) =
        launchViaIntentAndWaitShown(wmHelper)

    private fun focusOnObject(selector: BySelector): Boolean {
        // We expect all the focusable UI elements to be arranged in a way so that it is possible
        // to "cycle" over all them by clicking the D-Pad DOWN button, going back up to "the top"
+12 −1
Original line number Diff line number Diff line
@@ -64,7 +64,18 @@ class EnterPipTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) {
     * Defines the transition used to run the test
     */
    override val transition: FlickerBuilder.() -> Unit
        get() = buildTransition(eachRun = true, stringExtras = emptyMap()) {
        get() = {
            setupAndTeardown(this)
            setup {
                eachRun {
                    pipApp.launchViaIntent(wmHelper)
                }
            }
            teardown {
                eachRun {
                    pipApp.exit(wmHelper)
                }
            }
            transitions {
                pipApp.clickEnterPipButton(wmHelper)
            }
+1 −1
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ class ExitPipViaExpandButtonClickTest(
                // This will bring PipApp to fullscreen
                pipApp.expandPipWindowToApp(wmHelper)
                // Wait until the other app is no longer visible
                wmHelper.waitForSurfaceAppeared(testApp.component.toWindowName())
                wmHelper.waitForSurfaceAppeared(testApp.component)
            }
        }

Loading