1 /* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.wm.shell.flicker.splitscreen 18 19 import android.platform.test.annotations.Presubmit 20 import android.tools.NavBar 21 import android.tools.flicker.junit.FlickerParametersRunnerFactory 22 import android.tools.flicker.legacy.FlickerBuilder 23 import android.tools.flicker.legacy.LegacyFlickerTest 24 import android.tools.flicker.legacy.LegacyFlickerTestFactory 25 import androidx.test.filters.FlakyTest 26 import androidx.test.filters.RequiresDevice 27 import com.android.wm.shell.flicker.splitscreen.benchmark.SwitchBackToSplitFromRecentBenchmark 28 import com.android.wm.shell.flicker.utils.ICommonAssertions 29 import com.android.wm.shell.flicker.utils.appWindowBecomesVisible 30 import com.android.wm.shell.flicker.utils.layerBecomesVisible 31 import com.android.wm.shell.flicker.utils.splitAppLayerBoundsIsVisibleAtEnd 32 import com.android.wm.shell.flicker.utils.splitScreenDividerBecomesVisible 33 import org.junit.FixMethodOrder 34 import org.junit.Test 35 import org.junit.runner.RunWith 36 import org.junit.runners.MethodSorters 37 import org.junit.runners.Parameterized 38 39 /** 40 * Test switch back to split pair from recent. 41 * 42 * To run this test: `atest WMShellFlickerTestsSplitScreen:SwitchBackToSplitFromRecent` 43 */ 44 @RequiresDevice 45 @RunWith(Parameterized::class) 46 @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) 47 @FixMethodOrder(MethodSorters.NAME_ASCENDING) 48 class SwitchBackToSplitFromRecent(override val flicker: LegacyFlickerTest) : 49 SwitchBackToSplitFromRecentBenchmark(flicker), ICommonAssertions { 50 override val transition: FlickerBuilder.() -> Unit <lambda>null51 get() = { 52 defaultSetup(this) 53 defaultTeardown(this) 54 thisTransition(this) 55 } 56 57 @Presubmit 58 @Test splitScreenDividerBecomesVisiblenull59 fun splitScreenDividerBecomesVisible() = flicker.splitScreenDividerBecomesVisible() 60 61 @Presubmit @Test fun primaryAppLayerBecomesVisible() = flicker.layerBecomesVisible(primaryApp) 62 63 @Presubmit 64 @Test 65 fun secondaryAppLayerBecomesVisible() = flicker.layerBecomesVisible(secondaryApp) 66 67 @Presubmit 68 @Test 69 fun primaryAppBoundsIsVisibleAtEnd() = 70 flicker.splitAppLayerBoundsIsVisibleAtEnd( 71 primaryApp, 72 landscapePosLeft = tapl.isTablet, 73 portraitPosTop = false 74 ) 75 76 @Presubmit 77 @Test 78 fun secondaryAppBoundsIsVisibleAtEnd() = 79 flicker.splitAppLayerBoundsIsVisibleAtEnd( 80 secondaryApp, 81 landscapePosLeft = !tapl.isTablet, 82 portraitPosTop = true 83 ) 84 85 @Presubmit 86 @Test 87 fun primaryAppWindowBecomesVisible() = flicker.appWindowBecomesVisible(primaryApp) 88 89 @Presubmit 90 @Test 91 fun secondaryAppWindowBecomesVisible() = flicker.appWindowBecomesVisible(secondaryApp) 92 93 /** {@inheritDoc} */ 94 @Presubmit @Test override fun entireScreenCovered() = super.entireScreenCovered() 95 96 /** {@inheritDoc} */ 97 @Presubmit 98 @Test 99 override fun navBarLayerIsVisibleAtStartAndEnd() = super.navBarLayerIsVisibleAtStartAndEnd() 100 101 /** {@inheritDoc} */ 102 @Presubmit 103 @Test 104 override fun navBarLayerPositionAtStartAndEnd() = super.navBarLayerPositionAtStartAndEnd() 105 106 /** {@inheritDoc} */ 107 @Presubmit 108 @Test 109 override fun navBarWindowIsAlwaysVisible() = super.navBarWindowIsAlwaysVisible() 110 111 /** {@inheritDoc} */ 112 @Presubmit 113 @Test 114 override fun statusBarLayerIsVisibleAtStartAndEnd() = 115 super.statusBarLayerIsVisibleAtStartAndEnd() 116 117 /** {@inheritDoc} */ 118 @Presubmit 119 @Test 120 override fun statusBarLayerPositionAtStartAndEnd() = super.statusBarLayerPositionAtStartAndEnd() 121 122 /** {@inheritDoc} */ 123 @Presubmit 124 @Test 125 override fun statusBarWindowIsAlwaysVisible() = super.statusBarWindowIsAlwaysVisible() 126 127 /** {@inheritDoc} */ 128 @Presubmit 129 @Test 130 override fun taskBarLayerIsVisibleAtStartAndEnd() = super.taskBarLayerIsVisibleAtStartAndEnd() 131 132 /** {@inheritDoc} */ 133 @Presubmit 134 @Test 135 override fun taskBarWindowIsAlwaysVisible() = super.taskBarWindowIsAlwaysVisible() 136 137 /** {@inheritDoc} */ 138 @FlakyTest 139 @Test 140 override fun visibleLayersShownMoreThanOneConsecutiveEntry() = 141 super.visibleLayersShownMoreThanOneConsecutiveEntry() 142 143 /** {@inheritDoc} */ 144 @Presubmit 145 @Test 146 override fun visibleWindowsShownMoreThanOneConsecutiveEntry() = 147 super.visibleWindowsShownMoreThanOneConsecutiveEntry() 148 149 companion object { 150 @Parameterized.Parameters(name = "{0}") 151 @JvmStatic 152 fun getParams() = 153 LegacyFlickerTestFactory.nonRotationTests( 154 // TODO(b/176061063):The 3 buttons of nav bar do not exist in the hierarchy. 155 supportedNavigationModes = listOf(NavBar.MODE_GESTURAL) 156 ) 157 } 158 } 159