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

Commit d306b3ab authored by CHIA-HSUAN HSU's avatar CHIA-HSUAN HSU Committed by CHIA-HSUAN HSU (xWF)
Browse files

b/418237610 Migrate OpenAppsInDesktopMode to legacy flicker test

Test: USE_RBE=false atest WMShellFlickerTestsDesktopMode:com.android.wm.shell.flicker.fundamentals.OpenAppsInDesktopModeFlickerTest -c (http://ab/I58800010411504646)
Video: http://recall/-/fS3iF3aeQYGBAI6RD6Vy74
Flag: EXEMPT migrate test case
Bug: 418237610
Change-Id: Id86d84fb39e1e3f3c37cfae66fdb08125be3b2c5
parent d06176fb
Loading
Loading
Loading
Loading
+0 −45
Original line number 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.CASCADE_APP
import com.android.wm.shell.scenarios.OpenAppsInDesktopMode
import org.junit.Test
import org.junit.runner.RunWith

@RequiresDevice
@RunWith(FlickerServiceJUnit4ClassRunner::class)
class OpenAppsInDesktopModeLandscape : OpenAppsInDesktopMode(rotation = ROTATION_90) {
    @ExpectedScenarios(["CASCADE_APP"])
    @Test
    override fun openApps() = super.openApps()

    companion object {
        @JvmStatic
        @FlickerConfigProvider
        fun flickerConfigProvider(): FlickerConfig =
            FlickerConfig().use(FlickerServiceConfig.DEFAULT).use(CASCADE_APP)
    }
}
 No newline at end of file
+0 −44
Original line number 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.CASCADE_APP
import com.android.wm.shell.scenarios.OpenAppsInDesktopMode
import org.junit.Test
import org.junit.runner.RunWith

@RequiresDevice
@RunWith(FlickerServiceJUnit4ClassRunner::class)
class OpenAppsInDesktopModePortrait : OpenAppsInDesktopMode() {
    @ExpectedScenarios(["CASCADE_APP"])
    @Test
    override fun openApps() = super.openApps()

    companion object {
        @JvmStatic
        @FlickerConfigProvider
        fun flickerConfigProvider(): FlickerConfig =
            FlickerConfig().use(FlickerServiceConfig.DEFAULT).use(CASCADE_APP)
    }
}
 No newline at end of file
+85 −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.fundamentals

import android.platform.test.annotations.RequiresDevice
import android.tools.NavBar
import android.tools.flicker.assertions.FlickerTest
import android.tools.flicker.junit.FlickerParametersRunnerFactory
import android.tools.flicker.legacy.FlickerBuilder
import android.tools.flicker.legacy.LegacyFlickerTest
import android.tools.flicker.legacy.LegacyFlickerTestFactory
import com.android.wm.shell.flicker.DesktopModeBaseTest
import com.android.wm.shell.flicker.utils.appWindowInsideDisplayBoundsAtEnd
import com.android.wm.shell.flicker.utils.appWindowOnTopAtEnd
import com.android.wm.shell.flicker.utils.layerBecomesVisible
import com.android.wm.shell.flicker.utils.cascadingEffectAppliedAtEnd
import com.android.wm.shell.scenarios.OpenAppsInDesktopMode
import com.android.wm.shell.Utils
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized

@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
class OpenAppsInDesktopModeFlickerTest(flicker: LegacyFlickerTest) : DesktopModeBaseTest(flicker) {
    inner class OpenAppsInDesktopModeScenario : OpenAppsInDesktopMode(flicker.scenario.startRotation)
    @Rule
    @JvmField
    val testSetupRule = Utils.testSetupRule(NavBar.MODE_GESTURAL, flicker.scenario.startRotation)
    val scenario = OpenAppsInDesktopModeScenario()
    private val fifthApp = scenario.fifthApp
    private val appInDesktop = scenario.appInDesktop

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

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

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

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

    @Test
    fun cascadingEffectAppliedAtEnd() = flicker.cascadingEffectAppliedAtEnd(fifthApp)

    companion object {
        @Parameterized.Parameters(name = "{0}")
        @JvmStatic
        fun getParams(): Collection<FlickerTest> {
            return LegacyFlickerTestFactory.nonRotationTests(
                    supportedNavigationModes = listOf(NavBar.MODE_GESTURAL)
            )
        }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

package com.android.wm.shell.functional
package com.android.wm.shell.functional.fundamentals

import android.platform.test.annotations.Postsubmit
import android.platform.test.rule.ScreenRecordRule
+10 −4
Original line number Diff line number Diff line
@@ -51,10 +51,12 @@ abstract class OpenAppsInDesktopMode(
    private val wmHelper = WindowManagerStateHelper(instrumentation)
    private val device = UiDevice.getInstance(instrumentation)
    private val firstApp = DesktopModeAppHelper(SimpleAppHelper(instrumentation))
    private val secondApp = MailAppHelper(instrumentation)
    private val thirdApp = NewTasksAppHelper(instrumentation)
    private val fourthApp = ImeAppHelper(instrumentation)
    private val fifthApp = NonResizeableAppHelper(instrumentation)
    private val secondApp = DesktopModeAppHelper(MailAppHelper(instrumentation))
    private val thirdApp = DesktopModeAppHelper(NewTasksAppHelper(instrumentation))
    private val fourthApp = DesktopModeAppHelper(ImeAppHelper(instrumentation))
    val fifthApp = DesktopModeAppHelper(NonResizeableAppHelper(instrumentation))

    val appInDesktop: ArrayList<DesktopModeAppHelper> = ArrayList()

    @Rule @JvmField val testSetupRule = Utils.testSetupRule(NavBar.MODE_3BUTTON, rotation)

@@ -74,9 +76,13 @@ abstract class OpenAppsInDesktopMode(
    @Test
    open fun openApps() {
        secondApp.launchViaIntent(wmHelper)
        appInDesktop.add(secondApp)
        thirdApp.launchViaIntent(wmHelper)
        appInDesktop.add(thirdApp)
        fourthApp.launchViaIntent(wmHelper)
        appInDesktop.add(fourthApp)
        fifthApp.launchViaIntent(wmHelper)
        appInDesktop.add(fifthApp)
    }

    @After