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

Commit ef6bc3d1 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Simplify flicker provider logic"

parents 954ecf98 1e3f5473
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -52,9 +52,9 @@ class AppPairsTestCannotPairNonResizeableApps(
    testSpec: FlickerTestParameter
    testSpec: FlickerTestParameter
) : AppPairsTransition(testSpec) {
) : AppPairsTransition(testSpec) {


    override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit
    override val transition: FlickerBuilder.() -> Unit
        get() = {
        get() = {
            super.transition(this, it)
            super.transition(this)
            transitions {
            transitions {
                nonResizeableApp?.launchViaIntent(wmHelper)
                nonResizeableApp?.launchViaIntent(wmHelper)
                // TODO pair apps through normal UX flow
                // TODO pair apps through normal UX flow
+2 −2
Original line number Original line Diff line number Diff line
@@ -46,9 +46,9 @@ import org.junit.runners.Parameterized
class AppPairsTestPairPrimaryAndSecondaryApps(
class AppPairsTestPairPrimaryAndSecondaryApps(
    testSpec: FlickerTestParameter
    testSpec: FlickerTestParameter
) : AppPairsTransition(testSpec) {
) : AppPairsTransition(testSpec) {
    override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit
    override val transition: FlickerBuilder.() -> Unit
        get() = {
        get() = {
            super.transition(this, it)
            super.transition(this)
            transitions {
            transitions {
                // TODO pair apps through normal UX flow
                // TODO pair apps through normal UX flow
                executeShellCommand(
                executeShellCommand(
+2 −2
Original line number Original line Diff line number Diff line
@@ -52,9 +52,9 @@ class AppPairsTestSupportPairNonResizeableApps(
    testSpec: FlickerTestParameter
    testSpec: FlickerTestParameter
) : AppPairsTransition(testSpec) {
) : AppPairsTransition(testSpec) {


    override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit
    override val transition: FlickerBuilder.() -> Unit
        get() = {
        get() = {
            super.transition(this, it)
            super.transition(this)
            transitions {
            transitions {
                nonResizeableApp?.launchViaIntent(wmHelper)
                nonResizeableApp?.launchViaIntent(wmHelper)
                // TODO pair apps through normal UX flow
                // TODO pair apps through normal UX flow
+2 −2
Original line number Original line Diff line number Diff line
@@ -47,9 +47,9 @@ import org.junit.runners.Parameterized
class AppPairsTestUnpairPrimaryAndSecondaryApps(
class AppPairsTestUnpairPrimaryAndSecondaryApps(
    testSpec: FlickerTestParameter
    testSpec: FlickerTestParameter
) : AppPairsTransition(testSpec) {
) : AppPairsTransition(testSpec) {
    override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit
    override val transition: FlickerBuilder.() -> Unit
        get() = {
        get() = {
            super.transition(this, it)
            super.transition(this)
            setup {
            setup {
                eachRun {
                eachRun {
                    executeShellCommand(
                    executeShellCommand(
+4 −10
Original line number Original line Diff line number Diff line
@@ -25,14 +25,11 @@ import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.isRotated
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
import com.android.server.wm.flicker.navBarLayerIsVisible
import com.android.server.wm.flicker.navBarLayerIsVisible
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.repetitions
import com.android.server.wm.flicker.startRotation
import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarLayerIsVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsVisible
import com.android.server.wm.flicker.statusBarWindowIsVisible
@@ -50,7 +47,6 @@ import org.junit.Test
abstract class AppPairsTransition(protected val testSpec: FlickerTestParameter) {
abstract class AppPairsTransition(protected val testSpec: FlickerTestParameter) {
    protected val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
    protected val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
    protected val context: Context = instrumentation.context
    protected val context: Context = instrumentation.context
    protected val isRotated = testSpec.config.startRotation.isRotated()
    protected val activityHelper = ActivityHelper.getInstance()
    protected val activityHelper = ActivityHelper.getInstance()
    protected val appPairsHelper = AppPairsHelper(instrumentation,
    protected val appPairsHelper = AppPairsHelper(instrumentation,
        Components.SplitScreenActivity.LABEL,
        Components.SplitScreenActivity.LABEL,
@@ -82,20 +78,18 @@ abstract class AppPairsTransition(protected val testSpec: FlickerTestParameter)
    @FlickerBuilderProvider
    @FlickerBuilderProvider
    fun buildFlicker(): FlickerBuilder {
    fun buildFlicker(): FlickerBuilder {
        return FlickerBuilder(instrumentation).apply {
        return FlickerBuilder(instrumentation).apply {
            withTestName { testSpec.name }
            transition(this)
            repeat { testSpec.config.repetitions }
            transition(this, testSpec.config)
        }
        }
    }
    }


    internal open val transition: FlickerBuilder.(Map<String, Any?>) -> Unit
    internal open val transition: FlickerBuilder.() -> Unit
        get() = { configuration ->
        get() = {
            setup {
            setup {
                test {
                test {
                    device.wakeUpAndGoToHomeScreen()
                    device.wakeUpAndGoToHomeScreen()
                }
                }
                eachRun {
                eachRun {
                    this.setRotation(configuration.startRotation)
                    this.setRotation(testSpec.startRotation)
                    primaryApp.launchViaIntent(wmHelper)
                    primaryApp.launchViaIntent(wmHelper)
                    secondaryApp.launchViaIntent(wmHelper)
                    secondaryApp.launchViaIntent(wmHelper)
                    nonResizeableApp?.launchViaIntent(wmHelper)
                    nonResizeableApp?.launchViaIntent(wmHelper)
Loading