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

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

Merge "Use only requires device annotation to determine what should run on cf_arm" into main

parents b4a023c6 d3378e44
Loading
Loading
Loading
Loading
+59 −69
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.server.wm.flicker.activityembedding

import android.platform.test.annotations.Presubmit
import android.tools.common.datatypes.Rect
import android.tools.common.datatypes.Region
import android.tools.common.flicker.subject.region.RegionSubject
import android.tools.common.traces.component.ComponentNameMatcher
import android.tools.device.flicker.junit.FlickerParametersRunnerFactory
@@ -38,8 +37,8 @@ import org.junit.runners.Parameterized
 *
 * Setup: Launch Activity A in fullscreen.
 *
 * Transitions: From A launch a trampoline Activity T, T launches secondary Activity B and
 * finishes itself, end up in split A|B.
 * Transitions: From A launch a trampoline Activity T, T launches secondary Activity B and finishes
 * itself, end up in split A|B.
 *
 * To run this test: `atest FlickerTests:OpenTrampolineActivityTest`
 */
@@ -56,9 +55,7 @@ class OpenTrampolineActivityTest(flicker: LegacyFlickerTest) : ActivityEmbedding
                wmHelper.currentState.layerState.physicalDisplayBounds
                    ?: error("Can't get display bounds")
        }
        transitions {
            testApp.launchTrampolineActivity(wmHelper)
        }
        transitions { testApp.launchTrampolineActivity(wmHelper) }
        teardown {
            tapl.goHome()
            testApp.exit(wmHelper)
@@ -70,9 +67,7 @@ class OpenTrampolineActivityTest(flicker: LegacyFlickerTest) : ActivityEmbedding
    @Test
    fun backgroundLayerNeverVisible() {
        val backgroundColorLayer = ComponentNameMatcher("", "Animation Background")
        flicker.assertLayers {
            isInvisible(backgroundColorLayer)
        }
        flicker.assertLayers { isInvisible(backgroundColorLayer) }
    }

    /** Trampoline activity should finish itself before the end of this test. */
@@ -96,9 +91,7 @@ class OpenTrampolineActivityTest(flicker: LegacyFlickerTest) : ActivityEmbedding
    @Presubmit
    @Test
    fun mainActivityWindowAlwaysVisible() {
        flicker.assertWm {
            isAppWindowVisible(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT)
        }
        flicker.assertWm { isAppWindowVisible(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) }
    }

    // TODO(b/289140963): After this is fixed, assert the main Activity window is visible
@@ -107,12 +100,8 @@ class OpenTrampolineActivityTest(flicker: LegacyFlickerTest) : ActivityEmbedding
    @Presubmit
    @Test
    fun mainActivityLayerAlwaysVisible() {
        flicker.assertLayersStart {
            isVisible(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT)
        }
        flicker.assertLayersEnd {
            isVisible(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT)
        }
        flicker.assertLayersStart { isVisible(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) }
        flicker.assertLayersEnd { isVisible(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) }
    }

    /** Secondary activity is launched from the trampoline activity. */
@@ -155,16 +144,18 @@ class OpenTrampolineActivityTest(flicker: LegacyFlickerTest) : ActivityEmbedding
                .invoke("mainAndSecondaryInSplit") {
                    val mainActivityRegion =
                        RegionSubject(
                                        it.visibleRegion(
                                                ActivityEmbeddingAppHelper
                                                        .MAIN_ACTIVITY_COMPONENT).region,
                                        it.timestamp)
                            it.visibleRegion(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT)
                                .region,
                            it.timestamp
                        )
                    val secondaryActivityRegion =
                        RegionSubject(
                            it.visibleRegion(
                                                ActivityEmbeddingAppHelper
                                                        .SECONDARY_ACTIVITY_COMPONENT).region,
                                        it.timestamp)
                                    ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT
                                )
                                .region,
                            it.timestamp
                        )
                    check { "height" }
                        .that(mainActivityRegion.region.height)
                        .isEqual(secondaryActivityRegion.region.height)
