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

Commit 39bf2614 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "b/418204319 and b/418202128 Add a new test case for app and system...

Merge "b/418204319 and b/418202128 Add a new test case for app and system dialog stay inside the parent app when the desktop app is moved" into main
parents a894659b 8fd4abde
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -44,8 +44,10 @@ test_module_config {
    base: "WMShellFlickerTestsDesktopMode",
    test_suites: ["device-tests"],
    exclude_filters: [
        "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.SystemDialogStaysInsideDesktopAppFlickerTest",
        "com.android.wm.shell.flicker.exit.ExitDesktopToFullScreenWithAppHeaderMenuFlickerTest",
        "com.android.wm.shell.flicker.exit.ExitDesktopToFullScreenWithDragToTopDragZoneFlickerTest",
        "com.android.wm.shell.flicker.exit.ExitDesktopToSplitScreenWithAppHeaderMenuFlickerTest",
@@ -107,6 +109,13 @@ test_module_config {
    ],
}

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

test_module_config {
    name: "WMShellFlickerTestsDesktopMode-appcompat-ResizeActivityEmbeddedAppToMinimumWindowFlickerTest",
    base: "WMShellFlickerTestsDesktopMode",
@@ -121,6 +130,13 @@ test_module_config {
    include_filters: ["com.android.wm.shell.flicker.appcompat.ShowAppDialogInDesktopModeFlickerTest"],
}

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

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

/**
 * Test for the app dialog stays inside an app when the desktop app is moved in desktop mode.
 *
 * Assert that app dialog activity window appear on top and cover the app window at end.
 */
@RequiresDesktopDevice
@Postsubmit
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
class AppDialogStaysInsideDesktopAppFlickerTest(flicker: FlickerTest) :
    DesktopModeBaseTest(flicker) {
    inner class AppDialogStaysInsideDesktopAppScenario :
        DialogStaysInsideDesktopApp(flicker.scenario.startRotation)

    @Rule
    @JvmField
    val testSetupRule = Utils.testSetupRule(NavBar.MODE_GESTURAL, flicker.scenario.startRotation)
    val scenario = AppDialogStaysInsideDesktopAppScenario()
    private val browserApp = scenario.browserDesktopAppHelper
    private val appDialogMatcher: IComponentNameMatcher =
        ComponentNameMatcher.SHARE_CHOOSER_ACTIVITY

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

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

    @Test
    fun appWindowCoversLeftHalfScreenAtEnd() =
        flicker.appWindowCoversHalfScreenAtEnd(browserApp, isLeftHalf = true)

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

    @Test
    fun appDialogCoversAppAtEnd() =
        flicker.layerExactlyCoversAnotherAtEnd(browserApp, appDialogMatcher)

    companion object {
        @Parameterized.Parameters(name = "{0}")
        @JvmStatic
        fun getParams(): Collection<FlickerChecker> {
            return FlickerTestFactory.nonRotationTests(
                supportedNavigationModes = listOf(NavBar.MODE_GESTURAL)
            )
        }
    }
}
+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.appWindowCoversHalfScreenAtEnd
import com.android.wm.shell.flicker.utils.appWindowKeepVisible
import com.android.wm.shell.flicker.utils.appWindowOnTopAtEnd
import com.android.wm.shell.flicker.utils.layerContainsAnotherAtEnd
import com.android.wm.shell.scenarios.DialogStaysInsideDesktopApp
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized

/**
 * Test for the system dialog stays inside an app when the desktop app is moved in desktop mode.
 *
 * Assert that system dialog activity window appear on top and inside the app window at end.
 */
@RequiresDesktopDevice
@Postsubmit
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
class SystemDialogStaysInsideDesktopAppFlickerTest(flicker: FlickerTest) :
    DesktopModeBaseTest(flicker) {
    inner class SystemDialogStaysInsideDesktopAppScenario :
        DialogStaysInsideDesktopApp(flicker.scenario.startRotation)

    @Rule
    @JvmField
    val testSetupRule = Utils.testSetupRule(NavBar.MODE_GESTURAL, flicker.scenario.startRotation)
    val scenario = SystemDialogStaysInsideDesktopAppScenario()
    private val browserApp = scenario.browserDesktopAppHelper
    private val systemDialogMatcher: IComponentNameMatcher =
        ComponentNameMatcher.PERMISSION_DIALOG_ACTIVITY

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

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

    @Test
    fun appWindowCoversLeftHalfScreenAtEnd() =
        flicker.appWindowCoversHalfScreenAtEnd(browserApp, isLeftHalf = true)

    @Test fun systemDialogWindowOnTopAtEnd() = flicker.appWindowOnTopAtEnd(systemDialogMatcher)

    @Test
    fun appContainsSystemDialogAtEnd() =
        flicker.layerContainsAnotherAtEnd(browserApp, systemDialogMatcher)

    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
@@ -92,6 +92,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.DialogStaysInsideDesktopAppTest",
        "com.android.wm.shell.functional.appcompat.ResizeActivityEmbeddedAppToMinimumWindowTest",
        "com.android.wm.shell.functional.appcompat.ShowAppDialogInDesktopModeTest",
        "com.android.wm.shell.functional.exit.ExitDesktopToFullScreenWithAppHeaderMenuTest",
@@ -304,6 +305,13 @@ test_module_config {
    include_filters: ["com.android.wm.shell.functional.UnminimizeAppFromTaskbarTest"],
}

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

test_module_config {
    name: "FunctionalTestsDesktopMode-appcompat-ResizeActivityEmbeddedAppToMinimumWindowTest",
    base: "FunctionalTestsDesktopMode",
+7 −0
Original line number Diff line number Diff line
@@ -160,6 +160,13 @@
        "desktop"
      ]
    },
    {
      "name": "FunctionalTestsDesktopMode-appcompat-DialogStaysInsideDesktopAppTest",
      "keywords": [
        "device",
        "desktop"
      ]
    },
    {
      "name": "FunctionalTestsDesktopMode-appcompat-ResizeActivityEmbeddedAppToMinimumWindowTest",
       "keywords": [
Loading