Loading libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/functional/ChromeNewTabAtWindowLimitTest.kt 0 → 100644 +29 −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.functional import android.platform.test.annotations.Postsubmit import android.platform.test.rule.ScreenRecordRule import com.android.wm.shell.scenarios.ChromeNewTabAtWindowLimit import org.junit.runner.RunWith import org.junit.runners.BlockJUnit4ClassRunner /* Functional test for [ChromeNewTabAtWindowLimit]. */ @RunWith(BlockJUnit4ClassRunner::class) @Postsubmit @ScreenRecordRule.ScreenRecord class ChromeNewTabAtWindowLimitTest : ChromeNewTabAtWindowLimit() libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/scenarios/ChromeNewTabAtWindowLimit.kt 0 → 100644 +96 −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.scenarios import android.app.Instrumentation import android.tools.NavBar import android.tools.Rotation import android.tools.device.apphelpers.BrowserAppHelper import android.tools.device.apphelpers.CalculatorAppHelper import android.tools.device.apphelpers.ClockAppHelper import android.tools.flicker.rules.ChangeDisplayOrientationRule 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.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 ChromeNewTabAtWindowLimit(val rotation: Rotation = Rotation.ROTATION_0) : TestScenarioBase() { private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation() private val tapl = LauncherInstrumentation() private val wmHelper = WindowManagerStateHelper(instrumentation) private val device = UiDevice.getInstance(instrumentation) private val mailAppHelper = MailAppHelper(instrumentation) private val mailAppDesktopHelper = DesktopModeAppHelper(mailAppHelper) private val calculatorHelper = CalculatorAppHelper(instrumentation) private val clockAppHelper = ClockAppHelper() private val browserAppHelper = BrowserAppHelper(instrumentation) @Rule @JvmField val testSetupRule = Utils.testSetupRule(NavBar.MODE_GESTURAL, rotation) @Before fun setup() { Assume.assumeTrue(Flags.enableDesktopWindowingMode() && Flags.enableDesktopTaskLimitSeparateTransition() && tapl.isTablet) tapl.apply { setEnableRotation(true) setExpectedRotation(rotation.value) enableTransientTaskbar(false) } ChangeDisplayOrientationRule.setRotation(rotation) mailAppDesktopHelper.enterDesktopMode(wmHelper, device) calculatorHelper.launchViaIntent(wmHelper) clockAppHelper.launchViaIntent(wmHelper) browserAppHelper.launchViaIntent(wmHelper) browserAppHelper.closePopupsIfNeeded(device) } @Test open fun openNewTab() { tapl.launchedAppState.taskbar .getAppIcon(browserAppHelper.appName) .openDeepShortcutMenu() browserAppHelper.clickNewTabInTaskbarContextMenu() wmHelper.StateSyncBuilder() .withAppTransitionIdle() .withLayerVisible(browserAppHelper.componentMatcher) .withLayerVisible(mailAppHelper.componentMatcher) .withLayerVisible(calculatorHelper.componentMatcher) .withLayerVisible(clockAppHelper.componentMatcher) .waitForAndVerify() } @After fun teardown() { browserAppHelper.exit(wmHelper) calculatorHelper.exit(wmHelper) clockAppHelper.exit(wmHelper) mailAppHelper.exit(wmHelper) } } No newline at end of file Loading
libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/functional/ChromeNewTabAtWindowLimitTest.kt 0 → 100644 +29 −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.functional import android.platform.test.annotations.Postsubmit import android.platform.test.rule.ScreenRecordRule import com.android.wm.shell.scenarios.ChromeNewTabAtWindowLimit import org.junit.runner.RunWith import org.junit.runners.BlockJUnit4ClassRunner /* Functional test for [ChromeNewTabAtWindowLimit]. */ @RunWith(BlockJUnit4ClassRunner::class) @Postsubmit @ScreenRecordRule.ScreenRecord class ChromeNewTabAtWindowLimitTest : ChromeNewTabAtWindowLimit()
libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/scenarios/ChromeNewTabAtWindowLimit.kt 0 → 100644 +96 −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.scenarios import android.app.Instrumentation import android.tools.NavBar import android.tools.Rotation import android.tools.device.apphelpers.BrowserAppHelper import android.tools.device.apphelpers.CalculatorAppHelper import android.tools.device.apphelpers.ClockAppHelper import android.tools.flicker.rules.ChangeDisplayOrientationRule 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.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 ChromeNewTabAtWindowLimit(val rotation: Rotation = Rotation.ROTATION_0) : TestScenarioBase() { private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation() private val tapl = LauncherInstrumentation() private val wmHelper = WindowManagerStateHelper(instrumentation) private val device = UiDevice.getInstance(instrumentation) private val mailAppHelper = MailAppHelper(instrumentation) private val mailAppDesktopHelper = DesktopModeAppHelper(mailAppHelper) private val calculatorHelper = CalculatorAppHelper(instrumentation) private val clockAppHelper = ClockAppHelper() private val browserAppHelper = BrowserAppHelper(instrumentation) @Rule @JvmField val testSetupRule = Utils.testSetupRule(NavBar.MODE_GESTURAL, rotation) @Before fun setup() { Assume.assumeTrue(Flags.enableDesktopWindowingMode() && Flags.enableDesktopTaskLimitSeparateTransition() && tapl.isTablet) tapl.apply { setEnableRotation(true) setExpectedRotation(rotation.value) enableTransientTaskbar(false) } ChangeDisplayOrientationRule.setRotation(rotation) mailAppDesktopHelper.enterDesktopMode(wmHelper, device) calculatorHelper.launchViaIntent(wmHelper) clockAppHelper.launchViaIntent(wmHelper) browserAppHelper.launchViaIntent(wmHelper) browserAppHelper.closePopupsIfNeeded(device) } @Test open fun openNewTab() { tapl.launchedAppState.taskbar .getAppIcon(browserAppHelper.appName) .openDeepShortcutMenu() browserAppHelper.clickNewTabInTaskbarContextMenu() wmHelper.StateSyncBuilder() .withAppTransitionIdle() .withLayerVisible(browserAppHelper.componentMatcher) .withLayerVisible(mailAppHelper.componentMatcher) .withLayerVisible(calculatorHelper.componentMatcher) .withLayerVisible(clockAppHelper.componentMatcher) .waitForAndVerify() } @After fun teardown() { browserAppHelper.exit(wmHelper) calculatorHelper.exit(wmHelper) clockAppHelper.exit(wmHelper) mailAppHelper.exit(wmHelper) } } No newline at end of file