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

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

Merge "b/432637256 Migrate MinimizeAppsWithKeyboard to flicker test" into main

parents e60d1401 5c95bde9
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ test_module_config {
        "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.keyboardshortcuts.MinimizeAppsWithKeyboardFlickerTest",
        "com.android.wm.shell.flicker.maximize.ExitDesktopToFullScreenWithDragToTopDragZoneFlickerTest",
        "com.android.wm.shell.flicker.maximize.MaximizeAppDoubleTapAppHeaderFlickerTest",
        "com.android.wm.shell.flicker.maximize.MaximizeAppFlickerTest",
@@ -212,6 +213,13 @@ test_module_config {
    include_filters: ["com.android.wm.shell.flicker.keyboardshortcuts.ExitDesktopToFullScreenWithKeyboardShortcutFlickerTest"],
}

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

test_module_config {
    name: "WMShellFlickerTestsDesktopMode-maximize-ExitDesktopToFullScreenWithDragToTopDragZoneFlickerTest",
    base: "WMShellFlickerTestsDesktopMode",
+3 −0
Original line number Diff line number Diff line
@@ -54,6 +54,9 @@
    {
      "name": "WMShellFlickerTestsDesktopMode-keyboardshortcuts-ExitDesktopToFullScreenWithKeyboardShortcutFlickerTest"
    },
    {
      "name": "WMShellFlickerTestsDesktopMode-keyboardshortcuts-MinimizeAppsWithKeyboardFlickerTest"
    },
    {
      "name": "WMShellFlickerTestsDesktopMode-maximize-ExitDesktopToFullScreenWithDragToTopDragZoneFlickerTest"
    },
+0 −53
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 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.MINIMIZE_APP
import com.android.wm.shell.flicker.DesktopModeFlickerScenarios.Companion.MINIMIZE_LAST_APP
import com.android.wm.shell.scenarios.MinimizeAppWindows
import org.junit.Test
import org.junit.runner.RunWith

/**
 * Minimize app windows by pressing META + -.
 *
 * Assert that the app windows gets hidden.
 */
@RequiresDevice
@RunWith(FlickerServiceJUnit4ClassRunner::class)
class MinimizeAppsWithKeyboard : MinimizeAppWindows(usingKeyboard = true) {
    @ExpectedScenarios(["MINIMIZE_APP", "MINIMIZE_LAST_APP"])
    @Test
    override fun minimizeAllAppWindows() = super.minimizeAllAppWindows()

    companion object {
        @JvmStatic
        @FlickerConfigProvider
        fun flickerConfigProvider(): FlickerConfig =
            FlickerConfig()
                .use(FlickerServiceConfig.DEFAULT)
                .use(MINIMIZE_APP)
                .use(MINIMIZE_LAST_APP)
    }
}
+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
import android.tools.traces.component.IComponentNameMatcher
import com.android.wm.shell.flicker.DesktopModeBaseTest
import com.android.wm.shell.scenarios.MinimizeAppWindows
import com.android.wm.shell.Utils
import com.android.wm.shell.flicker.utils.appWindowBecomesInvisible
import com.android.wm.shell.flicker.utils.appWindowOnTopAtEnd
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized

/**
 * Minimize app windows by pressing META + -.
 *
 * Assert that the app windows gets hidden.
 */

@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
class MinimizeAppsWithKeyboardFlickerTest(flicker: FlickerTest) : DesktopModeBaseTest(flicker) {
    inner class MinimizeAppsWithKeyboardScenario : MinimizeAppWindows(
        rotation = flicker.scenario.startRotation,
        usingKeyboard = true
    )

    @Rule
    @JvmField
    val testSetupRule = Utils.testSetupRule(NavBar.MODE_GESTURAL, flicker.scenario.startRotation)
    val scenario = MinimizeAppsWithKeyboardScenario()
    private val appInDesktop = scenario.appInDesktop
    private val desktopWallpaperMatcher: IComponentNameMatcher = ComponentNameMatcher.DESKTOP_WALLPAPER_ACTIVITY

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

    @Test
    fun appWindowBecomesInvisible() =
        appInDesktop.forEach { flicker.appWindowBecomesInvisible(it) }

    @Test
    fun wallpaperActivityOnTopAtEnd() = flicker.appWindowOnTopAtEnd(desktopWallpaperMatcher)

    companion object {
        @Parameterized.Parameters(name = "{0}")
        @JvmStatic
        fun getParams(): Collection<FlickerChecker> {
            return FlickerTestFactory.nonRotationTests(
                supportedNavigationModes = listOf(NavBar.MODE_GESTURAL)
            )
        }
    }
}
+8 −8
Original line number Diff line number Diff line
@@ -96,7 +96,6 @@ test_module_config {
        "com.android.wm.shell.functional.EnterDesktopWithDragWindowsLimitTest",
        "com.android.wm.shell.functional.FocusAppFromAllAppsTest",
        "com.android.wm.shell.functional.FocusAppFromTaskbarTest",
        "com.android.wm.shell.functional.MinimizeAppWindowsTest",
        "com.android.wm.shell.functional.MinimizeAutoPipAppWindowTest",
        "com.android.wm.shell.functional.MinimizeWindowOnAppOpenTest",
        "com.android.wm.shell.functional.MinimizeWindowOnAppOpenViaIntentTest",
@@ -134,6 +133,7 @@ test_module_config {
        "com.android.wm.shell.functional.maximize.ExitDesktopWithDragToTopDragZoneTest",
        "com.android.wm.shell.functional.maximize.MaximizeAppWindowTest",
        "com.android.wm.shell.functional.maximize.MaximizeAppWindowWithDragToTopDragZoneInDesktopFirstTest",
        "com.android.wm.shell.functional.minimize.MinimizeAppWindowsTest",
        "com.android.wm.shell.functional.resizing.ResizeAppCornerMultiWindowAndPipTest",
        "com.android.wm.shell.functional.resizing.ResizeAppCornerMultiWindowTest",
        "com.android.wm.shell.functional.resizing.ResizeAppWithCornerResizeTest",
@@ -229,13 +229,6 @@ test_module_config {
    include_filters: ["com.android.wm.shell.functional.FocusAppFromTaskbarTest"],
}

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

test_module_config {
    name: "FunctionalTestsDesktopMode-MinimizeAutoPipAppWindowTest",
    base: "FunctionalTestsDesktopMode",
@@ -495,6 +488,13 @@ test_module_config {
    include_filters: ["com.android.wm.shell.functional.maximize.MaximizeAppWindowWithDragToTopDragZoneInDesktopFirstTest"],
}

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

test_module_config {
    name: "FunctionalTestsDesktopMode-resizing-ResizeAppCornerMultiWindowAndPipTest",
    base: "FunctionalTestsDesktopMode",
Loading