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

Commit 07b17d4d authored by CHIA-HSUAN HSU's avatar CHIA-HSUAN HSU
Browse files

b/418238218 Migrate ExitDesktopToFullScreenWithKeyboardShortcut to flicker test

Test: USE_RBE=false atest WMShellFlickerTestsDesktopMode:com.android.wm.shell.flicker.keyboardshortcuts.ExitDesktopToFullScreenWithKeyboardShortcutFlickerTest -c (http://ab/I47800010422279782)
Video: http://recall/-/g3UAkWrNKjUbq7lFTtYLIh
Flag: EXEMPT migrate test case
Bug: 418238218
Change-Id: I78bc90aa16bde3a33add49b38199befed78498ad
parent e5e3d053
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ test_module_config {
        "com.android.wm.shell.flicker.fundamentals.SwitchToHomeFromDesktopTest",
        "com.android.wm.shell.flicker.fundamentals.SwitchToOverviewFromDesktopFlickerTest",
        "com.android.wm.shell.flicker.keyboardshortcuts.EnterDesktopFromKeyboardShortcutFlickerTest",
        "com.android.wm.shell.flicker.keyboardshortcuts.ExitDesktopToFullScreenWithKeyboardShortcutFlickerTest",
        "com.android.wm.shell.flicker.maximize.MaximizeAppDoubleTapAppHeaderFlickerTest",
        "com.android.wm.shell.flicker.maximize.MaximizeAppFlickerTest",
        "com.android.wm.shell.flicker.maximize.MaximizeAppNonResizableFlickerTest",
@@ -203,6 +204,13 @@ test_module_config {
    include_filters: ["com.android.wm.shell.flicker.keyboardshortcuts.EnterDesktopFromKeyboardShortcutFlickerTest"],
}

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

test_module_config {
    name: "WMShellFlickerTestsDesktopMode-maximize-MaximizeAppDoubleTapAppHeaderFlickerTest",
    base: "WMShellFlickerTestsDesktopMode",
+3 −0
Original line number Diff line number Diff line
@@ -51,6 +51,9 @@
    {
      "name": "WMShellFlickerTestsDesktopMode-keyboardshortcuts-EnterDesktopFromKeyboardShortcutFlickerTest"
    },
    {
      "name": "WMShellFlickerTestsDesktopMode-keyboardshortcuts-ExitDesktopToFullScreenWithKeyboardShortcutFlickerTest"
    },
    {
      "name": "WMShellFlickerTestsDesktopMode-maximize-MaximizeAppDoubleTapAppHeaderFlickerTest"
    },
+0 −46
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.wm.shell.flicker

import android.tools.flicker.FlickerConfig
import android.tools.flicker.annotation.ExpectedScenarios
import android.tools.flicker.annotation.FlickerConfigProvider
import android.tools.flicker.config.FlickerConfig
import android.tools.flicker.config.FlickerServiceConfig
import android.tools.flicker.junit.FlickerServiceJUnit4ClassRunner
import androidx.test.filters.RequiresDevice
import com.android.wm.shell.flicker.DesktopModeFlickerScenarios.Companion.EXIT_DESKTOP_FROM_KEYBOARD_SHORTCUT
import com.android.wm.shell.scenarios.ExitDesktopFromKeyboardShortcut
import org.junit.Test
import org.junit.runner.RunWith

@RequiresDevice
@RunWith(FlickerServiceJUnit4ClassRunner::class)
class ExitDesktopToFullScreenWithKeyboardShortcut : ExitDesktopFromKeyboardShortcut() {
    @ExpectedScenarios(["EXIT_DESKTOP_FROM_KEYBOARD_SHORTCUT"])
    @Test
    override fun exitDesktopToFullScreenFromKeyboardShortcut() =
        super.exitDesktopToFullScreenFromKeyboardShortcut()

    companion object {
        @JvmStatic
        @FlickerConfigProvider
        fun flickerConfigProvider(): FlickerConfig =
            FlickerConfig().use(FlickerServiceConfig.DEFAULT)
                .use(EXIT_DESKTOP_FROM_KEYBOARD_SHORTCUT)
    }
}
+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 androidx.test.filters.RequiresDevice
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.Companion.DESKTOP_WALLPAPER_ACTIVITY
import com.android.wm.shell.flicker.DesktopModeBaseTest
import com.android.wm.shell.flicker.utils.appWindowBecomesInvisible
import com.android.wm.shell.flicker.utils.appWindowOnTopAtStart
import com.android.wm.shell.flicker.utils.appWindowOnTopAtEnd
import com.android.wm.shell.flicker.utils.layerCoversFullScreenAtEnd
import com.android.wm.shell.scenarios.ExitDesktopFromKeyboardShortcut
import com.android.wm.shell.Utils
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized

/**
 * Exit the app to full screen with keyboard shortcut.
 */
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
class ExitDesktopToFullScreenWithKeyboardShortcutFlickerTest(flicker: FlickerTest) :
    DesktopModeBaseTest(flicker) {
    inner class ExitDesktopToFullScreenWithKeyboardShortcutScenario : ExitDesktopFromKeyboardShortcut(flicker.scenario.startRotation)

    @Rule
    @JvmField
    val testSetupRule = Utils.testSetupRule(NavBar.MODE_GESTURAL, flicker.scenario.startRotation)
    val scenario = ExitDesktopToFullScreenWithKeyboardShortcutScenario()
    private val testApp = scenario.testApp

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

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

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

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

    @Test
    fun wallpaperBecomesInvisible() = flicker.appWindowBecomesInvisible(DESKTOP_WALLPAPER_ACTIVITY)

    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
@@ -131,6 +131,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.keyboardshortcuts.EnterDesktopFromKeyboardShortcutTest",
        "com.android.wm.shell.functional.keyboardshortcuts.ExitDesktopFromKeyboardShortcutTest",
        "com.android.wm.shell.functional.maximize.MaximizeAppWindowTest",
        "com.android.wm.shell.functional.maximize.MaximizeAppWindowWithDragToTopDragZoneInDesktopFirstTest",
        "com.android.wm.shell.functional.maximize.MaximizeAppWindowWithDragToTopDragZoneTest",
@@ -474,6 +475,13 @@ test_module_config {
    include_filters: ["com.android.wm.shell.functional.keyboardshortcuts.EnterDesktopFromKeyboardShortcutTest"],
}

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

test_module_config {
    name: "FunctionalTestsDesktopMode-maximize-MaximizeAppWindowTest",
    base: "FunctionalTestsDesktopMode",
Loading