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

Commit aa878a5a authored by CHIA-HSUAN HSU (xWF)'s avatar CHIA-HSUAN HSU (xWF) Committed by Android (Google) Code Review
Browse files

Merge "b/418217017 Add SwitchToOverviewFromDesktop flicker test" into main

parents 4cc42828 2da36f69
Loading
Loading
Loading
Loading
+85 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 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.wm.shell.flicker.fundamentals

import androidx.test.filters.RequiresDevice
import android.tools.NavBar
import android.tools.flicker.assertions.FlickerTest
import android.tools.flicker.junit.FlickerParametersRunnerFactory
import android.tools.flicker.legacy.FlickerBuilder
import android.tools.flicker.legacy.LegacyFlickerTest
import android.tools.flicker.legacy.LegacyFlickerTestFactory
import android.tools.traces.component.ComponentNameMatcher
import android.tools.traces.component.IComponentNameMatcher
import com.android.wm.shell.flicker.DesktopModeBaseTest
import com.android.wm.shell.flicker.utils.appWindowKeepVisible
import com.android.wm.shell.flicker.utils.appWindowOnTopAtEnd
import com.android.wm.shell.scenarios.SwitchToOverviewFromDesktop
import com.android.wm.shell.Utils
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized

/**
 * Swiping to overview from desktop.
 */
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
class SwitchToOverviewFromDesktopFlickerTest(flicker: LegacyFlickerTest) :
        DesktopModeBaseTest(flicker) {
    inner class SwitchToOverviewFromDesktopScenario : SwitchToOverviewFromDesktop(
        rotation = flicker.scenario.startRotation
    )
    @Rule
    @JvmField
    val testSetupRule = Utils.testSetupRule(NavBar.MODE_GESTURAL, flicker.scenario.startRotation)
    val scenario = SwitchToOverviewFromDesktopScenario()
    private val testApp = scenario.testApp
    private val overviewMatcher: IComponentNameMatcher = ComponentNameMatcher.LAUNCHER

    override val transition: FlickerBuilder.() -> Unit
        get() = {
            setup {
                scenario.setup()
            }
            transitions {
                scenario.switchToOverview()
            }
            teardown {
                scenario.teardown()
            }
        }

    @Test
    fun appWindowKeepVisible() = flicker.appWindowKeepVisible(testApp)

    // This overviewMatcher is referring to the overview blur.
    @Test
    fun overviewWindowOnTopAtEnd() = flicker.appWindowOnTopAtEnd(overviewMatcher)

    companion object {
        @Parameterized.Parameters(name = "{0}")
        @JvmStatic
        fun getParams(): Collection<FlickerTest> {
            return LegacyFlickerTestFactory.nonRotationTests(
                supportedNavigationModes = listOf(NavBar.MODE_GESTURAL)
            )
        }
    }
}
+8 −8
Original line number Diff line number Diff line
@@ -115,7 +115,6 @@ test_module_config {
        "com.android.wm.shell.functional.OpenAppWithExternalDisplayConnectedTest",
        "com.android.wm.shell.functional.OpenTrampolineAppInDesktopModeTaskLimitTest",
        "com.android.wm.shell.functional.OpenUnlimitedAppsTest",
        "com.android.wm.shell.functional.SwitchToOverviewFromDesktopTest",
        "com.android.wm.shell.functional.TabTearingDesktopWindowingLimitTest",
        "com.android.wm.shell.functional.TabTearingTest",
        "com.android.wm.shell.functional.UnmaximizeAppWindowTest",
@@ -135,6 +134,7 @@ test_module_config {
        "com.android.wm.shell.functional.fundamentals.QuickSwitchBetweenDesktopAndFullscreenTest",
        "com.android.wm.shell.functional.fundamentals.SwitchFocusBetweenAppsTest",
        "com.android.wm.shell.functional.fundamentals.SwitchToHomeFromDesktopTest",
        "com.android.wm.shell.functional.fundamentals.SwitchToOverviewFromDesktopTest",
        "com.android.wm.shell.functional.fundamentals.focus.ClickAndFocusTest",
        "com.android.wm.shell.functional.fundamentals.focus.CloseThenMoveFocusTest",
        "com.android.wm.shell.functional.fundamentals.focus.DragAndKeepFocusTest",
@@ -313,13 +313,6 @@ test_module_config {
    include_filters: ["com.android.wm.shell.functional.OpenUnlimitedAppsTest"],
}

test_module_config {
    name: "FunctionalTestsDesktopMode-SwitchToOverviewFromDesktopTest",
    base: "FunctionalTestsDesktopMode",
    test_suites: ["device-tests"],
    include_filters: ["com.android.wm.shell.functional.SwitchToOverviewFromDesktopTest"],
}

test_module_config {
    name: "FunctionalTestsDesktopMode-TabTearingDesktopWindowingLimitTest",
    base: "FunctionalTestsDesktopMode",
@@ -453,6 +446,13 @@ test_module_config {
    include_filters: ["com.android.wm.shell.functional.fundamentals.SwitchToHomeFromDesktopTest"],
}

test_module_config {
    name: "FunctionalTestsDesktopMode-fundamentals-SwitchToOverviewFromDesktopTest",
    base: "FunctionalTestsDesktopMode",
    test_suites: ["device-tests"],
    include_filters: ["com.android.wm.shell.functional.fundamentals.SwitchToOverviewFromDesktopTest"],
}

test_module_config {
    name: "FunctionalTestsDesktopMode-fundamentals-focus-ClickAndFocusTest",
    base: "FunctionalTestsDesktopMode",
+3 −3
Original line number Diff line number Diff line
@@ -87,9 +87,6 @@
    {
      "name": "FunctionalTestsDesktopMode-OpenUnlimitedAppsTest"
    },
    {
      "name": "FunctionalTestsDesktopMode-SwitchToOverviewFromDesktopTest"
    },
    {
      "name": "FunctionalTestsDesktopMode-TabTearingDesktopWindowingLimitTest"
    },
@@ -144,6 +141,9 @@
    {
      "name": "FunctionalTestsDesktopMode-fundamentals-SwitchFocusBetweenAppsTest"
    },
    {
      "name": "FunctionalTestsDesktopMode-fundamentals-SwitchToOverviewFromDesktopTest"
    },
    {
      "name": "FunctionalTestsDesktopMode-fundamentals-SwitchToHomeFromDesktopTest"
    },
+2 −2
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 * Copyright (C) 2025 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.
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

package com.android.wm.shell.functional
package com.android.wm.shell.functional.fundamentals

import android.platform.test.annotations.Postsubmit
import android.platform.test.rule.ScreenRecordRule
+2 −2
Original line number Diff line number Diff line
@@ -43,13 +43,13 @@ import org.junit.Test
*/
@Ignore("Base Test Class")
abstract class SwitchToOverviewFromDesktop
constructor(val navigationMode: NavBar = NavBar.MODE_GESTURAL) : TestScenarioBase() {
constructor(val navigationMode: NavBar = NavBar.MODE_GESTURAL, val rotation: Rotation = Rotation.ROTATION_0) : TestScenarioBase() {

    private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
    private val tapl = LauncherInstrumentation()
    private val wmHelper = WindowManagerStateHelper(instrumentation)
    private val device = UiDevice.getInstance(instrumentation)
    private val testApp = DesktopModeAppHelper(SimpleAppHelper(instrumentation))
    val testApp = DesktopModeAppHelper(SimpleAppHelper(instrumentation))

    @Rule @JvmField val testSetupRule = Utils.testSetupRule(navigationMode, Rotation.ROTATION_0)