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

Commit f93cb5b9 authored by Hanna Nizhnikava's avatar Hanna Nizhnikava Committed by Android (Google) Code Review
Browse files

Merge "Add tests for Meta+Tab Overview toggle feature" into main

parents 1bca5348 b93e8be3
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -275,6 +275,13 @@ test_module_config {
    include_filters: ["com.android.wm.shell.flicker.immersive.EnterImmersiveViaHeaderMenuFlickerTest"],
}

test_module_config {
    name: "WMShellFlickerTestsDesktopMode-keyboardshortcuts-ActionTabSwitchToDesktopAppFlickerTest",
    base: "WMShellFlickerTestsDesktopMode",
    test_suites: ["device-tests"],
    include_filters: ["com.android.wm.shell.flicker.keyboardshortcuts.ActionTabSwitchToDesktopAppFlickerTest"],
}

test_module_config {
    name: "WMShellFlickerTestsDesktopMode-keyboardshortcuts-AltTabSwitchInDesktopModeFlickerTest",
    base: "WMShellFlickerTestsDesktopMode",
+89 −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.keyboardshortcuts

import android.platform.test.annotations.Postsubmit
import android.platform.test.annotations.RequiresDesktopDevice
import android.tools.NavBar
import android.tools.flicker.FlickerBuilder
import android.tools.flicker.FlickerTest
import android.tools.flicker.FlickerTestFactory
import android.tools.flicker.assertions.FlickerChecker
import android.tools.flicker.junit.FlickerParametersRunnerFactory
import android.tools.traces.component.ComponentNameMatcher.Companion.DESKTOP_WALLPAPER_ACTIVITY
import com.android.wm.shell.Utils
import com.android.wm.shell.flicker.DesktopModeBaseTest
import com.android.wm.shell.flicker.utils.appWindowBecomesInvisible
import com.android.wm.shell.flicker.utils.appWindowOnTopAtEnd
import com.android.wm.shell.flicker.utils.layerBecomesVisible
import com.android.wm.shell.scenarios.ActionTabSwitchToDesktopApp
import org.junit.Rule
import org.junit.runner.RunWith
import org.junit.Test
import org.junit.runners.Parameterized

/**
 * Tests task switching and launching from Overview using Meta+Tab keyboard shortcut.
 *
 * To run this test: atest ActionTabSwitchToDesktopAppFlickerTest
 */
@RequiresDesktopDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@Postsubmit
class ActionTabSwitchToDesktopAppFlickerTest(flicker: FlickerTest) : DesktopModeBaseTest(flicker) {
    inner class ActionTabSwitchToDesktopAppScenario : ActionTabSwitchToDesktopApp(rotation = flicker.scenario.startRotation)

    @Rule
    @JvmField
    val testSetupRule = Utils.testSetupRule(NavBar.MODE_GESTURAL, flicker.scenario.startRotation)
    val scenario = ActionTabSwitchToDesktopAppScenario()
    private val fullscreenApp = scenario.fullscreenApp
    private val desktopApp = scenario.desktopApp

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

    @Test
    fun desktopWindowOnTopAtEnd() = flicker.appWindowOnTopAtEnd(desktopApp)

    @Test
    fun fullscreenWindowBecomesInvisible() = flicker.appWindowBecomesInvisible(fullscreenApp)

    @Test
    fun wallpaperActivityBecomesVisible() = flicker.layerBecomesVisible(DESKTOP_WALLPAPER_ACTIVITY)

    companion object {
        @Parameterized.Parameters(name = "{0}")
        @JvmStatic
        fun getParams(): Collection<FlickerChecker> {
            return FlickerTestFactory.nonRotationTests(
                supportedNavigationModes = listOf(NavBar.MODE_GESTURAL)
            )
        }
    }
}
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -126,6 +126,7 @@ test_module_config {
        "com.android.wm.shell.functional.fundamentals.focus.MoveToNextDisplayAndFocusTest",
        "com.android.wm.shell.functional.fundamentals.focus.OpenAndFocusTest",
        "com.android.wm.shell.functional.immersive.EnterImmersiveViaHeaderMenuTest",
        "com.android.wm.shell.functional.keyboardshortcuts.ActionTabSwitchToDesktopAppTest",
        "com.android.wm.shell.functional.keyboardshortcuts.AltTabSwitchInDesktopModeTest",
        "com.android.wm.shell.functional.keyboardshortcuts.AltTabSwitchOutDesktopModeTest",
        "com.android.wm.shell.functional.keyboardshortcuts.AltTabSwitchToUnminimizeInDesktopModeTest",
+3 −0
Original line number Diff line number Diff line
@@ -174,6 +174,9 @@
    {
      "name": "FunctionalTestsDesktopMode-immersive-EnterImmersiveViaHeaderMenuTest"
    },
    {
      "name": "FunctionalTestsDesktopMode-keyboardshortcuts-ActionTabSwitchToDesktopAppTest"
    },
    {
      "name": "FunctionalTestsDesktopMode-keyboardshortcuts-AltTabSwitchInDesktopModeTest"
    },
+31 −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.functional.keyboardshortcuts

import android.platform.test.annotations.Presubmit
import android.platform.test.annotations.RequiresDesktopDevice
import android.platform.test.rule.ScreenRecordRule
import com.android.wm.shell.scenarios.ActionTabSwitchToDesktopApp
import org.junit.runner.RunWith
import org.junit.runners.BlockJUnit4ClassRunner

/* Functional test for [ActionTabSwitchToDesktopApp]. */
@RequiresDesktopDevice
@RunWith(BlockJUnit4ClassRunner::class)
@Presubmit
@ScreenRecordRule.ScreenRecord
class ActionTabSwitchToDesktopAppTest : ActionTabSwitchToDesktopApp()
 No newline at end of file
Loading