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

Commit 59f35e58 authored by Vania Desmonda's avatar Vania Desmonda Committed by Android (Google) Code Review
Browse files

Merge "b/418209286 Add new test case for using META + = to exit immersive mode...

Merge "b/418209286 Add new test case for using META + = to exit immersive mode to desktop mode" into main
parents c89b9712 c6289245
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ test_module_config {
        "com.android.wm.shell.flicker.keyboardshortcuts.AltTabSwitchToUnminimizeInDesktopModeFlickerTest",
        "com.android.wm.shell.flicker.keyboardshortcuts.EnterDesktopFromKeyboardShortcutFlickerTest",
        "com.android.wm.shell.flicker.keyboardshortcuts.ExitDesktopToFullScreenWithKeyboardShortcutFlickerTest",
        "com.android.wm.shell.flicker.keyboardshortcuts.ExitImmersiveToDesktopWithKeyboardShortcutFlickerTest",
        "com.android.wm.shell.flicker.keyboardshortcuts.MaximizeAppWithKeyboardFlickerTest",
        "com.android.wm.shell.flicker.keyboardshortcuts.MinimizeAppsWithKeyboardFlickerTest",
        "com.android.wm.shell.flicker.keyboardshortcuts.OpenAppFromAllAppsUsingKeyboardFlickerTest",
@@ -277,6 +278,13 @@ test_module_config {
    include_filters: ["com.android.wm.shell.flicker.keyboardshortcuts.ExitDesktopToFullScreenWithKeyboardShortcutFlickerTest"],
}

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

test_module_config {
    name: "WMShellFlickerTestsDesktopMode-keyboardshortcuts-MaximizeAppWithKeyboardFlickerTest",
    base: "WMShellFlickerTestsDesktopMode",
+111 −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.assertions.FlickerChecker
import android.tools.flicker.junit.FlickerParametersRunnerFactory
import android.tools.flicker.FlickerBuilder
import android.tools.flicker.FlickerTest
import android.tools.flicker.FlickerTestFactory
import android.tools.traces.component.ComponentNameMatcher
import android.tools.traces.component.IComponentNameMatcher
import com.android.wm.shell.Utils
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.flicker.utils.layerBecomesVisible
import com.android.wm.shell.flicker.utils.resizeVeilKeepsDecreasingInSize
import com.android.wm.shell.scenarios.ExitImmersiveToDesktopWithKeyboardShortcut
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized

/**
 * Exit immersive mode to maximize in desktop mode by pressing
 * META + = on the keyboard.
 *
 * Assert that the status bar and task bar are visible at the end.
 */
@RequiresDesktopDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@Postsubmit
class ExitImmersiveToDesktopWithKeyboardShortcutFlickerTest(
    flicker: FlickerTest) : DesktopModeBaseTest(flicker) {
    override val excludedTests: Set<String>
        get() =
            setOf(
                "taskBarLayerIsVisibleAtStartAndEnd",
                "taskBarWindowIsAlwaysVisible",
                "statusBarLayerIsVisibleAtStartAndEnd",
                "statusBarLayerPositionAtStartAndEnd",
                "statusBarWindowIsAlwaysVisible"
            )

    inner class ExitImmersiveToDesktopWithKeyboardShortcutScenario :
        ExitImmersiveToDesktopWithKeyboardShortcut(
            rotation = flicker.scenario.startRotation
        )

    @Rule
    @JvmField
    val testSetupRule =
        Utils.testSetupRule(NavBar.MODE_GESTURAL, flicker.scenario.startRotation)
    val scenario = ExitImmersiveToDesktopWithKeyboardShortcutScenario()
    private val gameApp = scenario.gameApp
    private val navBarMatcher: IComponentNameMatcher = ComponentNameMatcher.NAV_BAR
    private val statusBarMatcher: IComponentNameMatcher = ComponentNameMatcher.STATUS_BAR

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

    @Test
    fun appWindowOnTopAtEnd() = flicker.appWindowOnTopAtEnd(gameApp)

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

    @Test
    fun resizeVeilKeepsDecreasingInSize() =
        flicker.resizeVeilKeepsDecreasingInSize(gameApp)

    @Test
    fun statusBarLayerBecomesVisible() = flicker.layerBecomesVisible(statusBarMatcher)

    @Test
    @Ignore("TODO: Reinstate this test once b/435359906 is fixed")
    fun taskBarLayerBecomesVisible() = flicker.layerBecomesVisible(navBarMatcher)

    companion object {
        @Parameterized.Parameters(name = "{0}")
        @JvmStatic
        fun getParams(): Collection<FlickerChecker> {
            return FlickerTestFactory.nonRotationTests(
                supportedNavigationModes = listOf(NavBar.MODE_GESTURAL)
            )
        }
    }
}
+8 −0
Original line number Diff line number Diff line
@@ -125,6 +125,7 @@ test_module_config {
        "com.android.wm.shell.functional.keyboardshortcuts.AltTabSwitchToUnminimizeInDesktopModeTest",
        "com.android.wm.shell.functional.keyboardshortcuts.EnterDesktopFromKeyboardShortcutTest",
        "com.android.wm.shell.functional.keyboardshortcuts.ExitDesktopFromKeyboardShortcutTest",
        "com.android.wm.shell.functional.keyboardshortcuts.ExitImmersiveToDesktopWithKeyboardShortcutTest",
        "com.android.wm.shell.functional.keyboardshortcuts.OpenAppFromAllAppsUsingKeyboardTest",
        "com.android.wm.shell.functional.keyboardshortcuts.OpenBrowserWithKeyboardShortcutTest",
        "com.android.wm.shell.functional.maximize.MaximizeAppWindowTest",
@@ -547,6 +548,13 @@ test_module_config {
    include_filters: ["com.android.wm.shell.functional.keyboardshortcuts.ExitDesktopFromKeyboardShortcutTest"],
}

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

test_module_config {
    name: "FunctionalTestsDesktopMode-keyboardshortcuts-OpenAppFromAllAppsUsingKeyboardTest",
    base: "FunctionalTestsDesktopMode",
+3 −0
Original line number Diff line number Diff line
@@ -180,6 +180,9 @@
    {
      "name": "FunctionalTestsDesktopMode-keyboardshortcuts-ExitDesktopFromKeyboardShortcutTest"
    },
    {
      "name": "FunctionalTestsDesktopMode-keyboardshortcuts-ExitImmersiveToDesktopWithKeyboardShortcutTest"
    },
    {
      "name": "FunctionalTestsDesktopMode-keyboardshortcuts-OpenAppFromAllAppsUsingKeyboardTest"
    },
+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.ExitImmersiveToDesktopWithKeyboardShortcut
import org.junit.runner.RunWith
import org.junit.runners.BlockJUnit4ClassRunner

/* Functional test for [ExitImmersiveToDesktopWithKeyboardShortcut]. */
@RunWith(BlockJUnit4ClassRunner::class)
@RequiresDesktopDevice
@Presubmit
@ScreenRecordRule.ScreenRecord
class ExitImmersiveToDesktopWithKeyboardShortcutTest : ExitImmersiveToDesktopWithKeyboardShortcut()
Loading