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

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

Merge changes I1708a0f6,Ib81dadd7 into main

* changes:
  Move MaximizeAppWindowWithDragToTopDragZoneInDesktopFirst into /externaldisplay subfolder
  b/434615720 Migrate OpenAppWithExternalDisplayConnected to flicker test
parents 0d7a87f8 08d7d959
Loading
Loading
Loading
Loading
+16 −8
Original line number Diff line number Diff line
@@ -44,6 +44,8 @@ test_module_config {
    base: "WMShellFlickerTestsDesktopMode",
    test_suites: ["device-tests"],
    exclude_filters: [
        "com.android.wm.shell.flicker.externaldisplay.MaximizeAppWindowWithDragToTopDragZoneInDesktopFirstFlickerTest",
        "com.android.wm.shell.flicker.externaldisplay.OpenAppWithExternalDisplayConnectedFlickerTest",
        "com.android.wm.shell.flicker.fundamentals.CloseAllAppsViaAppHeaderExitTest",
        "com.android.wm.shell.flicker.fundamentals.CloseAllAppsWithBackNavigationTest",
        "com.android.wm.shell.flicker.fundamentals.EnterDesktopFromSplitScreenWithAppHandleMenuFlickerTest",
@@ -68,7 +70,6 @@ test_module_config {
        "com.android.wm.shell.flicker.maximize.MaximizeAppFlickerTest",
        "com.android.wm.shell.flicker.maximize.MaximizeAppNonResizableFlickerTest",
        "com.android.wm.shell.flicker.maximize.MaximizeAppViaHeaderMenuFlickerTest",
        "com.android.wm.shell.flicker.maximize.MaximizeAppWindowWithDragToTopDragZoneInDesktopFirstFlickerTest",
        "com.android.wm.shell.flicker.minimize.MinimizeAppsFlickerTest",
        "com.android.wm.shell.flicker.minimize.MinimizeAutoPipAppWindowFlickerTest",
        "com.android.wm.shell.flicker.resizing.ResizeAppToMaximumWindowSizeFlickerTest",
@@ -91,6 +92,20 @@ test_module_config {
    ],
}

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

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

test_module_config {
    name: "WMShellFlickerTestsDesktopMode-keyboardshortcuts-AltTabSwitchInDesktopModeFlickerTest",
    base: "WMShellFlickerTestsDesktopMode",
@@ -273,13 +288,6 @@ test_module_config {
    include_filters: ["com.android.wm.shell.flicker.maximize.MaximizeAppViaHeaderMenuFlickerTest"],
}

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

test_module_config {
    name: "WMShellFlickerTestsDesktopMode-minimize-MinimizeAppsFlickerTest",
    base: "WMShellFlickerTestsDesktopMode",
+6 −3
Original line number Diff line number Diff line
{
  "wm": [
    {
      "name": "WMShellFlickerTestsDesktopMode-externaldisplay-MaximizeAppWindowWithDragToTopDragZoneInDesktopFirstFlickerTest"
    },
    {
      "name": "WMShellFlickerTestsDesktopMode-externaldisplay-OpenAppWithExternalDisplayConnectedFlickerTest"
    },
    {
      "name": "WMShellFlickerTestsDesktopMode-fundamentals-CloseAllAppsViaAppHeaderExitTest"
    },
@@ -78,9 +84,6 @@
    {
      "name": "WMShellFlickerTestsDesktopMode-maximize-MaximizeAppViaHeaderMenuFlickerTest"
    },
    {
      "name": "WMShellFlickerTestsDesktopMode-maximize-MaximizeAppWindowWithDragToTopDragZoneInDesktopFirstFlickerTest"
    },
    {
      "name": "WMShellFlickerTestsDesktopMode-minimize-MinimizeAppsFlickerTest"
    },
+0 −51
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.OPEN_APP_WHEN_EXTERNAL_DISPLAY_CONNECTED
import com.android.wm.shell.scenarios.OpenAppWithExternalDisplayConnected
import org.junit.Test
import org.junit.runner.RunWith

/**
 * Open an app on the default display when an external display is connected.
 *
 * Assert that the app launches in desktop mode.
 */
@RequiresDevice
@RunWith(FlickerServiceJUnit4ClassRunner::class)
class OpenAppWithExternalDisplayConnected : OpenAppWithExternalDisplayConnected() {
    @ExpectedScenarios(["OPEN_APP_WHEN_EXTERNAL_DISPLAY_CONNECTED"])
    @Test
    override fun openAppWithExternalDisplayConnected() = super.openAppWithExternalDisplayConnected()

    companion object {
        @JvmStatic
        @FlickerConfigProvider
        fun flickerConfigProvider(): FlickerConfig =
            FlickerConfig()
                .use(FlickerServiceConfig.DEFAULT)
                .use(OPEN_APP_WHEN_EXTERNAL_DISPLAY_CONNECTED)
    }
}
+3 −3
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

package com.android.wm.shell.flicker.maximize
package com.android.wm.shell.flicker.externaldisplay

import androidx.test.filters.RequiresDevice
import android.tools.NavBar
@@ -35,8 +35,8 @@ import org.junit.runner.RunWith
import org.junit.runners.Parameterized

/**
 * Maximize app window by dragging it to the top drag zone in desktop-first display.
 *
 * Maximize app window by dragging it to the top drag zone in desktop-first display when an
 * external display is connected.
 * Test with 3 button navigation because the expected bottom inset of the stable bounds is higher
 * than actual.
 *
+99 −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.externaldisplay

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.OpenAppWithExternalDisplayConnected
import com.android.wm.shell.Utils
import com.android.wm.shell.flicker.utils.appWindowBecomesVisible
import com.android.wm.shell.flicker.utils.appWindowInsideDisplayBoundsAtEnd
import com.android.wm.shell.flicker.utils.appWindowOnDefaultDisplayAtEnd
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

/**
 * Open an app on the default display when an external display is connected.
 *
 * Assert that the app launches in desktop mode.
 */

@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
class OpenAppWithExternalDisplayConnectedFlickerTest(flicker: FlickerTest) :
    DesktopModeBaseTest(flicker) {
    inner class OpenAppWithExternalDisplayConnectedScenario :
        OpenAppWithExternalDisplayConnected(flicker.scenario.startRotation)

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

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

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

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

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

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

    @Test
    fun wallpaperActivityBecomesVisible() = flicker.appWindowBecomesVisible(desktopWallpaperMatcher)

    companion object {
        @Parameterized.Parameters(name = "{0}")
        @JvmStatic
        fun getParams(): Collection<FlickerChecker> {
            return FlickerTestFactory.nonRotationTests(
                supportedNavigationModes = listOf(NavBar.MODE_GESTURAL)
            )
        }
    }
}
Loading