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

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

Merge "b/418236032 Migrate EnterDesktopFromKeyboardShortcut to flicker test" into main

parents f36ee681 16f3906b
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ test_module_config {
    exclude_filters: [
        "com.android.wm.shell.flicker.fundamentals.CloseAllAppsViaAppHeaderExitTest",
        "com.android.wm.shell.flicker.fundamentals.CloseAllAppsWithBackNavigationTest",
        "com.android.wm.shell.flicker.fundamentals.EnterDesktopFromKeyboardShortcutFlickerTest",
        "com.android.wm.shell.flicker.fundamentals.EnterDesktopFromSplitScreenWithAppHandleMenuFlickerTest",
        "com.android.wm.shell.flicker.fundamentals.EnterDesktopWithAppHandleMenuFlickerTest",
        "com.android.wm.shell.flicker.fundamentals.EnterDesktopWithDragFlickerTest",
@@ -104,6 +105,13 @@ test_module_config {
    include_filters: ["com.android.wm.shell.flicker.fundamentals.CloseAllAppsWithBackNavigationTest"],
}

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

test_module_config {
    name: "WMShellFlickerTestsDesktopMode-fundamentals-EnterDesktopFromSplitScreenWithAppHandleMenuFlickerTest",
    base: "WMShellFlickerTestsDesktopMode",
+3 −0
Original line number Diff line number Diff line
@@ -6,6 +6,9 @@
    {
      "name": "WMShellFlickerTestsDesktopMode-fundamentals-CloseAllAppsWithBackNavigationTest"
    },
    {
      "name": "WMShellFlickerTestsDesktopMode-fundamentals-EnterDesktopFromKeyboardShortcutFlickerTest"
    },
    {
      "name": "WMShellFlickerTestsDesktopMode-fundamentals-EnterDesktopFromSplitScreenWithAppHandleMenuFlickerTest"
    },
+0 −46
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

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.ENTER_DESKTOP_FROM_KEYBOARD_SHORTCUT
import com.android.wm.shell.scenarios.EnterDesktopFromKeyboardShortcut
import org.junit.Test
import org.junit.runner.RunWith

@RequiresDevice
@RunWith(FlickerServiceJUnit4ClassRunner::class)
class EnterDesktopWithKeyboardShortcut : EnterDesktopFromKeyboardShortcut() {
    @ExpectedScenarios(["ENTER_DESKTOP_FROM_KEYBOARD_SHORTCUT"])
    @Test
    override fun enterDesktopFromKeyboardShortcut() = super.enterDesktopFromKeyboardShortcut()

    companion object {

        @JvmStatic
        @FlickerConfigProvider
        fun flickerConfigProvider(): FlickerConfig =
            FlickerConfig().use(FlickerServiceConfig.DEFAULT)
                .use(ENTER_DESKTOP_FROM_KEYBOARD_SHORTCUT)
    }
}
+87 −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.junit.FlickerParametersRunnerFactory
import android.tools.flicker.FlickerBuilder
import android.tools.flicker.FlickerTest
import android.tools.flicker.FlickerTestFactory
import android.tools.flicker.assertions.FlickerChecker
import android.tools.traces.component.ComponentNameMatcher.Companion.DESKTOP_WALLPAPER_ACTIVITY
import com.android.wm.shell.flicker.DesktopModeBaseTest
import com.android.wm.shell.flicker.utils.appWindowBecomesVisible
import com.android.wm.shell.flicker.utils.appWindowHasDesktopModeInitialBoundsAtTheEnd
import com.android.wm.shell.flicker.utils.appWindowOnTopAtEnd
import com.android.wm.shell.flicker.utils.layerIsVisibleAtEnd
import com.android.wm.shell.scenarios.EnterDesktopFromKeyboardShortcut
import com.android.wm.shell.Utils
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized

@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
class EnterDesktopFromKeyboardShortcutFlickerTest(flicker: FlickerTest) :
    DesktopModeBaseTest(flicker) {
    inner class EnterDesktopFromKeyboardShortcutScenario : EnterDesktopFromKeyboardShortcut(flicker.scenario.startRotation)

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

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

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

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

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

    @Test
    fun wallpaperActivityBecomesVisible() = flicker.appWindowBecomesVisible(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
@@ -114,6 +114,7 @@ test_module_config {
        "com.android.wm.shell.functional.UnminimizeAppFromTaskbarTest",
        "com.android.wm.shell.functional.fundamentals.CloseAllAppsViaAppHeaderExitTest",
        "com.android.wm.shell.functional.fundamentals.CloseAllAppsWithBackNavigationTest",
        "com.android.wm.shell.functional.fundamentals.EnterDesktopFromKeyboardShortcutTest",
        "com.android.wm.shell.functional.fundamentals.EnterDesktopFromSplitScreenWithAppHandleMenuTest",
        "com.android.wm.shell.functional.fundamentals.EnterDesktopWithAppHandleMenuTest",
        "com.android.wm.shell.functional.fundamentals.EnterDesktopWithDragTest",
@@ -354,6 +355,13 @@ test_module_config {
    include_filters: ["com.android.wm.shell.functional.fundamentals.CloseAllAppsWithBackNavigationTest"],
}

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

test_module_config {
    name: "FunctionalTestsDesktopMode-fundamentals-EnterDesktopFromSplitScreenWithAppHandleMenuTest",
    base: "FunctionalTestsDesktopMode",
Loading