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

Commit 90bd271d authored by CHIA-HSUAN HSU (xWF)'s avatar CHIA-HSUAN HSU (xWF) Committed by Android (Google) Code Review
Browse files

Merge "b/418213173 Migrate EnterDesktopWithDrag to legacy flicker test" into main

parents 8ecf0334 56c197f4
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -50,10 +50,12 @@
        <option name="throw-if-cmd-fail" value="true" />
        <option name="throw-if-cmd-fail" value="true" />
        <option name="run-command" value="rm -rf /data/user/%TEST_USER%/files/*"/>
        <option name="run-command" value="rm -rf /data/user/%TEST_USER%/files/*"/>
        <option name="run-command" value="settings put secure show_ime_with_hard_keyboard 1"/>
        <option name="run-command" value="settings put secure show_ime_with_hard_keyboard 1"/>
        <option name="run-command" value="settings put secure clock_seconds 1"/>
        <option name="run-command" value="settings put system show_touches 1"/>
        <option name="run-command" value="settings put system show_touches 1"/>
        <option name="run-command" value="settings put system pointer_location 1"/>
        <option name="run-command" value="settings put system pointer_location 1"/>
        <option name="teardown-command"
        <option name="teardown-command"
                value="settings delete secure show_ime_with_hard_keyboard"/>
                value="settings delete secure show_ime_with_hard_keyboard"/>
        <option name="teardown-command" value="settings delete secure clock_seconds"/>
        <option name="teardown-command" value="settings delete system show_touches"/>
        <option name="teardown-command" value="settings delete system show_touches"/>
        <option name="teardown-command" value="settings delete system pointer_location"/>
        <option name="teardown-command" value="settings delete system pointer_location"/>
        <option name="teardown-command"
        <option name="teardown-command"
+0 −46
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
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.END_DRAG_TO_DESKTOP
import com.android.wm.shell.scenarios.EnterDesktopWithDrag
import org.junit.Test
import org.junit.runner.RunWith

@RequiresDevice
@RunWith(FlickerServiceJUnit4ClassRunner::class)
class EnterDesktopWithDragLandscape : EnterDesktopWithDrag(Rotation.ROTATION_90) {
    @ExpectedScenarios(["END_DRAG_TO_DESKTOP"])
    @Test
    override fun enterDesktopWithDrag() = super.enterDesktopWithDrag()

    companion object {

        @JvmStatic
        @FlickerConfigProvider
        fun flickerConfigProvider(): FlickerConfig =
            FlickerConfig().use(FlickerServiceConfig.DEFAULT).use(END_DRAG_TO_DESKTOP)
    }
}
+0 −45
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
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.END_DRAG_TO_DESKTOP
import com.android.wm.shell.scenarios.EnterDesktopWithDrag
import org.junit.Test
import org.junit.runner.RunWith

@RequiresDevice
@RunWith(FlickerServiceJUnit4ClassRunner::class)
class EnterDesktopWithDragPortrait : EnterDesktopWithDrag(Rotation.ROTATION_0) {
    @ExpectedScenarios(["END_DRAG_TO_DESKTOP"])
    @Test
    override fun enterDesktopWithDrag() = super.enterDesktopWithDrag()

    companion object {
        @JvmStatic
        @FlickerConfigProvider
        fun flickerConfigProvider(): FlickerConfig =
            FlickerConfig().use(FlickerServiceConfig.DEFAULT).use(END_DRAG_TO_DESKTOP)
    }
}
+90 −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.fundamentals

import androidx.test.filters.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 android.tools.traces.component.ComponentNameMatcher.Companion.DESKTOP_WALLPAPER_ACTIVITY
import com.android.wm.shell.flicker.DesktopModeBaseTest
import com.android.wm.shell.flicker.utils.appWindowBecomesVisible
import com.android.wm.shell.flicker.utils.appWindowHasDesktopModeInitialBoundsAtTheEnd
import com.android.wm.shell.flicker.utils.appWindowOnTopAtEnd
import com.android.wm.shell.flicker.utils.layerIsVisibleAtEnd
import com.android.wm.shell.scenarios.EnterDesktopWithDrag
import com.android.wm.shell.Utils
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized

