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

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

b/418201760 Add new test case for add website shortcut to home page from...

b/418201760 Add new test case for add website shortcut to home page from chrome menu in desktop mode

Test: USE_RBE=false atest WMShellFlickerTestsDesktopMode:com.android.wm.shell.flicker.appcompat.ShowAppDialogInDesktopModeFlickerTest -c (http://ab/I65100010436711796)
Video: http://recall/-/dDMfWWlMnHzsG2K0UTmAOl
Flag: EXEMPT add new test case
Bug: 418201760
Change-Id: Iccdcc8e47214580993a657db246342ba18d1ac64
parent 49ed0e49
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ test_module_config {
    base: "WMShellFlickerTestsDesktopMode",
    test_suites: ["device-tests"],
    exclude_filters: [
        "com.android.wm.shell.flicker.appcompat.ShowAppDialogInDesktopModeFlickerTest",
        "com.android.wm.shell.flicker.exit.ExitDesktopToFullScreenWithAppHeaderMenuFlickerTest",
        "com.android.wm.shell.flicker.exit.ExitDesktopToFullScreenWithDragToTopDragZoneFlickerTest",
        "com.android.wm.shell.flicker.exit.ExitDesktopToSplitScreenWithAppHeaderMenuFlickerTest",
@@ -103,6 +104,13 @@ test_module_config {
    ],
}

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

test_module_config {
    name: "WMShellFlickerTestsDesktopMode-exit-ExitDesktopToFullScreenWithAppHeaderMenuFlickerTest",
    base: "WMShellFlickerTestsDesktopMode",
+91 −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.appcompat

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
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.appWindowInsideDisplayBoundsAtEnd
import com.android.wm.shell.flicker.utils.appWindowKeepVisible
import com.android.wm.shell.flicker.utils.appWindowOnTopAtEnd
import com.android.wm.shell.flicker.utils.layerCoversFullScreenAtEnd
import com.android.wm.shell.scenarios.ShowAppDialogInDesktopMode
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized

/**
 * Test for showing a dialog inside an app in desktop mode.
 *
 * Assert that dialog activity windows appear on top and cover the full screen at end.
 */
@RequiresDesktopDevice
@Postsubmit
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
class ShowAppDialogInDesktopModeFlickerTest(flicker: FlickerTest) : DesktopModeBaseTest(flicker) {
    inner class ShowAppDialogInDesktopModeScenario :
        ShowAppDialogInDesktopMode(flicker.scenario.startRotation)

    @Rule
    @JvmField
    val testSetupRule = Utils.testSetupRule(NavBar.MODE_GESTURAL, flicker.scenario.startRotation)
    val scenario = ShowAppDialogInDesktopModeScenario()
    private val browserApp = scenario.browserAppHelper
    private val appDialogMatcher: IComponentNameMatcher = ComponentNameMatcher.ADD_ITEM_ACTIVITY

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

    @Test
    fun appDialogWindowOnTopAtEnd() = flicker.appWindowOnTopAtEnd(appDialogMatcher)

    @Test
    fun appDialogInsideDisplayBoundsAtEnd() =
        flicker.appWindowInsideDisplayBoundsAtEnd(appDialogMatcher)

    @Test
    fun appDialogCoversFullScreenAtEnd() =
        flicker.layerCoversFullScreenAtEnd(appDialogMatcher)

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

    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
@@ -89,6 +89,7 @@ test_module_config {
        "com.android.wm.shell.functional.UnmaximizeAppWindowTest",
        "com.android.wm.shell.functional.UnminimizeAppFromAllAppsTest",
        "com.android.wm.shell.functional.UnminimizeAppFromTaskbarTest",
        "com.android.wm.shell.functional.appcompat.ShowAppDialogInDesktopModeTest",
        "com.android.wm.shell.functional.exit.ExitDesktopToFullScreenWithAppHeaderMenuTest",
        "com.android.wm.shell.functional.exit.ExitDesktopToSplitScreenWithAppHeaderMenuTest",
        "com.android.wm.shell.functional.exit.ExitDesktopWithDragToTopDragZoneTest",
@@ -296,6 +297,13 @@ test_module_config {
    include_filters: ["com.android.wm.shell.functional.UnminimizeAppFromTaskbarTest"],
}

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

test_module_config {
    name: "FunctionalTestsDesktopMode-exit-ExitDesktopToFullScreenWithAppHeaderMenuTest",
    base: "FunctionalTestsDesktopMode",
+3 −0
Original line number Diff line number Diff line
@@ -72,6 +72,9 @@
    {
      "name": "FunctionalTestsDesktopMode-UnminimizeAppFromTaskbarTest"
    },
    {
      "name": "FunctionalTestsDesktopMode-appcompat-ShowAppDialogInDesktopModeTest"
    },
    {
      "name": "FunctionalTestsDesktopMode-exit-ExitDesktopToFullScreenWithAppHeaderMenuTest"
    },
+32 −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.appcompat

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

/* Functional test for [ShowAppDialogInDesktopMode]. */

@RunWith(BlockJUnit4ClassRunner::class)
@RequiresDesktopDevice
@Presubmit
@ScreenRecordRule.ScreenRecord
class ShowAppDialogInDesktopModeTest : ShowAppDialogInDesktopMode()
Loading