@@ -193,8 +184,7 @@ class OpenTrampolineActivityTest(flicker: LegacyFlickerTest) : ActivityEmbedding
                .isVisible(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT)
        }
        flicker.assertLayersEnd {
            val leftLayerRegion = visibleRegion(
                    ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT)
            val leftLayerRegion = visibleRegion(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT)
            val rightLayerRegion =
                visibleRegion(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT)
            // Compare dimensions of two splits, given we're using default split attributes,
+1 −3
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import android.tools.device.flicker.junit.FlickerParametersRunnerFactory
import android.tools.device.flicker.legacy.FlickerBuilder
import android.tools.device.flicker.legacy.LegacyFlickerTest
import android.tools.device.flicker.legacy.LegacyFlickerTestFactory
import androidx.test.filters.RequiresDevice
import com.android.server.wm.flicker.helpers.SimpleAppHelper
import org.junit.FixMethodOrder
import org.junit.Test
@@ -81,11 +80,10 @@ import org.junit.runners.Parameterized
 *        apps are running before setup
 * ```
 */
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
open class ChangeAppRotationTest(flicker: LegacyFlickerTest) : RotationTransition(flicker) {
class ChangeAppRotationTest(flicker: LegacyFlickerTest) : RotationTransition(flicker) {
    override val testApp = SimpleAppHelper(instrumentation)
    override val transition: FlickerBuilder.() -> Unit
        get() = {
+0 −42
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.server.wm.flicker.rotation

import android.tools.device.flicker.junit.FlickerParametersRunnerFactory
import android.tools.device.flicker.legacy.LegacyFlickerTest
import android.tools.device.flicker.legacy.LegacyFlickerTestFactory
import org.junit.FixMethodOrder
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized

@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class ChangeAppRotationTestCfArm(flicker: LegacyFlickerTest) : ChangeAppRotationTest(flicker) {
    companion object {
        /**
         * Creates the test configurations.
         *
         * See [LegacyFlickerTestFactory.rotationTests] for configuring screen orientation and
         * navigation modes.
         */
        @Parameterized.Parameters(name = "{0}")
        @JvmStatic
        fun getParams() = LegacyFlickerTestFactory.rotationTests()
    }
}
+1 −3
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ import android.tools.device.flicker.legacy.FlickerBuilder
import android.tools.device.flicker.legacy.LegacyFlickerTest
import android.tools.device.flicker.legacy.LegacyFlickerTestFactory
import android.view.WindowManager
import androidx.test.filters.RequiresDevice
import com.android.server.wm.flicker.helpers.SeamlessRotationAppHelper
import com.android.server.wm.flicker.testapp.ActivityOptions
import org.junit.FixMethodOrder
@@ -88,11 +87,10 @@ import org.junit.runners.Parameterized
 *        apps are running before setup
 * ```
 */
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
open class SeamlessAppRotationTest(flicker: LegacyFlickerTest) : RotationTransition(flicker) {
class SeamlessAppRotationTest(flicker: LegacyFlickerTest) : RotationTransition(flicker) {
    override val testApp = SeamlessRotationAppHelper(instrumentation)

    /** {@inheritDoc} */
+0 −51
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.server.wm.flicker.rotation

import android.tools.device.flicker.junit.FlickerParametersRunnerFactory
import android.tools.device.flicker.legacy.LegacyFlickerTest
import android.tools.device.flicker.legacy.LegacyFlickerTestFactory
import com.android.server.wm.flicker.testapp.ActivityOptions
import org.junit.FixMethodOrder
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized

/** This test should fail because of b/264518826 */
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
open class SeamlessAppRotationTestCfArm(flicker: LegacyFlickerTest) :
    SeamlessAppRotationTest(flicker) {
    companion object {
        /**
         * Creates the test configurations for seamless rotation based on the default rotation tests
         * from [LegacyFlickerTestFactory.rotationTests], but adding a flag (
         * [ActivityOptions.SeamlessRotation.EXTRA_STARVE_UI_THREAD]) to indicate if the app should
         * starve the UI thread of not
         */
        @Parameterized.Parameters(name = "{0}")
        @JvmStatic
        fun getParams() =
            LegacyFlickerTestFactory.rotationTests().flatMap { sourceCfg ->
                val legacyCfg = sourceCfg as LegacyFlickerTest
                val defaultRun = createConfig(legacyCfg, starveUiThread = false)
                val busyUiRun = createConfig(legacyCfg, starveUiThread = true)
                listOf(defaultRun, busyUiRun)
            }
    }
}
+9 −9

File changed.

Contains only whitespace changes.

Loading