/**
 * Open the app in desktop mode via dragging.
 */
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
class EnterDesktopWithDragFlickerTest(flicker: LegacyFlickerTest) :
        DesktopModeBaseTest(flicker) {
    inner class EnterDesktopWithDragScenario : EnterDesktopWithDrag(flicker.scenario.startRotation)

    @Rule
    @JvmField
    val testSetupRule = Utils.testSetupRule(NavBar.MODE_GESTURAL, flicker.scenario.startRotation)
    val scenario = EnterDesktopWithDragScenario()
    private val testApp = scenario.testApp

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

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

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

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

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

    companion object {
        @Parameterized.Parameters(name = "{0}")
        @JvmStatic
        fun getParams(): Collection<FlickerTest> {
            return LegacyFlickerTestFactory.nonRotationTests(
                supportedNavigationModes = listOf(NavBar.MODE_GESTURAL)
            )
        }
    }
}
+8 −8
Original line number Original line Diff line number Diff line
@@ -101,7 +101,6 @@ test_module_config {
        "com.android.wm.shell.functional.EnterDesktopViaMenuOfStaticOverviewTaskTest",
        "com.android.wm.shell.functional.EnterDesktopViaMenuOfStaticOverviewTaskTest",
        "com.android.wm.shell.functional.EnterDesktopViaStaticDesktopOverviewTaskTest",
        "com.android.wm.shell.functional.EnterDesktopViaStaticDesktopOverviewTaskTest",
        "com.android.wm.shell.functional.EnterDesktopWithDragExistingWindowsTest",
        "com.android.wm.shell.functional.EnterDesktopWithDragExistingWindowsTest",
        "com.android.wm.shell.functional.EnterDesktopWithDragTest",
        "com.android.wm.shell.functional.EnterDesktopWithDragWindowsLimitTest",
        "com.android.wm.shell.functional.EnterDesktopWithDragWindowsLimitTest",
        "com.android.wm.shell.functional.ExitDesktopWithDragToTopDragZoneTest",
        "com.android.wm.shell.functional.ExitDesktopWithDragToTopDragZoneTest",
        "com.android.wm.shell.functional.FocusAppFromAllAppsTest",
        "com.android.wm.shell.functional.FocusAppFromAllAppsTest",
@@ -126,6 +125,7 @@ test_module_config {
        "com.android.wm.shell.functional.fundamentals.CloseAllAppsWithBackNavigationTest",
        "com.android.wm.shell.functional.fundamentals.CloseAllAppsWithBackNavigationTest",
        "com.android.wm.shell.functional.fundamentals.EnterDesktopFromSplitScreenWithAppHandleMenuTest",
        "com.android.wm.shell.functional.fundamentals.EnterDesktopFromSplitScreenWithAppHandleMenuTest",
        "com.android.wm.shell.functional.fundamentals.EnterDesktopWithAppHandleMenuTest",
        "com.android.wm.shell.functional.fundamentals.EnterDesktopWithAppHandleMenuTest",
        "com.android.wm.shell.functional.fundamentals.EnterDesktopWithDragTest",
        "com.android.wm.shell.functional.fundamentals.EnterSplitScreenWithAppHandleMenuTest",
        "com.android.wm.shell.functional.fundamentals.EnterSplitScreenWithAppHandleMenuTest",
        "com.android.wm.shell.functional.fundamentals.ExitDesktopToFullScreenWithAppHeaderMenuTest",
        "com.android.wm.shell.functional.fundamentals.ExitDesktopToFullScreenWithAppHeaderMenuTest",
        "com.android.wm.shell.functional.fundamentals.ExitDesktopToSplitScreenWithAppHeaderMenuTest",
        "com.android.wm.shell.functional.fundamentals.ExitDesktopToSplitScreenWithAppHeaderMenuTest",
@@ -210,13 +210,6 @@ test_module_config {
    include_filters: ["com.android.wm.shell.functional.EnterDesktopWithDragExistingWindowsTest"],
    include_filters: ["com.android.wm.shell.functional.EnterDesktopWithDragExistingWindowsTest"],
}
}


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

test_module_config {
test_module_config {
    name: "FunctionalTestsDesktopMode-EnterDesktopWithDragWindowsLimitTest",
    name: "FunctionalTestsDesktopMode-EnterDesktopWithDragWindowsLimitTest",
    base: "FunctionalTestsDesktopMode",
    base: "FunctionalTestsDesktopMode",
@@ -385,6 +378,13 @@ test_module_config {
    include_filters: ["com.android.wm.shell.functional.fundamentals.EnterDesktopWithAppHandleMenuTest"],
    include_filters: ["com.android.wm.shell.functional.fundamentals.EnterDesktopWithAppHandleMenuTest"],
}
}


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

test_module_config {
test_module_config {
    name: "FunctionalTestsDesktopMode-fundamentals-EnterSplitScreenWithAppHandleMenuTest",
    name: "FunctionalTestsDesktopMode-fundamentals-EnterSplitScreenWithAppHandleMenuTest",
    base: "FunctionalTestsDesktopMode",
    base: "FunctionalTestsDesktopMode",
Loading