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

Commit a741e103 authored by Souradeep's avatar Souradeep
Browse files

b/418202350 Add new test case for ShowQuickShareDialogFromQuickSettings to flicker test

Test: USE_RBE=false atest
WMShellFlickerTestsDesktopMode:com.android.wm.shell.flicker.appcompat.ShowQuickShareDialogFromQuickSettingsFlickerTest
-c (http://ab/I58400010440540154)

Video: http://recall/-/f8xmD18AGLHf2GQIh8eAoY
Flag: EXEMPT add new test case
Bug: 418202350
Change-Id: Ibb3bada9a05afc8a61ac1c93e390b7be523ffcd7
parent c5977945
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ test_module_config {
        "com.android.wm.shell.flicker.appcompat.AppDialogStaysInsideDesktopAppFlickerTest",
        "com.android.wm.shell.flicker.appcompat.ResizeActivityEmbeddedAppToMinimumWindowFlickerTest",
        "com.android.wm.shell.flicker.appcompat.ShowAppDialogInDesktopModeFlickerTest",
        "com.android.wm.shell.flicker.appcompat.ShowQuickShareDialogFromQuickSettingsFlickerTest",
        "com.android.wm.shell.flicker.appcompat.SystemDialogStaysInsideDesktopAppFlickerTest",
        "com.android.wm.shell.flicker.exit.ExitDesktopToFullScreenWithAppHeaderMenuFlickerTest",
        "com.android.wm.shell.flicker.exit.ExitDesktopToFullScreenWithDragToTopDragZoneFlickerTest",
@@ -130,6 +131,13 @@ test_module_config {
    include_filters: ["com.android.wm.shell.flicker.appcompat.ShowAppDialogInDesktopModeFlickerTest"],
}

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

test_module_config {
    name: "WMShellFlickerTestsDesktopMode-appcompat-SystemDialogStaysInsideDesktopAppFlickerTest",
    base: "WMShellFlickerTestsDesktopMode",
+97 −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.flicker.utils.layerHasNoDesktopHandleAtEnd
import com.android.wm.shell.scenarios.ShowQuickShareDialogFromQuickSettings
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized

/**
 * Test for showing a quick share dialog from Quick Settings.
 *
 * Assert that dialog should fill all the screen, no handle, and it should not be possible to enter
 * desktop mode for it.
 */
@RequiresDesktopDevice
@Postsubmit
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
class ShowQuickShareDialogFromQuickSettingsFlickerTest(flicker: FlickerTest) :
    DesktopModeBaseTest(flicker) {

    inner class ShowQuickShareDialogFromQuickSettingsScenario :
        ShowQuickShareDialogFromQuickSettings(flicker.scenario.startRotation)

    @Rule
    @JvmField
    val testSetupRule = Utils.testSetupRule(NavBar.MODE_GESTURAL, flicker.scenario.startRotation)
    val scenario = ShowQuickShareDialogFromQuickSettingsScenario()
    private val testApp = scenario.testApp
    private val quickShareDialogMatcher: IComponentNameMatcher =
        ComponentNameMatcher.QUICK_SHARE_DIALOG_ACTIVITY

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

    @Test
    fun quickShareDialogWindowOnTopAtEnd() = flicker.appWindowOnTopAtEnd(quickShareDialogMatcher)

    @Test
    fun quickShareDialogInsideDisplayBoundsAtEnd() =
        flicker.appWindowInsideDisplayBoundsAtEnd(quickShareDialogMatcher)

    @Test
    fun quickShareDialogCoversFullScreenAtEnd() =
        flicker.layerCoversFullScreenAtEnd(quickShareDialogMatcher)

    @Test fun quickShareDialogHasNoHandleAtEnd() = flicker.layerHasNoDesktopHandleAtEnd()

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

    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
@@ -95,6 +95,7 @@ test_module_config {
        "com.android.wm.shell.functional.appcompat.DialogStaysInsideDesktopAppTest",
        "com.android.wm.shell.functional.appcompat.ResizeActivityEmbeddedAppToMinimumWindowTest",
        "com.android.wm.shell.functional.appcompat.ShowAppDialogInDesktopModeTest",
        "com.android.wm.shell.functional.appcompat.ShowQuickShareDialogFromQuickSettingsTest",
        "com.android.wm.shell.functional.exit.ExitDesktopToFullScreenWithAppHeaderMenuTest",
        "com.android.wm.shell.functional.exit.ExitDesktopToSplitScreenWithAppHeaderMenuTest",
        "com.android.wm.shell.functional.exit.ExitDesktopWithDragToTopDragZoneTest",
@@ -326,6 +327,13 @@ test_module_config {
    include_filters: ["com.android.wm.shell.functional.appcompat.ShowAppDialogInDesktopModeTest"],
}

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

test_module_config {
    name: "FunctionalTestsDesktopMode-exit-ExitDesktopToFullScreenWithAppHeaderMenuTest",
    base: "FunctionalTestsDesktopMode",
+7 −0
Original line number Diff line number Diff line
@@ -181,6 +181,13 @@
        "desktop"
      ]
    },
    {
      "name": "FunctionalTestsDesktopMode-appcompat-ShowQuickShareDialogFromQuickSettingsTest",
      "keywords": [
        "device",
        "desktop"
      ]
    },
    {
      "name": "FunctionalTestsDesktopMode-exit-ExitDesktopToFullScreenWithAppHeaderMenuTest",
      "keywords": [
+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.ShowQuickShareDialogFromQuickSettings
import org.junit.runner.RunWith
import org.junit.runners.BlockJUnit4ClassRunner

/* Functional test for [ShowQuickShareDialogFromQuickSettings]. */

@RunWith(BlockJUnit4ClassRunner::class)
@RequiresDesktopDevice
@Presubmit
@ScreenRecordRule.ScreenRecord
class ShowQuickShareDialogFromQuickSettingsTest : ShowQuickShareDialogFromQuickSettings()
Loading