diff options
| author | 2025-02-21 14:48:17 -0800 | |
|---|---|---|
| committer | 2025-02-21 14:48:17 -0800 | |
| commit | be243604c8fcdfbbf6d842c7694bfe7c9196f167 (patch) | |
| tree | 45487b9aade96e0a4f0ebfc556fc6450cc77b4a1 | |
| parent | cdab57004ea8fb298bc115e78e19265dd9699239 (diff) | |
| parent | 52ff6391979692cab3b71506ab02418e30e01805 (diff) | |
Merge "Add E2E test scenario for alt-tab switch CUJ in Desktop Windowing" into main
2 files changed, 107 insertions, 0 deletions
diff --git a/libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/functional/AltTabSwitchInDesktopModeTest.kt b/libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/functional/AltTabSwitchInDesktopModeTest.kt new file mode 100644 index 000000000000..617b3c576444 --- /dev/null +++ b/libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/functional/AltTabSwitchInDesktopModeTest.kt @@ -0,0 +1,27 @@ +/* + * 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.functional + +import com.android.wm.shell.scenarios.AltTabSwitchInDesktopMode +import org.junit.Ignore +import org.junit.runner.RunWith +import org.junit.runners.BlockJUnit4ClassRunner + +/* Functional test for [AltTabSwitchInDesktopMode]. */ +@RunWith(BlockJUnit4ClassRunner::class) +@Ignore("Blocked by b/392820286, include in Postsubmit, when the issue is resolved") +class AltTabSwitchInDesktopModeTest : AltTabSwitchInDesktopMode()
\ No newline at end of file diff --git a/libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/scenarios/AltTabSwitchInDesktopMode.kt b/libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/scenarios/AltTabSwitchInDesktopMode.kt new file mode 100644 index 000000000000..cf6d5a871b13 --- /dev/null +++ b/libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/scenarios/AltTabSwitchInDesktopMode.kt @@ -0,0 +1,80 @@ +/* + * 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.scenarios + +import android.app.Instrumentation +import android.tools.flicker.rules.ChangeDisplayOrientationRule +import android.tools.NavBar +import android.tools.Rotation +import android.tools.traces.parsers.WindowManagerStateHelper +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.uiautomator.UiDevice +import com.android.launcher3.tapl.LauncherInstrumentation +import com.android.server.wm.flicker.helpers.DesktopModeAppHelper +import com.android.server.wm.flicker.helpers.MailAppHelper +import com.android.server.wm.flicker.helpers.NewTasksAppHelper +import com.android.server.wm.flicker.helpers.SimpleAppHelper +import com.android.window.flags.Flags +import com.android.wm.shell.Utils +import org.junit.After +import org.junit.Assume +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test + +@Ignore("Test Base Class") +abstract class AltTabSwitchInDesktopMode(val rotation: Rotation = Rotation.ROTATION_0) { + + private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation() + private val tapl = LauncherInstrumentation() + 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) + + @Rule + @JvmField val testSetupRule = Utils.testSetupRule(NavBar.MODE_GESTURAL, rotation) + + @Before + fun setup() { + Assume.assumeTrue(Flags.enableDesktopWindowingMode() && tapl.isTablet) + tapl.setEnableRotation(true) + tapl.setExpectedRotation(rotation.value) + tapl.enableTransientTaskbar(false) + ChangeDisplayOrientationRule.setRotation(rotation) + firstApp.enterDesktopMode(wmHelper, device) + secondApp.launchViaIntent(wmHelper) + thirdApp.launchViaIntent(wmHelper) + } + + @Test + open fun switchApp() { + tapl.launchedAppState + .showQuickSwitchView() + .moveFocusForward() + .launchFocusedAppTask(firstApp.packageName) + } + + @After + fun teardown() { + thirdApp.exit(wmHelper) + secondApp.exit(wmHelper) + firstApp.exit(wmHelper) + } +}
\ No newline at end of file |