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

Commit 9cb90243 authored by Pablo Gamito's avatar Pablo Gamito Committed by Automerger Merge Worker
Browse files

Merge "Make use of TAPL in quickswitch tests" into tm-dev am: 554859be

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16988726

Change-Id: I33d026001fed501edb46f08d487c7aa52d646ba8
parents 64a1d37a 554859be
Loading
Loading
Loading
Loading
+7 −12
Original line number Original line Diff line number Diff line
@@ -23,6 +23,7 @@ import android.platform.test.annotations.RequiresDevice
import android.view.Surface
import android.view.Surface
import android.view.WindowManagerPolicyConstants
import android.view.WindowManagerPolicyConstants
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.platform.app.InstrumentationRegistry
import com.android.launcher3.tapl.LauncherInstrumentation
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameter
@@ -66,6 +67,7 @@ import org.junit.runners.Parameterized
@Group1
@Group1
open class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestParameter) {
open class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestParameter) {
    private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
    private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
    private val taplInstrumentation = LauncherInstrumentation()


    private val testApp1 = SimpleAppHelper(instrumentation)
    private val testApp1 = SimpleAppHelper(instrumentation)
    private val testApp2 = NonResizeableAppHelper(instrumentation)
    private val testApp2 = NonResizeableAppHelper(instrumentation)
@@ -81,6 +83,10 @@ open class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestPa
    fun buildFlicker(): FlickerBuilder {
    fun buildFlicker(): FlickerBuilder {
        return FlickerBuilder(instrumentation).apply {
        return FlickerBuilder(instrumentation).apply {
            setup {
            setup {
                test {
                    taplInstrumentation.setExpectedRotation(testSpec.startRotation)
                }

                eachRun {
                eachRun {
                    testApp1.launchViaIntent(wmHelper)
                    testApp1.launchViaIntent(wmHelper)
                    wmHelper.waitForFullScreenApp(testApp1.component)
                    wmHelper.waitForFullScreenApp(testApp1.component)
@@ -90,18 +96,7 @@ open class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestPa
                }
                }
            }
            }
            transitions {
            transitions {
                // Swipe right from bottom to quick switch back
                taplInstrumentation.launchedAppState.quickSwitchToPreviousApp()
                // NOTE: We don't perform an edge-to-edge swipe but instead only swipe in the middle
                // as to not accidentally trigger a swipe back or forward action which would result
                // in the same behavior but not testing quick swap.
                device.swipe(
                        startDisplayBounds.bounds.right / 3,
                        startDisplayBounds.bounds.bottom,
                        2 * startDisplayBounds.bounds.right / 3,
                        startDisplayBounds.bounds.bottom,
                        if (testSpec.isLandscapeOrSeascapeAtStart) 75 else 30
                )

                wmHelper.waitForFullScreenApp(testApp1.component)
                wmHelper.waitForFullScreenApp(testApp1.component)
                wmHelper.waitForAppTransitionIdle()
                wmHelper.waitForAppTransitionIdle()
                wmHelper.waitForNavBarStatusBarVisible()
                wmHelper.waitForNavBarStatusBarVisible()
+9 −23
Original line number Original line Diff line number Diff line
@@ -22,6 +22,7 @@ import android.platform.test.annotations.RequiresDevice
import android.view.Surface
import android.view.Surface
import android.view.WindowManagerPolicyConstants
import android.view.WindowManagerPolicyConstants
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.platform.app.InstrumentationRegistry
import com.android.launcher3.tapl.LauncherInstrumentation
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameter
@@ -65,6 +66,7 @@ import org.junit.runners.Parameterized
@Group1
@Group1
open class QuickSwitchBetweenTwoAppsForwardTest(private val testSpec: FlickerTestParameter) {
open class QuickSwitchBetweenTwoAppsForwardTest(private val testSpec: FlickerTestParameter) {
    private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
    private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
    private val taplInstrumentation = LauncherInstrumentation()


    private val testApp1 = SimpleAppHelper(instrumentation)
    private val testApp1 = SimpleAppHelper(instrumentation)
    private val testApp2 = NonResizeableAppHelper(instrumentation)
    private val testApp2 = NonResizeableAppHelper(instrumentation)
@@ -73,6 +75,10 @@ open class QuickSwitchBetweenTwoAppsForwardTest(private val testSpec: FlickerTes
    fun buildFlicker(): FlickerBuilder {
    fun buildFlicker(): FlickerBuilder {
        return FlickerBuilder(instrumentation).apply {
        return FlickerBuilder(instrumentation).apply {
            setup {
            setup {
                test {
                    taplInstrumentation.setExpectedRotation(testSpec.startRotation)
                }

                eachRun {
                eachRun {
                    testApp1.launchViaIntent(wmHelper)
                    testApp1.launchViaIntent(wmHelper)
                    wmHelper.waitForFullScreenApp(testApp1.component)
                    wmHelper.waitForFullScreenApp(testApp1.component)
@@ -85,34 +91,14 @@ open class QuickSwitchBetweenTwoAppsForwardTest(private val testSpec: FlickerTes
                        ?.layerStackSpace
                        ?.layerStackSpace
                        ?: error("Display not found")
                        ?: error("Display not found")


                    // Swipe right from bottom to quick switch back
                    taplInstrumentation.launchedAppState.quickSwitchToPreviousApp()
                    // NOTE: We don't perform an edge-to-edge swipe but instead only swipe in the
                    // middle as to not accidentally trigger a swipe back or forward action which
                    // would result in the same behavior but not testing quick swap.
                    device.swipe(
                            startDisplayBounds.right / 3,
                            startDisplayBounds.bottom,
                            2 * startDisplayBounds.right / 3,
                            startDisplayBounds.bottom,
                            if (testSpec.isLandscapeOrSeascapeAtStart) 75 else 30
                    )


                    wmHelper.waitForFullScreenApp(testApp1.component)
                    wmHelper.waitForFullScreenApp(testApp1.component)
                    wmHelper.waitForAppTransitionIdle()
                    wmHelper.waitForAppTransitionIdle()
                }
                }
            }
            }
            transitions {
            transitions {
                // Swipe left from bottom to quick switch forward
                taplInstrumentation.launchedAppState.quickSwitchToPreviousAppSwipeLeft()
                // NOTE: We don't perform an edge-to-edge swipe but instead only swipe in the middle
                // as to not accidentally trigger a swipe back or forward action which would result
                // in the same behavior but not testing quick swap.
                device.swipe(
                        2 * startDisplayBounds.right / 3,
                        startDisplayBounds.bottom,
                        startDisplayBounds.right / 3,
                        startDisplayBounds.bottom,
                        if (testSpec.isLandscapeOrSeascapeAtStart) 75 else 30
                )


                wmHelper.waitForFullScreenApp(testApp2.component)
                wmHelper.waitForFullScreenApp(testApp2.component)
                wmHelper.waitForAppTransitionIdle()
                wmHelper.waitForAppTransitionIdle()
+9 −12
Original line number Original line Diff line number Diff line
@@ -22,6 +22,7 @@ import android.platform.test.annotations.RequiresDevice
import android.view.Surface
import android.view.Surface
import android.view.WindowManagerPolicyConstants
import android.view.WindowManagerPolicyConstants
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.platform.app.InstrumentationRegistry
import com.android.launcher3.tapl.LauncherInstrumentation
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameter
@@ -62,13 +63,20 @@ import org.junit.runners.Parameterized
@Group4
@Group4
class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
    private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
    private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
    private val taplInstrumentation = LauncherInstrumentation()

    private val testApp = SimpleAppHelper(instrumentation)
    private val testApp = SimpleAppHelper(instrumentation)

    private val startDisplayBounds = WindowUtils.getDisplayBounds(testSpec.startRotation)
    private val startDisplayBounds = WindowUtils.getDisplayBounds(testSpec.startRotation)


    @FlickerBuilderProvider
    @FlickerBuilderProvider
    fun buildFlicker(): FlickerBuilder {
    fun buildFlicker(): FlickerBuilder {
        return FlickerBuilder(instrumentation).apply {
        return FlickerBuilder(instrumentation).apply {
            setup {
            setup {
                test {
                    taplInstrumentation.setExpectedRotation(testSpec.startRotation)
                }

                eachRun {
                eachRun {
                    testApp.launchViaIntent(wmHelper)
                    testApp.launchViaIntent(wmHelper)
                    device.pressHome()
                    device.pressHome()
@@ -77,18 +85,7 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
                }
                }
            }
            }
            transitions {
            transitions {
                // Swipe right from bottom to quick switch back
                taplInstrumentation.workspace.quickSwitchToPreviousApp()
                // NOTE: We don't perform an edge-to-edge swipe but instead only swipe in the middle
                // as to not accidentally trigger a swipe back or forward action which would result
                // in the same behavior but not testing quick swap.
                device.swipe(
                        startDisplayBounds.bounds.right / 3,
                        startDisplayBounds.bounds.bottom,
                        2 * startDisplayBounds.bounds.right / 3,
                        startDisplayBounds.bounds.bottom,
                        50
                )

                wmHelper.waitForFullScreenApp(testApp.component)
                wmHelper.waitForFullScreenApp(testApp.component)
                wmHelper.waitForAppTransitionIdle()
                wmHelper.waitForAppTransitionIdle()
                wmHelper.waitForNavBarStatusBarVisible()
                wmHelper.waitForNavBarStatusBarVisible()