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

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

Merge "b/432194569 and b/418215460 Migrate MinimizeApps to flicker test" into main

parents 2e92c4e6 4a5430c2
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -67,6 +67,7 @@ test_module_config {
        "com.android.wm.shell.flicker.maximize.MaximizeAppFlickerTest",
        "com.android.wm.shell.flicker.maximize.MaximizeAppFlickerTest",
        "com.android.wm.shell.flicker.maximize.MaximizeAppNonResizableFlickerTest",
        "com.android.wm.shell.flicker.maximize.MaximizeAppNonResizableFlickerTest",
        "com.android.wm.shell.flicker.maximize.MaximizeAppViaHeaderMenuFlickerTest",
        "com.android.wm.shell.flicker.maximize.MaximizeAppViaHeaderMenuFlickerTest",
        "com.android.wm.shell.flicker.minimize.MinimizeAppsFlickerTest",
        "com.android.wm.shell.flicker.minimize.MinimizeAutoPipAppWindowFlickerTest",
        "com.android.wm.shell.flicker.minimize.MinimizeAutoPipAppWindowFlickerTest",
        "com.android.wm.shell.flicker.resizing.ResizeAppToMaximumWindowSizeFlickerTest",
        "com.android.wm.shell.flicker.resizing.ResizeAppToMaximumWindowSizeFlickerTest",
        "com.android.wm.shell.flicker.resizing.ResizeAppToMinimumWindowSizeFlickerTest",
        "com.android.wm.shell.flicker.resizing.ResizeAppToMinimumWindowSizeFlickerTest",
@@ -256,6 +257,13 @@ test_module_config {
    include_filters: ["com.android.wm.shell.flicker.maximize.MaximizeAppViaHeaderMenuFlickerTest"],
    include_filters: ["com.android.wm.shell.flicker.maximize.MaximizeAppViaHeaderMenuFlickerTest"],
}
}


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

test_module_config {
test_module_config {
    name: "WMShellFlickerTestsDesktopMode-minimize-MinimizeAutoPipAppWindowFlickerTest",
    name: "WMShellFlickerTestsDesktopMode-minimize-MinimizeAutoPipAppWindowFlickerTest",
    base: "WMShellFlickerTestsDesktopMode",
    base: "WMShellFlickerTestsDesktopMode",
+3 −0
Original line number Original line Diff line number Diff line
@@ -72,6 +72,9 @@
    {
    {
      "name": "WMShellFlickerTestsDesktopMode-maximize-MaximizeAppViaHeaderMenuFlickerTest"
      "name": "WMShellFlickerTestsDesktopMode-maximize-MaximizeAppViaHeaderMenuFlickerTest"
    },
    },
    {
      "name": "WMShellFlickerTestsDesktopMode-minimize-MinimizeAppsFlickerTest"
    },
    {
    {
      "name": "WMShellFlickerTestsDesktopMode-minimize-MinimizeAutoPipAppWindowFlickerTest"
      "name": "WMShellFlickerTestsDesktopMode-minimize-MinimizeAutoPipAppWindowFlickerTest"
    },
    },
+0 −54
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2024 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.Rotation.ROTATION_90
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.MINIMIZE_APP
import com.android.wm.shell.flicker.DesktopModeFlickerScenarios.Companion.MINIMIZE_LAST_APP
import com.android.wm.shell.scenarios.MinimizeAppWindows
import org.junit.Test
import org.junit.runner.RunWith

/**
 * Minimize app windows by pressing the minimize button.
 *
 * Assert that the app windows gets hidden.
 */
@RequiresDevice
@RunWith(FlickerServiceJUnit4ClassRunner::class)
class MinimizeAppsLandscape : MinimizeAppWindows(rotation = ROTATION_90) {
    @ExpectedScenarios(["MINIMIZE_APP", "MINIMIZE_LAST_APP"])
    @Test
    override fun minimizeAllAppWindows() = super.minimizeAllAppWindows()

    companion object {
        @JvmStatic
        @FlickerConfigProvider
        fun flickerConfigProvider(): FlickerConfig =
            FlickerConfig()
                .use(FlickerServiceConfig.DEFAULT)
                .use(MINIMIZE_APP)
                .use(MINIMIZE_LAST_APP)
    }
}
+0 −53
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2024 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.MINIMIZE_APP
import com.android.wm.shell.flicker.DesktopModeFlickerScenarios.Companion.MINIMIZE_LAST_APP
import com.android.wm.shell.scenarios.MinimizeAppWindows
import org.junit.Test
import org.junit.runner.RunWith

/**
 * Minimize app windows by pressing the minimize button.
 *
 * Assert that the app windows gets hidden.
 */
@RequiresDevice
@RunWith(FlickerServiceJUnit4ClassRunner::class)
class MinimizeAppsPortrait : MinimizeAppWindows() {
    @ExpectedScenarios(["MINIMIZE_APP", "MINIMIZE_LAST_APP"])
    @Test
    override fun minimizeAllAppWindows() = super.minimizeAllAppWindows()

    companion object {
        @JvmStatic
        @FlickerConfigProvider
        fun flickerConfigProvider(): FlickerConfig =
            FlickerConfig()
                .use(FlickerServiceConfig.DEFAULT)
                .use(MINIMIZE_APP)
                .use(MINIMIZE_LAST_APP)
    }
}
+93 −0
Original line number Original line 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.minimize

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.MinimizeAppWindows
import com.android.wm.shell.Utils
import com.android.wm.shell.flicker.utils.appWindowBecomesInvisible
import com.android.wm.shell.flicker.utils.appWindowOnTopAtEnd
import com.android.wm.shell.flicker.utils.appWindowOnTopAtStart
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized

/**
 * Minimize app windows by pressing the minimize button.
 *
 * Assert that the app windows gets hidden.
 */

@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
class MinimizeAppsFlickerTest(flicker: FlickerTest) : DesktopModeBaseTest(flicker) {
    inner class MinimizeAppsScenario : MinimizeAppWindows(
        rotation = flicker.scenario.startRotation
    )

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

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

    @Test
    fun appWindowBecomesInvisible() =
        appInDesktop.forEach { flicker.appWindowBecomesInvisible(it) }

    @Test
    fun appWindowOnTopAtStart() = flicker.appWindowOnTopAtStart(scenario.testApp3)

    @Test
    fun wallpaperActivityOnTopAtEnd() = flicker.appWindowOnTopAtEnd(desktopWallpaperMatcher)

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