Use FlickerParametersRunnerFactory

JUnit4 Parameterized runner allows us to create custom UseParametersRunnerFactory classes. Flicker now uses this method for better compatibility with Flaky Failure FingerPrinting and Crystalball

Bug: 162923992
Test: atest FlickerTests
Change-Id: Iac3e9972b39fb96bf7fe85beac16728c5947766b
This commit is contained in:
Nataniel Borges
2021-02-18 22:21:14 +01:00
parent d358a9f65a
commit c39b644471
56 changed files with 3946 additions and 3700 deletions

View File

@@ -18,239 +18,92 @@ package com.android.wm.shell.flicker
import android.graphics.Region
import android.view.Surface
import com.android.server.wm.flicker.dsl.LayersAssertionBuilder
import com.android.server.wm.flicker.dsl.LayersAssertionBuilderLegacy
import com.android.server.wm.flicker.APP_PAIR_SPLIT_DIVIDER
import com.android.server.wm.flicker.DOCKED_STACK_DIVIDER
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.server.wm.flicker.traces.layers.getVisibleBounds
@JvmOverloads
fun LayersAssertionBuilder.appPairsDividerIsVisible(bugId: Int = 0) {
end("appPairsDividerIsVisible", bugId) {
fun FlickerTestParameter.appPairsDividerIsVisible() {
assertLayersEnd {
this.isVisible(APP_PAIR_SPLIT_DIVIDER)
}
}
@JvmOverloads
fun LayersAssertionBuilder.appPairsDividerIsInvisible(bugId: Int = 0) {
end("appPairsDividerIsInVisible", bugId) {
fun FlickerTestParameter.appPairsDividerIsInvisible() {
assertLayersEnd {
this.notExists(APP_PAIR_SPLIT_DIVIDER)
}
}
@JvmOverloads
fun LayersAssertionBuilder.appPairsDividerBecomesVisible(bugId: Int = 0) {
all("dividerLayerBecomesVisible", bugId) {
fun FlickerTestParameter.appPairsDividerBecomesVisible() {
assertLayers {
this.hidesLayer(DOCKED_STACK_DIVIDER)
.then()
.showsLayer(DOCKED_STACK_DIVIDER)
}
}
@JvmOverloads
fun LayersAssertionBuilder.dockedStackDividerIsVisible(bugId: Int = 0) {
end("dockedStackDividerIsVisible", bugId) {
fun FlickerTestParameter.dockedStackDividerIsVisible() {
assertLayersEnd {
this.isVisible(DOCKED_STACK_DIVIDER)
}
}
@JvmOverloads
fun LayersAssertionBuilder.dockedStackDividerBecomesVisible(bugId: Int = 0) {
all("dividerLayerBecomesVisible", bugId) {
fun FlickerTestParameter.dockedStackDividerBecomesVisible() {
assertLayers {
this.hidesLayer(DOCKED_STACK_DIVIDER)
.then()
.showsLayer(DOCKED_STACK_DIVIDER)
}
}
@JvmOverloads
fun LayersAssertionBuilder.dockedStackDividerBecomesInvisible(bugId: Int = 0) {
all("dividerLayerBecomesInvisible", bugId) {
fun FlickerTestParameter.dockedStackDividerBecomesInvisible() {
assertLayers {
this.showsLayer(DOCKED_STACK_DIVIDER)
.then()
.hidesLayer(DOCKED_STACK_DIVIDER)
}
}
@JvmOverloads
fun LayersAssertionBuilder.dockedStackDividerIsInvisible(bugId: Int = 0) {
end("dockedStackDividerIsInvisible", bugId) {
fun FlickerTestParameter.dockedStackDividerIsInvisible() {
assertLayersEnd {
this.notExists(DOCKED_STACK_DIVIDER)
}
}
@JvmOverloads
fun LayersAssertionBuilder.appPairsPrimaryBoundsIsVisible(
rotation: Int,
primaryLayerName: String,
bugId: Int = 0
) {
end("PrimaryAppBounds", bugId) {
fun FlickerTestParameter.appPairsPrimaryBoundsIsVisible(rotation: Int, primaryLayerName: String) {
assertLayersEnd {
val dividerRegion = entry.getVisibleBounds(APP_PAIR_SPLIT_DIVIDER)
this.hasVisibleRegion(primaryLayerName, getPrimaryRegion(dividerRegion, rotation))
}
}
@JvmOverloads
fun LayersAssertionBuilder.appPairsSecondaryBoundsIsVisible(
fun FlickerTestParameter.dockedStackPrimaryBoundsIsVisible(
rotation: Int,
secondaryLayerName: String,
bugId: Int = 0
primaryLayerName: String
) {
end("SecondaryAppBounds", bugId) {
val dividerRegion = entry.getVisibleBounds(APP_PAIR_SPLIT_DIVIDER)
this.hasVisibleRegion(secondaryLayerName, getSecondaryRegion(dividerRegion, rotation))
}
}
@JvmOverloads
fun LayersAssertionBuilder.dockedStackPrimaryBoundsIsVisible(
rotation: Int,
primaryLayerName: String,
bugId: Int = 0
) {
end("PrimaryAppBounds", bugId) {
assertLayersEnd {
val dividerRegion = entry.getVisibleBounds(DOCKED_STACK_DIVIDER)
this.hasVisibleRegion(primaryLayerName, getPrimaryRegion(dividerRegion, rotation))
}
}
@JvmOverloads
fun LayersAssertionBuilder.dockedStackSecondaryBoundsIsVisible(
fun FlickerTestParameter.appPairsSecondaryBoundsIsVisible(
rotation: Int,
secondaryLayerName: String,
bugId: Int = 0
secondaryLayerName: String
) {
end("SecondaryAppBounds", bugId) {
val dividerRegion = entry.getVisibleBounds(DOCKED_STACK_DIVIDER)
this.hasVisibleRegion(secondaryLayerName, getSecondaryRegion(dividerRegion, rotation))
}
}
@JvmOverloads
fun LayersAssertionBuilderLegacy.appPairsDividerIsVisible(
bugId: Int = 0,
enabled: Boolean = bugId == 0
) {
end("appPairsDividerIsVisible", bugId, enabled) {
this.isVisible(APP_PAIR_SPLIT_DIVIDER)
}
}
@JvmOverloads
fun LayersAssertionBuilderLegacy.appPairsDividerIsInvisible(
bugId: Int = 0,
enabled: Boolean = bugId == 0
) {
end("appPairsDividerIsInVisible", bugId, enabled) {
this.notExists(APP_PAIR_SPLIT_DIVIDER)
}
}
@JvmOverloads
fun LayersAssertionBuilderLegacy.appPairsDividerBecomesVisible(
bugId: Int = 0,
enabled: Boolean = bugId == 0
) {
all("dividerLayerBecomesVisible", bugId, enabled) {
this.hidesLayer(DOCKED_STACK_DIVIDER)
.then()
.showsLayer(DOCKED_STACK_DIVIDER)
}
}
@JvmOverloads
fun LayersAssertionBuilderLegacy.dockedStackDividerIsVisible(
bugId: Int = 0,
enabled: Boolean = bugId == 0
) {
end("dockedStackDividerIsVisible", bugId, enabled) {
this.isVisible(DOCKED_STACK_DIVIDER)
}
}
@JvmOverloads
fun LayersAssertionBuilderLegacy.dockedStackDividerBecomesVisible(
bugId: Int = 0,
enabled: Boolean = bugId == 0
) {
all("dividerLayerBecomesVisible", bugId, enabled) {
this.hidesLayer(DOCKED_STACK_DIVIDER)
.then()
.showsLayer(DOCKED_STACK_DIVIDER)
}
}
@JvmOverloads
fun LayersAssertionBuilderLegacy.dockedStackDividerBecomesInvisible(
bugId: Int = 0,
enabled: Boolean = bugId == 0
) {
all("dividerLayerBecomesInvisible", bugId, enabled) {
this.showsLayer(DOCKED_STACK_DIVIDER)
.then()
.hidesLayer(DOCKED_STACK_DIVIDER)
}
}
@JvmOverloads
fun LayersAssertionBuilderLegacy.dockedStackDividerIsInvisible(
bugId: Int = 0,
enabled: Boolean = bugId == 0
) {
end("dockedStackDividerIsInvisible", bugId, enabled) {
this.notExists(DOCKED_STACK_DIVIDER)
}
}
@JvmOverloads
fun LayersAssertionBuilderLegacy.appPairsPrimaryBoundsIsVisible(
rotation: Int,
primaryLayerName: String,
bugId: Int = 0,
enabled: Boolean = bugId == 0
) {
end("PrimaryAppBounds", bugId, enabled) {
val dividerRegion = entry.getVisibleBounds(APP_PAIR_SPLIT_DIVIDER)
this.hasVisibleRegion(primaryLayerName, getPrimaryRegion(dividerRegion, rotation))
}
}
@JvmOverloads
fun LayersAssertionBuilderLegacy.appPairsSecondaryBoundsIsVisible(
rotation: Int,
secondaryLayerName: String,
bugId: Int = 0,
enabled: Boolean = bugId == 0
) {
end("SecondaryAppBounds", bugId, enabled) {
assertLayersEnd {
val dividerRegion = entry.getVisibleBounds(APP_PAIR_SPLIT_DIVIDER)
this.hasVisibleRegion(secondaryLayerName, getSecondaryRegion(dividerRegion, rotation))
}
}
@JvmOverloads
fun LayersAssertionBuilderLegacy.dockedStackPrimaryBoundsIsVisible(
fun FlickerTestParameter.dockedStackSecondaryBoundsIsVisible(
rotation: Int,
primaryLayerName: String,
bugId: Int = 0,
enabled: Boolean = bugId == 0
secondaryLayerName: String
) {
end("PrimaryAppBounds", bugId, enabled) {
val dividerRegion = entry.getVisibleBounds(DOCKED_STACK_DIVIDER)
this.hasVisibleRegion(primaryLayerName, getPrimaryRegion(dividerRegion, rotation))
}
}
@JvmOverloads
fun LayersAssertionBuilderLegacy.dockedStackSecondaryBoundsIsVisible(
rotation: Int,
secondaryLayerName: String,
bugId: Int = 0,
enabled: Boolean = bugId == 0
) {
end("SecondaryAppBounds", bugId, enabled) {
assertLayersEnd {
val dividerRegion = entry.getVisibleBounds(DOCKED_STACK_DIVIDER)
this.hasVisibleRegion(secondaryLayerName, getSecondaryRegion(dividerRegion, rotation))
}
@@ -260,10 +113,10 @@ fun getPrimaryRegion(dividerRegion: Region, rotation: Int): Region {
val displayBounds = WindowUtils.getDisplayBounds(rotation)
return if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180) {
Region(0, 0, displayBounds.bounds.right,
dividerRegion.bounds.bottom - WindowUtils.dockedStackDividerInset)
dividerRegion.bounds.bottom - WindowUtils.dockedStackDividerInset)
} else {
Region(0, 0, dividerRegion.bounds.left,
dividerRegion.bounds.right - WindowUtils.dockedStackDividerInset)
dividerRegion.bounds.right - WindowUtils.dockedStackDividerInset)
}
}
@@ -271,12 +124,12 @@ fun getSecondaryRegion(dividerRegion: Region, rotation: Int): Region {
val displayBounds = WindowUtils.getDisplayBounds(rotation)
return if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180) {
Region(0,
dividerRegion.bounds.bottom - WindowUtils.dockedStackDividerInset,
displayBounds.bounds.right,
displayBounds.bounds.bottom - WindowUtils.dockedStackDividerInset)
dividerRegion.bounds.bottom - WindowUtils.dockedStackDividerInset,
displayBounds.bounds.right,
displayBounds.bounds.bottom - WindowUtils.dockedStackDividerInset)
} else {
Region(dividerRegion.bounds.right, 0,
displayBounds.bounds.right,
displayBounds.bounds.bottom - WindowUtils.dockedStackDividerInset)
displayBounds.bounds.right,
displayBounds.bounds.bottom - WindowUtils.dockedStackDividerInset)
}
}
}

View File

@@ -16,33 +16,33 @@
package com.android.wm.shell.flicker
import android.app.Instrumentation
import android.content.pm.PackageManager
import android.content.pm.PackageManager.FEATURE_LEANBACK
import android.content.pm.PackageManager.FEATURE_LEANBACK_ONLY
import android.os.RemoteException
import android.os.SystemClock
import android.platform.helpers.IAppHelper
import android.view.Surface
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.UiDevice
import com.android.server.wm.flicker.Flicker
import org.junit.Assume.assumeFalse
import org.junit.Before
import org.junit.runners.Parameterized
/**
* Base class of all Flicker test that performs common functions for all flicker tests:
*
*
* - Caches transitions so that a transition is run once and the transition results are used by
* tests multiple times. This is needed for parameterized tests which call the BeforeClass methods
* multiple times.
* - Keeps track of all test artifacts and deletes ones which do not need to be reviewed.
* - Fails tests if results are not available for any test due to jank.
*/
abstract class FlickerTestBase {
val instrumentation by lazy { InstrumentationRegistry.getInstrumentation() }
val uiDevice by lazy { UiDevice.getInstance(instrumentation) }
val packageManager: PackageManager by lazy { instrumentation.context.getPackageManager() }
abstract class FlickerTestBase(
protected val rotationName: String,
protected val rotation: Int
) {
val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
val uiDevice = UiDevice.getInstance(instrumentation)
val packageManager: PackageManager = instrumentation.context.packageManager
protected val isTelevision: Boolean by lazy {
packageManager.run {
hasSystemFeature(FEATURE_LEANBACK) || hasSystemFeature(FEATURE_LEANBACK_ONLY)
@@ -56,83 +56,12 @@ abstract class FlickerTestBase {
@Before
open fun televisionSetUp() = assumeFalse(isTelevision)
/**
* Build a test tag for the test
* @param testName Name of the transition(s) being tested
* @param app App being launcher
* @param rotation Initial screen rotation
*
* @return test tag with pattern <NAME>__<APP>__<ROTATION>
</ROTATION></APP></NAME> */
protected fun buildTestTag(testName: String, app: IAppHelper, rotation: Int): String {
return buildTestTag(
testName, app, rotation, rotation, app2 = null, extraInfo = "")
}
/**
* Build a test tag for the test
* @param testName Name of the transition(s) being tested
* @param app App being launcher
* @param beginRotation Initial screen rotation
* @param endRotation End screen rotation (if any, otherwise use same as initial)
*
* @return test tag with pattern <NAME>__<APP>__<BEGIN_ROTATION>-<END_ROTATION>
</END_ROTATION></BEGIN_ROTATION></APP></NAME> */
protected fun buildTestTag(
testName: String,
app: IAppHelper,
beginRotation: Int,
endRotation: Int
): String {
return buildTestTag(
testName, app, beginRotation, endRotation, app2 = null, extraInfo = "")
}
/**
* Build a test tag for the test
* @param testName Name of the transition(s) being tested
* @param app App being launcher
* @param app2 Second app being launched (if any)
* @param beginRotation Initial screen rotation
* @param endRotation End screen rotation (if any, otherwise use same as initial)
* @param extraInfo Additional information to append to the tag
*
* @return test tag with pattern <NAME>__<APP></APP>(S)>__<ROTATION></ROTATION>(S)>[__<EXTRA>]
</EXTRA></NAME> */
protected fun buildTestTag(
testName: String,
app: IAppHelper,
beginRotation: Int,
endRotation: Int,
app2: IAppHelper?,
extraInfo: String
): String {
var testTag = "${testName}__${app.launcherName}"
if (app2 != null) {
testTag += "-${app2.launcherName}"
}
testTag += "__${Surface.rotationToString(beginRotation)}"
if (endRotation != beginRotation) {
testTag += "-${Surface.rotationToString(endRotation)}"
}
if (extraInfo.isNotEmpty()) {
testTag += "__$extraInfo"
}
return testTag
}
protected fun Flicker.setRotation(rotation: Int) {
try {
when (rotation) {
Surface.ROTATION_270 -> device.setOrientationLeft()
Surface.ROTATION_90 -> device.setOrientationRight()
Surface.ROTATION_0 -> device.setOrientationNatural()
else -> device.setOrientationNatural()
}
// Wait for animation to complete
SystemClock.sleep(1000)
} catch (e: RemoteException) {
throw RuntimeException(e)
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<Array<Any>> {
val supportedRotations = intArrayOf(Surface.ROTATION_0, Surface.ROTATION_90)
return supportedRotations.map { arrayOf(Surface.rotationToString(it), it) }
}
}
}

View File

@@ -1,36 +0,0 @@
/*
* Copyright (C) 2020 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.view.Surface
import org.junit.runners.Parameterized
abstract class NonRotationTestBase(
protected val rotationName: String,
protected val rotation: Int
) : FlickerTestBase() {
companion object {
const val SCREENSHOT_LAYER = "RotationLayer"
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<Array<Any>> {
val supportedRotations = intArrayOf(Surface.ROTATION_0, Surface.ROTATION_90)
return supportedRotations.map { arrayOf(Surface.rotationToString(it), it) }
}
}
}

View File

@@ -18,15 +18,16 @@ package com.android.wm.shell.flicker.apppairs
import android.os.Bundle
import android.os.SystemClock
import android.platform.test.annotations.Presubmit
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerTestRunner
import com.android.server.wm.flicker.FlickerTestRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.buildTestTag
import com.android.wm.shell.flicker.helpers.AppPairsHelper
import com.android.wm.shell.flicker.appPairsDividerIsInvisible
import com.android.wm.shell.flicker.helpers.AppPairsHelper
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
@@ -41,47 +42,47 @@ import org.junit.runners.Parameterized
*/
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class AppPairsTestCannotPairNonResizeableApps(
testSpec: FlickerTestRunnerFactory.TestSpec
) : FlickerTestRunner(testSpec) {
companion object : AppPairsTransition(InstrumentationRegistry.getInstrumentation()) {
testSpec: FlickerTestParameter
) : AppPairsTransition(testSpec) {
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = {
super.transition(this, it)
transitions {
nonResizeableApp?.launchViaIntent(wmHelper)
// TODO pair apps through normal UX flow
executeShellCommand(
composePairsCommand(primaryTaskId, nonResizeableTaskId, pair = true))
SystemClock.sleep(AppPairsHelper.TIMEOUT_MS)
}
}
@Presubmit
@Test
fun appPairsDividerIsInvisible() = testSpec.appPairsDividerIsInvisible()
@Presubmit
@Test
fun onlyResizeableAppWindowVisible() {
val nonResizeableApp = nonResizeableApp
require(nonResizeableApp != null) {
"Non resizeable app not initialized"
}
testSpec.assertWmEnd {
isVisible(nonResizeableApp.defaultWindowName)
isInvisible(primaryApp.defaultWindowName)
}
}
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): List<Array<Any>> {
val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration ->
withTestName {
buildTestTag(configuration)
}
transitions {
nonResizeableApp?.launchViaIntent(wmHelper)
// TODO pair apps through normal UX flow
executeShellCommand(
composePairsCommand(primaryTaskId, nonResizeableTaskId, pair = true))
SystemClock.sleep(AppPairsHelper.TIMEOUT_MS)
}
assertions {
presubmit {
layersTrace {
appPairsDividerIsInvisible()
}
windowManagerTrace {
val nonResizeableApp = nonResizeableApp
require(nonResizeableApp != null) {
"Non resizeable app not initialized"
}
end("onlyResizeableAppWindowVisible") {
isVisible(nonResizeableApp.defaultWindowName)
isInvisible(primaryApp.defaultWindowName)
}
}
}
}
}
return FlickerTestRunnerFactory.getInstance().buildTest(instrumentation,
transition, testSpec, repetitions = AppPairsHelper.TEST_REPETITIONS)
fun getParams(): List<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests(
repetitions = AppPairsHelper.TEST_REPETITIONS)
}
}
}

View File

@@ -18,17 +18,19 @@ package com.android.wm.shell.flicker.apppairs
import android.os.Bundle
import android.os.SystemClock
import android.platform.test.annotations.Presubmit
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.APP_PAIR_SPLIT_DIVIDER
import com.android.server.wm.flicker.FlickerTestRunner
import com.android.server.wm.flicker.FlickerTestRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.buildTestTag
import com.android.server.wm.flicker.traces.layers.getVisibleBounds
import com.android.wm.shell.flicker.appPairsDividerIsVisible
import com.android.wm.shell.flicker.helpers.AppPairsHelper
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
@@ -39,52 +41,53 @@ import org.junit.runners.Parameterized
*/
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class AppPairsTestPairPrimaryAndSecondaryApps(
testSpec: FlickerTestRunnerFactory.TestSpec
) : FlickerTestRunner(testSpec) {
companion object : AppPairsTransition(InstrumentationRegistry.getInstrumentation()) {
testSpec: FlickerTestParameter
) : AppPairsTransition(testSpec) {
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = {
super.transition(this, it)
transitions {
// TODO pair apps through normal UX flow
executeShellCommand(
composePairsCommand(primaryTaskId, secondaryTaskId, pair = true))
SystemClock.sleep(AppPairsHelper.TIMEOUT_MS)
}
}
@Presubmit
@Test
fun appPairsDividerIsVisible() = testSpec.appPairsDividerIsVisible()
@Presubmit
@Test
fun bothAppWindowsVisible() {
testSpec.assertWmEnd {
isVisible(primaryApp.defaultWindowName)
isVisible(secondaryApp.defaultWindowName)
}
}
@FlakyTest
@Test
fun appsEndingBounds() {
testSpec.assertLayersEnd {
val dividerRegion = entry.getVisibleBounds(APP_PAIR_SPLIT_DIVIDER)
this.hasVisibleRegion(primaryApp.defaultWindowName,
appPairsHelper.getPrimaryBounds(dividerRegion))
.hasVisibleRegion(secondaryApp.defaultWindowName,
appPairsHelper.getSecondaryBounds(dividerRegion))
}
}
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): List<Array<Any>> {
val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration ->
withTestName {
buildTestTag(configuration)
}
transitions {
// TODO pair apps through normal UX flow
executeShellCommand(
composePairsCommand(primaryTaskId, secondaryTaskId, pair = true))
SystemClock.sleep(AppPairsHelper.TIMEOUT_MS)
}
assertions {
presubmit {
layersTrace {
appPairsDividerIsVisible()
}
windowManagerTrace {
end("bothAppWindowsVisible") {
isVisible(primaryApp.defaultWindowName)
isVisible(secondaryApp.defaultWindowName)
}
}
}
flaky {
layersTrace {
end("appsEndingBounds") {
val dividerRegion = entry.getVisibleBounds(APP_PAIR_SPLIT_DIVIDER)
this.hasVisibleRegion(primaryApp.defaultWindowName,
appPairsHelper.getPrimaryBounds(dividerRegion))
.hasVisibleRegion(secondaryApp.defaultWindowName,
appPairsHelper.getSecondaryBounds(dividerRegion))
}
}
}
}
}
return FlickerTestRunnerFactory.getInstance().buildTest(instrumentation, transition,
testSpec, repetitions = AppPairsHelper.TEST_REPETITIONS)
fun getParams(): List<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests(
repetitions = AppPairsHelper.TEST_REPETITIONS)
}
}
}

View File

@@ -18,17 +18,19 @@ package com.android.wm.shell.flicker.apppairs
import android.os.Bundle
import android.os.SystemClock
import android.platform.test.annotations.Presubmit
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.APP_PAIR_SPLIT_DIVIDER
import com.android.server.wm.flicker.FlickerTestRunner
import com.android.server.wm.flicker.FlickerTestRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.buildTestTag
import com.android.server.wm.flicker.traces.layers.getVisibleBounds
import com.android.wm.shell.flicker.appPairsDividerIsInvisible
import com.android.wm.shell.flicker.helpers.AppPairsHelper
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
@@ -39,61 +41,67 @@ import org.junit.runners.Parameterized
*/
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class AppPairsTestUnpairPrimaryAndSecondaryApps(
testSpec: FlickerTestRunnerFactory.TestSpec
) : FlickerTestRunner(testSpec) {
companion object : AppPairsTransition(InstrumentationRegistry.getInstrumentation()) {
testSpec: FlickerTestParameter
) : AppPairsTransition(testSpec) {
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = {
super.transition(this, it)
setup {
executeShellCommand(
composePairsCommand(primaryTaskId, secondaryTaskId, pair = true))
SystemClock.sleep(AppPairsHelper.TIMEOUT_MS)
}
transitions {
// TODO pair apps through normal UX flow
executeShellCommand(
composePairsCommand(primaryTaskId, secondaryTaskId, pair = false))
SystemClock.sleep(AppPairsHelper.TIMEOUT_MS)
}
}
@Presubmit
@Test
fun appPairsDividerIsInvisible() = testSpec.appPairsDividerIsInvisible()
@Presubmit
@Test
fun bothAppWindowsInvisible() {
testSpec.assertWmEnd {
isInvisible(primaryApp.defaultWindowName)
isInvisible(secondaryApp.defaultWindowName)
}
}
@FlakyTest
@Test
fun appsStartingBounds() {
testSpec.assertLayersStart {
val dividerRegion = entry.getVisibleBounds(APP_PAIR_SPLIT_DIVIDER)
hasVisibleRegion(primaryApp.defaultWindowName,
appPairsHelper.getPrimaryBounds(dividerRegion))
hasVisibleRegion(secondaryApp.defaultWindowName,
appPairsHelper.getSecondaryBounds(dividerRegion))
}
}
@FlakyTest
@Test
fun appsEndingBounds() {
testSpec.assertLayersEnd {
notExists(primaryApp.defaultWindowName)
notExists(secondaryApp.defaultWindowName)
}
}
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): List<Array<Any>> {
val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration ->
withTestName {
buildTestTag(configuration)
}
setup {
executeShellCommand(
composePairsCommand(primaryTaskId, secondaryTaskId, pair = true))
SystemClock.sleep(AppPairsHelper.TIMEOUT_MS)
}
transitions {
// TODO pair apps through normal UX flow
executeShellCommand(
composePairsCommand(primaryTaskId, secondaryTaskId, pair = false))
SystemClock.sleep(AppPairsHelper.TIMEOUT_MS)
}
assertions {
presubmit {
layersTrace {
appPairsDividerIsInvisible()
}
windowManagerTrace {
end("bothAppWindowsInvisible") {
isInvisible(primaryApp.defaultWindowName)
isInvisible(secondaryApp.defaultWindowName)
}
}
}
flaky {
layersTrace {
start("appsStartingBounds") {
val dividerRegion = entry.getVisibleBounds(APP_PAIR_SPLIT_DIVIDER)
this.hasVisibleRegion(primaryApp.defaultWindowName,
appPairsHelper.getPrimaryBounds(dividerRegion))
.hasVisibleRegion(secondaryApp.defaultWindowName,
appPairsHelper.getSecondaryBounds(dividerRegion))
}
end("appsEndingBounds") {
this.notExists(primaryApp.defaultWindowName)
.notExists(secondaryApp.defaultWindowName)
}
}
}
}
}
return FlickerTestRunnerFactory.getInstance().buildTest(instrumentation, transition,
testSpec, repetitions = AppPairsHelper.TEST_REPETITIONS)
fun getParams(): List<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests(
repetitions = AppPairsHelper.TEST_REPETITIONS)
}
}
}

View File

@@ -18,38 +18,53 @@ package com.android.wm.shell.flicker.apppairs
import android.app.Instrumentation
import android.os.Bundle
import android.platform.test.annotations.Presubmit
import android.system.helpers.ActivityHelper
import android.util.Log
import androidx.test.platform.app.InstrumentationRegistry
import com.android.compatibility.common.util.SystemUtil
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.isRotated
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
import com.android.server.wm.flicker.repetitions
import com.android.server.wm.flicker.startRotation
import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
import com.android.wm.shell.flicker.helpers.AppPairsHelper
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
import com.android.wm.shell.flicker.testapp.Components
import org.junit.Test
import java.io.IOException
open class AppPairsTransition(
protected val instrumentation: Instrumentation
) {
internal val activityHelper = ActivityHelper.getInstance()
internal val appPairsHelper = AppPairsHelper(instrumentation,
abstract class AppPairsTransition(protected val testSpec: FlickerTestParameter) {
protected val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
protected val isRotated = testSpec.config.startRotation.isRotated()
protected val activityHelper = ActivityHelper.getInstance()
protected val appPairsHelper = AppPairsHelper(instrumentation,
Components.SplitScreenActivity.LABEL,
Components.SplitScreenActivity.COMPONENT)
internal val primaryApp = SplitScreenHelper.getPrimary(instrumentation)
internal val secondaryApp = SplitScreenHelper.getSecondary(instrumentation)
internal open val nonResizeableApp: SplitScreenHelper? =
protected val primaryApp = SplitScreenHelper.getPrimary(instrumentation)
protected val secondaryApp = SplitScreenHelper.getSecondary(instrumentation)
protected open val nonResizeableApp: SplitScreenHelper? =
SplitScreenHelper.getNonResizeable(instrumentation)
internal var primaryTaskId = ""
internal var secondaryTaskId = ""
internal var nonResizeableTaskId = ""
protected var primaryTaskId = ""
protected var secondaryTaskId = ""
protected var nonResizeableTaskId = ""
@FlickerBuilderProvider
fun buildFlicker(): FlickerBuilder {
return FlickerBuilder(instrumentation).apply {
withTestName { testSpec.name }
repeat { testSpec.config.repetitions }
transition(this, testSpec.config)
}
}
internal open val transition: FlickerBuilder.(Bundle) -> Unit
get() = { configuration ->
@@ -71,20 +86,9 @@ open class AppPairsTransition(
primaryTaskId, secondaryTaskId, pair = false))
executeShellCommand(composePairsCommand(
primaryTaskId, nonResizeableTaskId, pair = false))
primaryApp.exit()
secondaryApp.exit()
nonResizeableApp?.exit()
}
}
assertions {
layersTrace {
navBarLayerIsAlwaysVisible()
statusBarLayerIsAlwaysVisible()
}
windowManagerTrace {
navBarWindowIsAlwaysVisible()
statusBarWindowIsAlwaysVisible()
primaryApp.exit(wmHelper)
secondaryApp.exit(wmHelper)
nonResizeableApp?.exit(wmHelper)
}
}
}
@@ -128,4 +132,20 @@ open class AppPairsTransition(
}
append("$primaryApp $secondaryApp")
}
@Presubmit
@Test
open fun navBarLayerIsAlwaysVisible() = testSpec.navBarLayerIsAlwaysVisible()
@Presubmit
@Test
open fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsAlwaysVisible()
@Presubmit
@Test
open fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
@Presubmit
@Test
open fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
}

View File

@@ -18,25 +18,25 @@ package com.android.wm.shell.flicker.apppairs
import android.os.Bundle
import android.os.SystemClock
import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerTestRunner
import com.android.server.wm.flicker.FlickerTestRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.endRotation
import com.android.server.wm.flicker.helpers.buildTestTag
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
import com.android.wm.shell.flicker.appPairsDividerIsVisible
import com.android.wm.shell.flicker.appPairsPrimaryBoundsIsVisible
import com.android.wm.shell.flicker.appPairsSecondaryBoundsIsVisible
import com.android.wm.shell.flicker.helpers.AppPairsHelper
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
@@ -47,57 +47,65 @@ import org.junit.runners.Parameterized
*/
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class RotateTwoLaunchedAppsInAppPairsMode(
testSpec: FlickerTestRunnerFactory.TestSpec
) : FlickerTestRunner(testSpec) {
companion object : RotateTwoLaunchedAppsTransition(
InstrumentationRegistry.getInstrumentation()) {
testSpec: FlickerTestParameter
) : RotateTwoLaunchedAppsTransition(testSpec) {
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = {
super.transition(this, it)
transitions {
executeShellCommand(composePairsCommand(
primaryTaskId, secondaryTaskId, true /* pair */))
SystemClock.sleep(AppPairsHelper.TIMEOUT_MS)
setRotation(testSpec.config.endRotation)
}
}
@Presubmit
@Test
fun bothAppWindowsVisible() {
testSpec.assertWmEnd {
isVisible(primaryApp.defaultWindowName)
.isVisible(secondaryApp.defaultWindowName)
}
}
@FlakyTest
@Test
fun appPairsDividerIsVisible() = testSpec.appPairsDividerIsVisible()
@FlakyTest
@Test
fun navBarLayerRotatesAndScales() = testSpec.navBarLayerRotatesAndScales(Surface.ROTATION_0,
testSpec.config.endRotation)
@FlakyTest
@Test
fun statusBarLayerRotatesScales() = testSpec.statusBarLayerRotatesScales(Surface.ROTATION_0,
testSpec.config.endRotation)
@FlakyTest(bugId = 172776659)
@Test
fun appPairsPrimaryBoundsIsVisible() =
testSpec.appPairsPrimaryBoundsIsVisible(testSpec.config.endRotation,
primaryApp.defaultWindowName)
@FlakyTest(bugId = 172776659)
@Test
fun appPairsSecondaryBoundsIsVisible() =
testSpec.appPairsSecondaryBoundsIsVisible(testSpec.config.endRotation,
secondaryApp.defaultWindowName)
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<Array<Any>> {
val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration ->
withTestName {
buildTestTag(configuration)
}
transitions {
executeShellCommand(composePairsCommand(
primaryTaskId, secondaryTaskId, true /* pair */))
SystemClock.sleep(AppPairsHelper.TIMEOUT_MS)
setRotation(configuration.endRotation)
}
assertions {
presubmit {
windowManagerTrace {
navBarWindowIsAlwaysVisible()
statusBarWindowIsAlwaysVisible()
end("bothAppWindowsVisible") {
isVisible(primaryApp.defaultWindowName)
.isVisible(secondaryApp.defaultWindowName)
}
}
}
flaky {
layersTrace {
appPairsDividerIsVisible()
navBarLayerRotatesAndScales(Surface.ROTATION_0,
configuration.endRotation)
statusBarLayerRotatesScales(Surface.ROTATION_0,
configuration.endRotation)
appPairsPrimaryBoundsIsVisible(configuration.endRotation,
primaryApp.defaultWindowName, bugId = 172776659)
appPairsSecondaryBoundsIsVisible(configuration.endRotation,
secondaryApp.defaultWindowName, bugId = 172776659)
}
}
}
}
return FlickerTestRunnerFactory.getInstance().buildTest(instrumentation,
transition, testSpec,
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests(
repetitions = SplitScreenHelper.TEST_REPETITIONS,
supportedRotations = listOf(Surface.ROTATION_90, Surface.ROTATION_270))
supportedRotations = listOf(Surface.ROTATION_90, Surface.ROTATION_270)
)
}
}
}

View File

@@ -20,18 +20,16 @@ import android.os.Bundle
import android.os.SystemClock
import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerTestRunner
import com.android.server.wm.flicker.FlickerTestRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.endRotation
import com.android.server.wm.flicker.helpers.buildTestTag
import com.android.server.wm.flicker.helpers.isRotated
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
import com.android.server.wm.flicker.startRotation
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
import com.android.wm.shell.flicker.appPairsDividerIsVisible
@@ -39,7 +37,9 @@ import com.android.wm.shell.flicker.appPairsPrimaryBoundsIsVisible
import com.android.wm.shell.flicker.appPairsSecondaryBoundsIsVisible
import com.android.wm.shell.flicker.helpers.AppPairsHelper
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
import org.junit.Assume
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
@@ -48,70 +48,84 @@ import org.junit.runners.Parameterized
* Test open apps to app pairs and rotate.
* To run this test: `atest WMShellFlickerTests:RotateTwoLaunchedAppsRotateAndEnterAppPairsMode`
*/
@Presubmit
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class RotateTwoLaunchedAppsRotateAndEnterAppPairsMode(
testSpec: FlickerTestRunnerFactory.TestSpec
) : FlickerTestRunner(testSpec) {
companion object : RotateTwoLaunchedAppsTransition(
InstrumentationRegistry.getInstrumentation()) {
testSpec: FlickerTestParameter
) : RotateTwoLaunchedAppsTransition(testSpec) {
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = {
super.transition(this, it)
transitions {
this.setRotation(testSpec.config.endRotation)
executeShellCommand(
composePairsCommand(primaryTaskId, secondaryTaskId, pair = true))
SystemClock.sleep(AppPairsHelper.TIMEOUT_MS)
}
}
@Presubmit
@Test
fun statusBarLayerRotatesScales() = testSpec.statusBarLayerRotatesScales(Surface.ROTATION_0,
testSpec.config.endRotation)
@Presubmit
@Test
fun appPairsDividerIsVisible() = testSpec.appPairsDividerIsVisible()
@Presubmit
@Test
fun navBarLayerRotatesAndScales() {
Assume.assumeFalse(isRotated)
testSpec.navBarLayerRotatesAndScales(Surface.ROTATION_0, testSpec.config.endRotation)
}
@FlakyTest
@Test
fun navBarLayerRotatesAndScales_Flaky() {
Assume.assumeTrue(isRotated)
testSpec.navBarLayerRotatesAndScales(Surface.ROTATION_0, testSpec.config.endRotation)
}
@Presubmit
@Test
override fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
@Presubmit
@Test
override fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun bothAppWindowsVisible() {
testSpec.assertWmEnd {
isVisible(primaryApp.defaultWindowName)
isVisible(secondaryApp.defaultWindowName)
}
}
@FlakyTest(bugId = 172776659)
@Test
fun appPairsPrimaryBoundsIsVisible() =
testSpec.appPairsPrimaryBoundsIsVisible(testSpec.config.endRotation,
primaryApp.defaultWindowName)
@FlakyTest(bugId = 172776659)
@Test
fun appPairsSecondaryBoundsIsVisible() =
testSpec.appPairsSecondaryBoundsIsVisible(testSpec.config.endRotation,
secondaryApp.defaultWindowName)
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<Array<Any>> {
val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration ->
withTestName {
buildTestTag(configuration)
}
transitions {
this.setRotation(configuration.endRotation)
executeShellCommand(
composePairsCommand(primaryTaskId, secondaryTaskId, pair = true))
SystemClock.sleep(AppPairsHelper.TIMEOUT_MS)
}
assertions {
val isRotated = configuration.startRotation.isRotated()
presubmit {
layersTrace {
statusBarLayerRotatesScales(Surface.ROTATION_0,
configuration.endRotation)
appPairsDividerIsVisible()
if (!isRotated) {
navBarLayerRotatesAndScales(Surface.ROTATION_0,
configuration.endRotation)
}
}
windowManagerTrace {
navBarWindowIsAlwaysVisible()
statusBarWindowIsAlwaysVisible()
end("bothAppWindowsVisible") {
isVisible(primaryApp.defaultWindowName)
isVisible(secondaryApp.defaultWindowName)
}
}
}
flaky {
layersTrace {
appPairsPrimaryBoundsIsVisible(configuration.endRotation,
primaryApp.defaultWindowName, 172776659)
appPairsSecondaryBoundsIsVisible(configuration.endRotation,
secondaryApp.defaultWindowName, 172776659)
if (isRotated) {
navBarLayerRotatesAndScales(Surface.ROTATION_0,
configuration.endRotation)
}
}
}
}
}
return FlickerTestRunnerFactory.getInstance().buildTest(instrumentation,
transition, testSpec,
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests(
repetitions = SplitScreenHelper.TEST_REPETITIONS,
supportedRotations = listOf(Surface.ROTATION_90, Surface.ROTATION_270)
)
}
}
}
}

View File

@@ -16,17 +16,17 @@
package com.android.wm.shell.flicker.apppairs
import android.app.Instrumentation
import android.os.Bundle
import android.view.Surface
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
open class RotateTwoLaunchedAppsTransition(
instrumentation: Instrumentation
) : AppPairsTransition(instrumentation) {
abstract class RotateTwoLaunchedAppsTransition(
testSpec: FlickerTestParameter
) : AppPairsTransition(testSpec) {
override val nonResizeableApp: SplitScreenHelper?
get() = null
@@ -45,8 +45,8 @@ open class RotateTwoLaunchedAppsTransition(
eachRun {
executeShellCommand(composePairsCommand(
primaryTaskId, secondaryTaskId, pair = false))
primaryApp.exit()
secondaryApp.exit()
primaryApp.exit(wmHelper)
secondaryApp.exit(wmHelper)
}
}
}

View File

@@ -19,13 +19,13 @@ package com.android.wm.shell.flicker.legacysplitscreen
import android.os.Bundle
import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerTestRunner
import com.android.server.wm.flicker.FlickerTestRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.WALLPAPER_TITLE
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.buildTestTag
import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
import com.android.server.wm.flicker.startRotation
@@ -36,6 +36,7 @@ import com.android.wm.shell.flicker.dockedStackDividerBecomesVisible
import com.android.wm.shell.flicker.dockedStackPrimaryBoundsIsVisible
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
@@ -47,56 +48,74 @@ import org.junit.runners.Parameterized
@Presubmit
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
// @FlakyTest(bugId = 179116910)
class EnterSplitScreenDockActivity(
testSpec: FlickerTestRunnerFactory.TestSpec
) : FlickerTestRunner(testSpec) {
companion object : LegacySplitScreenTransition(InstrumentationRegistry.getInstrumentation()) {
testSpec: FlickerTestParameter
) : LegacySplitScreenTransition(testSpec) {
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = { configuration ->
super.transition(this, configuration)
transitions {
device.launchSplitScreen(wmHelper)
}
}
@FlakyTest(bugId = 169271943)
@Test
fun dockedStackPrimaryBoundsIsVisible() =
testSpec.dockedStackPrimaryBoundsIsVisible(testSpec.config.startRotation,
splitScreenApp.defaultWindowName)
@Presubmit
@Test
fun dockedStackDividerBecomesVisible() = testSpec.dockedStackDividerBecomesVisible()
@FlakyTest(bugId = 178531736)
@Test
// b/178531736
fun visibleLayersShownMoreThanOneConsecutiveEntry() =
testSpec.visibleLayersShownMoreThanOneConsecutiveEntry(
listOf(LAUNCHER_PACKAGE_NAME,
WALLPAPER_TITLE, LIVE_WALLPAPER_PACKAGE_NAME,
splitScreenApp.defaultWindowName)
)
@Presubmit
@Test
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
@FlakyTest(bugId = 178531736)
@Test
// b/178531736
fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry(
listOf(LAUNCHER_PACKAGE_NAME,
WALLPAPER_TITLE, LIVE_WALLPAPER_PACKAGE_NAME,
splitScreenApp.defaultWindowName)
)
@Presubmit
@Test
fun appWindowIsVisible() {
testSpec.assertWmEnd {
isVisible(splitScreenApp.defaultWindowName)
}
}
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<Array<Any>> {
val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration ->
withTestName {
buildTestTag("testLegacySplitScreenDockActivity", configuration)
}
repeat { SplitScreenHelper.TEST_REPETITIONS }
transitions {
device.launchSplitScreen(wmHelper)
}
assertions {
layersTrace {
dockedStackPrimaryBoundsIsVisible(
configuration.startRotation,
splitScreenApp.defaultWindowName, bugId = 169271943)
dockedStackDividerBecomesVisible()
visibleLayersShownMoreThanOneConsecutiveEntry(
listOf(LAUNCHER_PACKAGE_NAME,
WALLPAPER_TITLE, LIVE_WALLPAPER_PACKAGE_NAME,
splitScreenApp.defaultWindowName),
bugId = 178531736
)
}
windowManagerTrace {
navBarWindowIsAlwaysVisible()
statusBarWindowIsAlwaysVisible()
visibleWindowsShownMoreThanOneConsecutiveEntry(
listOf(LAUNCHER_PACKAGE_NAME,
WALLPAPER_TITLE, LIVE_WALLPAPER_PACKAGE_NAME,
splitScreenApp.defaultWindowName),
bugId = 178531736
)
end("appWindowIsVisible") {
isVisible(splitScreenApp.defaultWindowName)
}
}
}
}
return FlickerTestRunnerFactory.getInstance().buildTest(
instrumentation, defaultTransitionSetup, testSpec,
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests(
repetitions = SplitScreenHelper.TEST_REPETITIONS,
supportedRotations = listOf(Surface.ROTATION_0) // bugId = 179116910
)
}
}
}
}

View File

@@ -19,13 +19,13 @@ package com.android.wm.shell.flicker.legacysplitscreen
import android.os.Bundle
import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerTestRunner
import com.android.server.wm.flicker.FlickerTestRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.appWindowBecomesVisible
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.buildTestTag
import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.flicker.helpers.reopenAppFromOverview
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
@@ -38,6 +38,7 @@ import com.android.wm.shell.flicker.dockedStackPrimaryBoundsIsVisible
import com.android.wm.shell.flicker.dockedStackSecondaryBoundsIsVisible
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
@@ -46,61 +47,79 @@ import org.junit.runners.Parameterized
* Test open activity to primary split screen and dock secondary activity to side
* To run this test: `atest WMShellFlickerTests:EnterSplitScreenLaunchToSide`
*/
@Presubmit
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class EnterSplitScreenLaunchToSide(
testSpec: FlickerTestRunnerFactory.TestSpec
) : FlickerTestRunner(testSpec) {
companion object : LegacySplitScreenTransition(InstrumentationRegistry.getInstrumentation()) {
testSpec: FlickerTestParameter
) : LegacySplitScreenTransition(testSpec) {
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = { configuration ->
super.transition(this, configuration)
transitions {
device.launchSplitScreen(wmHelper)
device.reopenAppFromOverview(wmHelper)
}
}
@FlakyTest(bugId = 169271943)
@Test
fun dockedStackPrimaryBoundsIsVisible() =
testSpec.dockedStackPrimaryBoundsIsVisible(testSpec.config.startRotation,
splitScreenApp.defaultWindowName)
@FlakyTest(bugId = 169271943)
@Test
fun dockedStackSecondaryBoundsIsVisible() =
testSpec.dockedStackSecondaryBoundsIsVisible(testSpec.config.startRotation,
secondaryApp.defaultWindowName)
@Presubmit
@Test
// b/169271943
fun dockedStackDividerBecomesVisible() = testSpec.dockedStackDividerBecomesVisible()
@FlakyTest(bugId = 178447631)
@Test
// TODO(b/178447631) Remove Splash Screen from white list when flicker lib
// add a wait for splash screen be gone
fun visibleLayersShownMoreThanOneConsecutiveEntry() =
testSpec.visibleLayersShownMoreThanOneConsecutiveEntry(
listOf(LAUNCHER_PACKAGE_NAME, SPLASH_SCREEN_NAME,
splitScreenApp.defaultWindowName,
secondaryApp.defaultWindowName)
)
@Presubmit
@Test
fun appWindowBecomesVisible() = testSpec.appWindowBecomesVisible(secondaryApp.defaultWindowName)
@Presubmit
@Test
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry(
listOf(LAUNCHER_PACKAGE_NAME, SPLASH_SCREEN_NAME,
splitScreenApp.defaultWindowName,
secondaryApp.defaultWindowName)
)
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<Array<Any>> {
val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration ->
withTestName {
buildTestTag("testLegacySplitScreenLaunchToSide", configuration)
}
repeat { SplitScreenHelper.TEST_REPETITIONS }
transitions {
device.launchSplitScreen(wmHelper)
device.reopenAppFromOverview(wmHelper)
}
assertions {
layersTrace {
dockedStackPrimaryBoundsIsVisible(
configuration.startRotation,
splitScreenApp.defaultWindowName, bugId = 169271943)
dockedStackSecondaryBoundsIsVisible(
configuration.startRotation,
secondaryApp.defaultWindowName, bugId = 169271943)
dockedStackDividerBecomesVisible()
// TODO(b/178447631) Remove Splash Screen from white list when flicker lib
// add a wait for splash screen be gone
visibleLayersShownMoreThanOneConsecutiveEntry(
listOf(LAUNCHER_PACKAGE_NAME, SPLASH_SCREEN_NAME,
splitScreenApp.defaultWindowName,
secondaryApp.defaultWindowName),
bugId = 178447631
)
}
windowManagerTrace {
appWindowBecomesVisible(secondaryApp.defaultWindowName)
navBarWindowIsAlwaysVisible()
statusBarWindowIsAlwaysVisible()
visibleWindowsShownMoreThanOneConsecutiveEntry(
listOf(LAUNCHER_PACKAGE_NAME, SPLASH_SCREEN_NAME,
splitScreenApp.defaultWindowName,
secondaryApp.defaultWindowName)
)
}
}
}
return FlickerTestRunnerFactory.getInstance().buildTest(
instrumentation, defaultTransitionSetup, testSpec,
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests(
repetitions = SplitScreenHelper.TEST_REPETITIONS,
supportedRotations = listOf(Surface.ROTATION_0) // bugId = 175687842
)
}
}
}
}

View File

@@ -17,16 +17,14 @@
package com.android.wm.shell.flicker.legacysplitscreen
import android.os.Bundle
import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerTestRunner
import com.android.server.wm.flicker.FlickerTestRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.WALLPAPER_TITLE
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.buildTestTag
import com.android.server.wm.flicker.helpers.canSplitScreen
import com.android.server.wm.flicker.helpers.openQuickstep
import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry
@@ -35,6 +33,7 @@ import com.android.wm.shell.flicker.dockedStackDividerIsInvisible
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
import org.junit.Assert
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
@@ -43,64 +42,68 @@ import org.junit.runners.Parameterized
* Test open non-resizable activity will auto exit split screen mode
* To run this test: `atest WMShellFlickerTests:EnterSplitScreenNonResizableNotDock`
*/
@Presubmit
@RequiresDevice
@RunWith(Parameterized::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FlakyTest(bugId = 173875043)
class EnterSplitScreenNonResizableNotDock(
testSpec: FlickerTestRunnerFactory.TestSpec
) : FlickerTestRunner(testSpec) {
companion object : LegacySplitScreenTransition(InstrumentationRegistry.getInstrumentation()) {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<Array<Any>> {
val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration ->
withTestName {
buildTestTag("testLegacySplitScreenNonResizeableActivityNotDock", configuration)
}
repeat { SplitScreenHelper.TEST_REPETITIONS }
teardown {
eachRun {
nonResizeableApp.exit(wmHelper)
}
}
transitions {
nonResizeableApp.launchViaIntent(wmHelper)
device.openQuickstep(wmHelper)
if (device.canSplitScreen(wmHelper)) {
Assert.fail("Non-resizeable app should not enter split screen")
}
}
assertions {
layersTrace {
dockedStackDividerIsInvisible()
visibleLayersShownMoreThanOneConsecutiveEntry(
listOf(LAUNCHER_PACKAGE_NAME,
SPLASH_SCREEN_NAME,
nonResizeableApp.defaultWindowName,
splitScreenApp.defaultWindowName),
bugId = 178447631
)
}
windowManagerTrace {
visibleWindowsShownMoreThanOneConsecutiveEntry(
listOf(WALLPAPER_TITLE,
LAUNCHER_PACKAGE_NAME,
SPLASH_SCREEN_NAME,
nonResizeableApp.defaultWindowName,
splitScreenApp.defaultWindowName)
)
end("appWindowIsVisible") {
isInvisible(nonResizeableApp.defaultWindowName)
}
}
testSpec: FlickerTestParameter
) : LegacySplitScreenTransition(testSpec) {
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = { configuration ->
super.transition(this, configuration)
teardown {
eachRun {
nonResizeableApp.exit(wmHelper)
}
}
return FlickerTestRunnerFactory.getInstance().buildTest(
instrumentation, cleanSetup, testSpec,
transitions {
nonResizeableApp.launchViaIntent(wmHelper)
device.openQuickstep(wmHelper)
if (device.canSplitScreen(wmHelper)) {
Assert.fail("Non-resizeable app should not enter split screen")
}
}
}
@Test
fun dockedStackDividerIsInvisible() = testSpec.dockedStackDividerIsInvisible()
@FlakyTest(bugId = 178447631)
@Test
fun visibleLayersShownMoreThanOneConsecutiveEntry() =
testSpec.visibleLayersShownMoreThanOneConsecutiveEntry(
listOf(LAUNCHER_PACKAGE_NAME,
SPLASH_SCREEN_NAME,
nonResizeableApp.defaultWindowName,
splitScreenApp.defaultWindowName)
)
@Test
fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry(
listOf(WALLPAPER_TITLE,
LAUNCHER_PACKAGE_NAME,
SPLASH_SCREEN_NAME,
nonResizeableApp.defaultWindowName,
splitScreenApp.defaultWindowName)
)
@Test
fun appWindowIsVisible() {
testSpec.assertWmEnd {
isInvisible(nonResizeableApp.defaultWindowName)
}
}
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests(
repetitions = SplitScreenHelper.TEST_REPETITIONS,
supportedRotations = listOf(Surface.ROTATION_0 /* bugId = 178685668 */))
supportedRotations = listOf(Surface.ROTATION_0)) // b/178685668
}
}
}

View File

@@ -19,14 +19,14 @@ package com.android.wm.shell.flicker.legacysplitscreen
import android.os.Bundle
import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.DOCKED_STACK_DIVIDER
import com.android.server.wm.flicker.FlickerTestRunner
import com.android.server.wm.flicker.FlickerTestRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.appWindowBecomesInVisible
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.buildTestTag
import com.android.server.wm.flicker.helpers.exitSplitScreenFromBottom
import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.flicker.layerBecomesInvisible
@@ -36,6 +36,7 @@ import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEnt
import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
@@ -44,61 +45,72 @@ import org.junit.runners.Parameterized
* Test open resizeable activity split in primary, and drag divider to bottom exit split screen
* To run this test: `atest WMShellFlickerTests:ExitLegacySplitScreenFromBottom`
*/
@Presubmit
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class ExitLegacySplitScreenFromBottom(
testSpec: FlickerTestRunnerFactory.TestSpec
) : FlickerTestRunner(testSpec) {
companion object : LegacySplitScreenTransition(InstrumentationRegistry.getInstrumentation()) {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<Array<Any>> {
val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration ->
withTestName {
buildTestTag("testExitLegacySplitScreenFromBottom", configuration)
}
repeat { SplitScreenHelper.TEST_REPETITIONS }
setup {
eachRun {
splitScreenApp.launchViaIntent(wmHelper)
device.launchSplitScreen(wmHelper)
}
}
teardown {
eachRun {
splitScreenApp.exit(wmHelper)
}
}
transitions {
device.exitSplitScreenFromBottom()
}
assertions {
layersTrace {
layerBecomesInvisible(DOCKED_STACK_DIVIDER)
visibleLayersShownMoreThanOneConsecutiveEntry(
listOf(LAUNCHER_PACKAGE_NAME, splitScreenApp.defaultWindowName,
secondaryApp.defaultWindowName),
bugId = 178447631
)
}
windowManagerTrace {
appWindowBecomesInVisible(secondaryApp.defaultWindowName)
navBarWindowIsAlwaysVisible()
statusBarWindowIsAlwaysVisible()
visibleWindowsShownMoreThanOneConsecutiveEntry(
listOf(LAUNCHER_PACKAGE_NAME, splitScreenApp.defaultWindowName,
secondaryApp.defaultWindowName),
bugId = 178447631
)
}
testSpec: FlickerTestParameter
) : LegacySplitScreenTransition(testSpec) {
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = { configuration ->
super.transition(this, configuration)
setup {
eachRun {
splitScreenApp.launchViaIntent(wmHelper)
device.launchSplitScreen(wmHelper)
}
}
return FlickerTestRunnerFactory.getInstance().buildTest(
instrumentation, defaultTransitionSetup, testSpec,
teardown {
eachRun {
splitScreenApp.exit(wmHelper)
}
}
transitions {
device.exitSplitScreenFromBottom()
}
}
@Presubmit
@Test
fun layerBecomesInvisible() = testSpec.layerBecomesInvisible(DOCKED_STACK_DIVIDER)
@FlakyTest(bugId = 178447631)
@Test
fun visibleLayersShownMoreThanOneConsecutiveEntry() =
testSpec.visibleLayersShownMoreThanOneConsecutiveEntry(
listOf(LAUNCHER_PACKAGE_NAME, splitScreenApp.defaultWindowName,
secondaryApp.defaultWindowName)
)
@Presubmit
@Test
fun appWindowBecomesInVisible() =
testSpec.appWindowBecomesInVisible(secondaryApp.defaultWindowName)
@Presubmit
@Test
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
@FlakyTest(bugId = 178447631)
@Test
fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry(
listOf(LAUNCHER_PACKAGE_NAME, splitScreenApp.defaultWindowName,
secondaryApp.defaultWindowName)
)
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests(
repetitions = SplitScreenHelper.TEST_REPETITIONS,
supportedRotations = listOf(Surface.ROTATION_0) // bugId = 175687842
supportedRotations = listOf(Surface.ROTATION_0) // b/175687842
)
}
}

View File

@@ -17,14 +17,15 @@
package com.android.wm.shell.flicker.legacysplitscreen
import android.os.Bundle
import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerTestRunner
import com.android.server.wm.flicker.FlickerTestRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.appWindowBecomesInVisible
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.buildTestTag
import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.flicker.helpers.reopenAppFromOverview
import com.android.server.wm.flicker.layerBecomesInvisible
@@ -35,6 +36,7 @@ import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEn
import com.android.wm.shell.flicker.dockedStackDividerIsInvisible
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
@@ -46,56 +48,71 @@ import org.junit.runners.Parameterized
*/
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class ExitPrimarySplitScreenShowSecondaryFullscreen(
testSpec: FlickerTestRunnerFactory.TestSpec
) : FlickerTestRunner(testSpec) {
companion object : LegacySplitScreenTransition(InstrumentationRegistry.getInstrumentation()) {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<Array<Any>> {
val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration ->
withTestName {
buildTestTag("testExitPrimarySplitScreenShowSecondaryFullscreen", configuration)
}
repeat { SplitScreenHelper.TEST_REPETITIONS }
teardown {
eachRun {
secondaryApp.exit(wmHelper)
}
}
transitions {
splitScreenApp.launchViaIntent(wmHelper)
secondaryApp.launchViaIntent(wmHelper)
device.launchSplitScreen(wmHelper)
device.reopenAppFromOverview(wmHelper)
// TODO(b/175687842) Can not find Split screen divider, use exit() instead
splitScreenApp.exit(wmHelper)
}
assertions {
layersTrace {
dockedStackDividerIsInvisible(bugId = 175687842)
layerBecomesInvisible(splitScreenApp.defaultWindowName)
visibleLayersShownMoreThanOneConsecutiveEntry(
listOf(LAUNCHER_PACKAGE_NAME, splitScreenApp.defaultWindowName,
secondaryApp.defaultWindowName),
bugId = 178447631
)
}
windowManagerTrace {
appWindowBecomesInVisible(splitScreenApp.defaultWindowName)
navBarWindowIsAlwaysVisible()
statusBarWindowIsAlwaysVisible()
visibleWindowsShownMoreThanOneConsecutiveEntry(
listOf(LAUNCHER_PACKAGE_NAME, splitScreenApp.defaultWindowName,
secondaryApp.defaultWindowName),
bugId = 178447631
)
}
testSpec: FlickerTestParameter
) : LegacySplitScreenTransition(testSpec) {
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = { configuration ->
super.transition(this, configuration)
teardown {
eachRun {
secondaryApp.exit(wmHelper)
}
}
return FlickerTestRunnerFactory.getInstance().buildTest(
instrumentation, defaultTransitionSetup, testSpec,
transitions {
splitScreenApp.launchViaIntent(wmHelper)
secondaryApp.launchViaIntent(wmHelper)
device.launchSplitScreen(wmHelper)
device.reopenAppFromOverview(wmHelper)
// TODO(b/175687842) Can not find Split screen divider, use exit() instead
splitScreenApp.exit(wmHelper)
}
}
@FlakyTest(bugId = 175687842)
@Test
fun dockedStackDividerIsInvisible() = testSpec.dockedStackDividerIsInvisible()
@Presubmit
@Test
fun layerBecomesInvisible() = testSpec.layerBecomesInvisible(splitScreenApp.defaultWindowName)
@FlakyTest(bugId = 178447631)
@Test
fun visibleLayersShownMoreThanOneConsecutiveEntry() =
testSpec.visibleLayersShownMoreThanOneConsecutiveEntry(
listOf(LAUNCHER_PACKAGE_NAME, splitScreenApp.defaultWindowName,
secondaryApp.defaultWindowName)
)
@Presubmit
@Test
fun appWindowBecomesInVisible() =
testSpec.appWindowBecomesInVisible(splitScreenApp.defaultWindowName)
@Presubmit
@Test
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
@FlakyTest(bugId = 178447631)
@Test
fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry(
listOf(LAUNCHER_PACKAGE_NAME, splitScreenApp.defaultWindowName,
secondaryApp.defaultWindowName)
)
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests(
repetitions = SplitScreenHelper.TEST_REPETITIONS,
supportedRotations = listOf(Surface.ROTATION_0) // bugId = 179116910
)

View File

@@ -0,0 +1,48 @@
/*
* Copyright (C) 2021 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.legacysplitscreen
import android.os.Bundle
import android.view.Surface
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.openQuickStepAndClearRecentAppsFromOverview
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
abstract class LegacySplitScreenRotateTransition(
testSpec: FlickerTestParameter
) : LegacySplitScreenTransition(testSpec) {
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = {
setup {
eachRun {
device.wakeUpAndGoToHomeScreen()
device.openQuickStepAndClearRecentAppsFromOverview(wmHelper)
secondaryApp.launchViaIntent(wmHelper)
splitScreenApp.launchViaIntent(wmHelper)
}
}
teardown {
eachRun {
splitScreenApp.exit(wmHelper)
secondaryApp.exit(wmHelper)
this.setRotation(Surface.ROTATION_0)
}
}
}
}

View File

@@ -16,18 +16,19 @@
package com.android.wm.shell.flicker.legacysplitscreen
import android.os.Bundle
import android.platform.test.annotations.Presubmit
import android.support.test.launcherhelper.LauncherStrategyFactory
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerTestRunner
import com.android.server.wm.flicker.FlickerTestRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.endRotation
import com.android.server.wm.flicker.focusDoesNotChange
import com.android.server.wm.flicker.helpers.buildTestTag
import com.android.server.wm.flicker.helpers.exitSplitScreen
import com.android.server.wm.flicker.helpers.isInSplitScreen
import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.flicker.helpers.openQuickStepAndClearRecentAppsFromOverview
import com.android.server.wm.flicker.helpers.setRotation
@@ -39,13 +40,13 @@ import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEnt
import com.android.server.wm.flicker.layerBecomesInvisible
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
import com.android.server.wm.flicker.noUncoveredRegions
import com.android.server.wm.flicker.repetitions
import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
import com.android.wm.shell.flicker.dockedStackDividerBecomesInvisible
import com.android.wm.shell.flicker.helpers.SimpleAppHelper
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
@@ -54,80 +55,100 @@ import org.junit.runners.Parameterized
* Test open app to split screen.
* To run this test: `atest WMShellFlickerTests:LegacySplitScreenToLauncher`
*/
@Presubmit
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class LegacySplitScreenToLauncher(
testSpec: FlickerTestRunnerFactory.TestSpec
) : FlickerTestRunner(testSpec) {
testSpec: FlickerTestParameter
) : LegacySplitScreenTransition(testSpec) {
private val launcherPackageName = LauncherStrategyFactory.getInstance(instrumentation)
.launcherStrategy.supportedLauncherPackage
private val testApp = SimpleAppHelper(instrumentation)
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = { configuration ->
setup {
test {
device.wakeUpAndGoToHomeScreen()
device.openQuickStepAndClearRecentAppsFromOverview(wmHelper)
}
eachRun {
testApp.launchViaIntent(wmHelper)
this.setRotation(configuration.endRotation)
device.launchSplitScreen(wmHelper)
device.waitForIdle()
}
}
teardown {
eachRun {
testApp.exit(wmHelper)
}
}
transitions {
device.exitSplitScreen()
}
}
@Presubmit
@Test
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry()
@Presubmit
@Test
fun navBarLayerIsAlwaysVisible() = testSpec.navBarLayerIsAlwaysVisible()
@Presubmit
@Test
fun noUncoveredRegions() = testSpec.noUncoveredRegions(testSpec.config.endRotation)
@Presubmit
@Test
fun navBarLayerRotatesAndScales() =
testSpec.navBarLayerRotatesAndScales(testSpec.config.endRotation)
@Presubmit
@Test
fun statusBarLayerRotatesScales() =
testSpec.statusBarLayerRotatesScales(testSpec.config.endRotation)
@Presubmit
@Test
fun visibleLayersShownMoreThanOneConsecutiveEntry() =
testSpec.visibleLayersShownMoreThanOneConsecutiveEntry(listOf(launcherPackageName))
@Presubmit
@Test
fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsAlwaysVisible()
@Presubmit
@Test
fun dockedStackDividerBecomesInvisible() = testSpec.dockedStackDividerBecomesInvisible()
@Presubmit
@Test
fun layerBecomesInvisible() = testSpec.layerBecomesInvisible(testApp.getPackage())
@FlakyTest(bugId = 151179149)
@Test
fun focusDoesNotChange() = testSpec.focusDoesNotChange()
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<Array<Any>> {
val instrumentation = InstrumentationRegistry.getInstrumentation()
val launcherPackageName = LauncherStrategyFactory.getInstance(instrumentation)
.launcherStrategy.supportedLauncherPackage
val testApp = SimpleAppHelper(instrumentation)
fun getParams(): Collection<FlickerTestParameter> {
// b/161435597 causes the test not to work on 90 degrees
return FlickerTestRunnerFactory.getInstance().buildTest(instrumentation,
supportedRotations = listOf(Surface.ROTATION_0)) { configuration ->
withTestName {
buildTestTag("splitScreenToLauncher", configuration)
}
repeat { configuration.repetitions }
setup {
test {
device.wakeUpAndGoToHomeScreen()
device.openQuickStepAndClearRecentAppsFromOverview(wmHelper)
}
eachRun {
testApp.launchViaIntent(wmHelper)
this.setRotation(configuration.endRotation)
device.launchSplitScreen(wmHelper)
}
}
teardown {
eachRun {
testApp.exit()
}
test {
if (device.isInSplitScreen()) {
device.exitSplitScreen()
}
}
}
transitions {
device.exitSplitScreen()
}
assertions {
windowManagerTrace {
navBarWindowIsAlwaysVisible()
statusBarWindowIsAlwaysVisible()
visibleWindowsShownMoreThanOneConsecutiveEntry()
}
layersTrace {
navBarLayerIsAlwaysVisible()
statusBarLayerIsAlwaysVisible()
noUncoveredRegions(configuration.endRotation)
navBarLayerRotatesAndScales(configuration.endRotation)
statusBarLayerRotatesScales(configuration.endRotation)
visibleLayersShownMoreThanOneConsecutiveEntry(
listOf(launcherPackageName))
// b/161435597 causes the test not to work on 90 degrees
dockedStackDividerBecomesInvisible()
layerBecomesInvisible(testApp.getPackage())
}
eventLog {
focusDoesNotChange(bugId = 151179149)
}
}
}
return FlickerTestParameterFactory.getInstance()
.getConfigNonRotationTests(supportedRotations = listOf(Surface.ROTATION_0))
}
}
}

View File

@@ -20,31 +20,28 @@ import android.app.Instrumentation
import android.os.Bundle
import android.support.test.launcherhelper.LauncherStrategyFactory
import android.view.Surface
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.exitSplitScreen
import com.android.server.wm.flicker.helpers.isInSplitScreen
import com.android.server.wm.flicker.helpers.isRotated
import com.android.server.wm.flicker.helpers.openQuickStepAndClearRecentAppsFromOverview
import com.android.server.wm.flicker.helpers.openQuickstep
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
import com.android.server.wm.flicker.repetitions
import com.android.server.wm.flicker.startRotation
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
abstract class LegacySplitScreenTransition(
protected val instrumentation: Instrumentation
) {
internal val splitScreenApp = SplitScreenHelper.getPrimary(instrumentation)
internal val secondaryApp = SplitScreenHelper.getSecondary(instrumentation)
internal val nonResizeableApp = SplitScreenHelper.getNonResizeable(instrumentation)
internal val LAUNCHER_PACKAGE_NAME = LauncherStrategyFactory.getInstance(instrumentation)
abstract class LegacySplitScreenTransition(protected val testSpec: FlickerTestParameter) {
protected val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
protected val isRotated = testSpec.config.startRotation.isRotated()
protected val splitScreenApp = SplitScreenHelper.getPrimary(instrumentation)
protected val secondaryApp = SplitScreenHelper.getSecondary(instrumentation)
protected val nonResizeableApp = SplitScreenHelper.getNonResizeable(instrumentation)
protected val LAUNCHER_PACKAGE_NAME = LauncherStrategyFactory.getInstance(instrumentation)
.launcherStrategy.supportedLauncherPackage
internal val LIVE_WALLPAPER_PACKAGE_NAME =
"com.breel.wallpapers18.soundviz.wallpaper.variations.SoundVizWallpaperV2"
internal val LETTERBOX_NAME = "Letterbox"
internal val TOAST_NAME = "Toast"
internal val SPLASH_SCREEN_NAME = "Splash Screen"
internal open val defaultTransitionSetup: FlickerBuilder.(Bundle) -> Unit
protected open val transition: FlickerBuilder.(Bundle) -> Unit
get() = { configuration ->
setup {
eachRun {
@@ -57,17 +54,22 @@ abstract class LegacySplitScreenTransition(
}
teardown {
eachRun {
// TODO(b/175687842) Workaround for exit legacy split screen
device.openQuickstep(wmHelper)
if (device.isInSplitScreen()) {
device.exitSplitScreen()
}
device.pressHome()
secondaryApp.exit(wmHelper)
splitScreenApp.exit(wmHelper)
this.setRotation(Surface.ROTATION_0)
}
}
}
@FlickerBuilderProvider
fun buildFlicker(): FlickerBuilder {
return FlickerBuilder(instrumentation).apply {
withTestName { testSpec.name }
repeat { testSpec.config.repetitions }
transition(this, testSpec.config)
}
}
internal open val cleanSetup: FlickerBuilder.(Bundle) -> Unit
get() = { configuration ->
setup {
@@ -79,37 +81,19 @@ abstract class LegacySplitScreenTransition(
}
teardown {
eachRun {
// TODO(b/175687842) Workaround for exit legacy split screen
device.openQuickstep(wmHelper)
if (device.isInSplitScreen()) {
device.exitSplitScreen()
}
nonResizeableApp.exit(wmHelper)
splitScreenApp.exit(wmHelper)
device.pressHome()
this.setRotation(Surface.ROTATION_0)
}
}
}
internal open val customRotateSetup: FlickerBuilder.(Bundle) -> Unit
get() = { configuration ->
setup {
eachRun {
device.wakeUpAndGoToHomeScreen()
device.openQuickStepAndClearRecentAppsFromOverview(wmHelper)
secondaryApp.launchViaIntent(wmHelper)
splitScreenApp.launchViaIntent(wmHelper)
}
}
teardown {
eachRun {
// TODO(b/175687842) Workaround for exit legacy split screen
device.openQuickstep(wmHelper)
if (device.isInSplitScreen()) {
device.exitSplitScreen()
}
device.pressHome()
this.setRotation(Surface.ROTATION_0)
}
}
}
companion object {
internal const val LIVE_WALLPAPER_PACKAGE_NAME =
"com.breel.wallpapers18.soundviz.wallpaper.variations.SoundVizWallpaperV2"
internal const val LETTERBOX_NAME = "Letterbox"
internal const val TOAST_NAME = "Toast"
internal const val SPLASH_SCREEN_NAME = "Splash Screen"
}
}

View File

@@ -19,15 +19,15 @@ package com.android.wm.shell.flicker.legacysplitscreen
import android.os.Bundle
import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.DOCKED_STACK_DIVIDER
import com.android.server.wm.flicker.FlickerTestRunner
import com.android.server.wm.flicker.FlickerTestRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.appWindowBecomesInVisible
import com.android.server.wm.flicker.appWindowBecomesVisible
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.buildTestTag
import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.flicker.helpers.reopenAppFromOverview
import com.android.server.wm.flicker.layerBecomesInvisible
@@ -36,6 +36,7 @@ import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEnt
import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
@@ -45,61 +46,73 @@ import org.junit.runners.Parameterized
* (Non resizable activity launch via recent overview)
* To run this test: `atest WMShellFlickerTests:NonResizableDismissInLegacySplitScreen`
*/
@Presubmit
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class NonResizableDismissInLegacySplitScreen(
testSpec: FlickerTestRunnerFactory.TestSpec
) : FlickerTestRunner(testSpec) {
companion object : LegacySplitScreenTransition(InstrumentationRegistry.getInstrumentation()) {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<Array<Any>> {
val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration ->
withTestName {
buildTestTag("testNonResizableDismissInLegacySplitScreen", configuration)
}
repeat { SplitScreenHelper.TEST_REPETITIONS }
setup {
eachRun {
nonResizeableApp.launchViaIntent(wmHelper)
splitScreenApp.launchViaIntent(wmHelper)
device.launchSplitScreen(wmHelper)
}
}
transitions {
device.reopenAppFromOverview(wmHelper)
}
assertions {
layersTrace {
layerBecomesVisible(nonResizeableApp.defaultWindowName)
layerBecomesInvisible(splitScreenApp.defaultWindowName)
visibleLayersShownMoreThanOneConsecutiveEntry(
listOf(DOCKED_STACK_DIVIDER, LAUNCHER_PACKAGE_NAME,
LETTERBOX_NAME, TOAST_NAME,
splitScreenApp.defaultWindowName,
nonResizeableApp.defaultWindowName),
bugId = 178447631
)
}
windowManagerTrace {
appWindowBecomesVisible(nonResizeableApp.defaultWindowName)
appWindowBecomesInVisible(splitScreenApp.defaultWindowName)
visibleWindowsShownMoreThanOneConsecutiveEntry(
listOf(DOCKED_STACK_DIVIDER, LAUNCHER_PACKAGE_NAME,
LETTERBOX_NAME, TOAST_NAME,
splitScreenApp.defaultWindowName,
nonResizeableApp.defaultWindowName),
bugId = 178447631
)
}
testSpec: FlickerTestParameter
) : LegacySplitScreenTransition(testSpec) {
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = { configuration ->
cleanSetup(this, configuration)
setup {
eachRun {
nonResizeableApp.launchViaIntent(wmHelper)
splitScreenApp.launchViaIntent(wmHelper)
device.launchSplitScreen(wmHelper)
}
}
return FlickerTestRunnerFactory.getInstance().buildTest(
instrumentation, cleanSetup, testSpec,
transitions {
device.reopenAppFromOverview(wmHelper)
}
}
@Presubmit
@Test
fun layerBecomesInvisible() = testSpec.layerBecomesInvisible(splitScreenApp.defaultWindowName)
@FlakyTest(bugId = 178447631)
@Test
fun visibleLayersShownMoreThanOneConsecutiveEntry() =
testSpec.visibleLayersShownMoreThanOneConsecutiveEntry(
listOf(DOCKED_STACK_DIVIDER, LAUNCHER_PACKAGE_NAME,
LETTERBOX_NAME, TOAST_NAME,
splitScreenApp.defaultWindowName,
nonResizeableApp.defaultWindowName)
)
@Presubmit
@Test
fun layerBecomesVisible() = testSpec.layerBecomesVisible(nonResizeableApp.defaultWindowName)
@Presubmit
@Test
fun appWindowBecomesVisible() =
testSpec.appWindowBecomesVisible(nonResizeableApp.defaultWindowName)
@Presubmit
@Test
fun appWindowBecomesInVisible() =
testSpec.appWindowBecomesInVisible(splitScreenApp.defaultWindowName)
@FlakyTest(bugId = 178447631)
@Test
fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry(
listOf(DOCKED_STACK_DIVIDER, LAUNCHER_PACKAGE_NAME,
LETTERBOX_NAME, TOAST_NAME,
splitScreenApp.defaultWindowName,
nonResizeableApp.defaultWindowName)
)
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests(
repetitions = SplitScreenHelper.TEST_REPETITIONS,
supportedRotations = listOf(Surface.ROTATION_0 /* bugId = 178685668 */))
supportedRotations = listOf(Surface.ROTATION_0)) // b/178685668
}
}
}
}

View File

@@ -19,15 +19,15 @@ package com.android.wm.shell.flicker.legacysplitscreen
import android.os.Bundle
import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.DOCKED_STACK_DIVIDER
import com.android.server.wm.flicker.FlickerTestRunner
import com.android.server.wm.flicker.FlickerTestRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.appWindowBecomesInVisible
import com.android.server.wm.flicker.appWindowBecomesVisible
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.buildTestTag
import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.flicker.layerBecomesInvisible
import com.android.server.wm.flicker.layerBecomesVisible
@@ -35,6 +35,7 @@ import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEnt
import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
@@ -47,60 +48,73 @@ import org.junit.runners.Parameterized
@Presubmit
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class NonResizableLaunchInLegacySplitScreen(
testSpec: FlickerTestRunnerFactory.TestSpec
) : FlickerTestRunner(testSpec) {
companion object : LegacySplitScreenTransition(InstrumentationRegistry.getInstrumentation()) {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<Array<Any>> {
val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration ->
withTestName {
buildTestTag("testNonResizableLaunchInLegacySplitScreen", configuration)
}
repeat { SplitScreenHelper.TEST_REPETITIONS }
setup {
eachRun {
splitScreenApp.launchViaIntent(wmHelper)
device.launchSplitScreen(wmHelper)
}
}
transitions {
nonResizeableApp.launchViaIntent(wmHelper)
wmHelper.waitForAppTransitionIdle()
}
assertions {
layersTrace {
layerBecomesVisible(nonResizeableApp.defaultWindowName)
layerBecomesInvisible(splitScreenApp.defaultWindowName)
visibleLayersShownMoreThanOneConsecutiveEntry(
listOf(DOCKED_STACK_DIVIDER,
LAUNCHER_PACKAGE_NAME,
LETTERBOX_NAME,
nonResizeableApp.defaultWindowName,
splitScreenApp.defaultWindowName),
bugId = 178447631
)
}
windowManagerTrace {
appWindowBecomesVisible(nonResizeableApp.defaultWindowName)
appWindowBecomesInVisible(splitScreenApp.defaultWindowName)
visibleWindowsShownMoreThanOneConsecutiveEntry(
listOf(DOCKED_STACK_DIVIDER,
LAUNCHER_PACKAGE_NAME,
LETTERBOX_NAME,
nonResizeableApp.defaultWindowName,
splitScreenApp.defaultWindowName),
bugId = 178447631
)
}
testSpec: FlickerTestParameter
) : LegacySplitScreenTransition(testSpec) {
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = { configuration ->
cleanSetup(this, configuration)
setup {
eachRun {
splitScreenApp.launchViaIntent(wmHelper)
device.launchSplitScreen(wmHelper)
}
}
return FlickerTestRunnerFactory.getInstance().buildTest(
instrumentation, cleanSetup, testSpec,
transitions {
nonResizeableApp.launchViaIntent(wmHelper)
wmHelper.waitForAppTransitionIdle()
}
}
@Presubmit
@Test
fun layerBecomesVisible() = testSpec.layerBecomesVisible(nonResizeableApp.defaultWindowName)
@Presubmit
@Test
fun layerBecomesInvisible() = testSpec.layerBecomesInvisible(splitScreenApp.defaultWindowName)
@FlakyTest(bugId = 178447631)
@Test
fun visibleLayersShownMoreThanOneConsecutiveEntry() =
testSpec.visibleLayersShownMoreThanOneConsecutiveEntry(
listOf(DOCKED_STACK_DIVIDER,
LAUNCHER_PACKAGE_NAME,
LETTERBOX_NAME,
nonResizeableApp.defaultWindowName,
splitScreenApp.defaultWindowName)
)
@Presubmit
@Test
fun appWindowBecomesVisible() =
testSpec.appWindowBecomesVisible(nonResizeableApp.defaultWindowName)
@Presubmit
@Test
fun appWindowBecomesInVisible() =
testSpec.appWindowBecomesInVisible(splitScreenApp.defaultWindowName)
@FlakyTest(bugId = 178447631)
@Test
fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry(
listOf(DOCKED_STACK_DIVIDER,
LAUNCHER_PACKAGE_NAME,
LETTERBOX_NAME,
nonResizeableApp.defaultWindowName,
splitScreenApp.defaultWindowName)
)
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests(
repetitions = SplitScreenHelper.TEST_REPETITIONS,
supportedRotations = listOf(Surface.ROTATION_0 /* bugId = 178685668 */))
supportedRotations = listOf(Surface.ROTATION_0)) // b/178685668
}
}
}

View File

@@ -19,14 +19,14 @@ package com.android.wm.shell.flicker.legacysplitscreen
import android.os.Bundle
import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerTestRunner
import com.android.server.wm.flicker.FlickerTestRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.appWindowBecomesVisible
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.focusChanges
import com.android.server.wm.flicker.helpers.buildTestTag
import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.flicker.layerBecomesVisible
import com.android.server.wm.flicker.noUncoveredRegions
@@ -34,10 +34,10 @@ import com.android.server.wm.flicker.startRotation
import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible
import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry
import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
import com.android.wm.shell.flicker.appPairsDividerBecomesVisible
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
@@ -46,54 +46,66 @@ import org.junit.runners.Parameterized
* Test open app to split screen.
* To run this test: `atest WMShellFlickerTests:OpenAppToLegacySplitScreen`
*/
@Presubmit
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class OpenAppToLegacySplitScreen(
testSpec: FlickerTestRunnerFactory.TestSpec
) : FlickerTestRunner(testSpec) {
companion object : LegacySplitScreenTransition(InstrumentationRegistry.getInstrumentation()) {
testSpec: FlickerTestParameter
) : LegacySplitScreenTransition(testSpec) {
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = { configuration ->
super.transition(this, configuration)
transitions {
device.launchSplitScreen(wmHelper)
wmHelper.waitForAppTransitionIdle()
}
}
@FlakyTest(bugId = 178447631)
@Test
fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry(
listOf(LAUNCHER_PACKAGE_NAME, splitScreenApp.defaultWindowName)
)
@Presubmit
@Test
fun appWindowBecomesVisible() = testSpec.appWindowBecomesVisible(splitScreenApp.getPackage())
@FlakyTest
@Test
fun noUncoveredRegions() = testSpec.noUncoveredRegions(testSpec.config.startRotation)
@Presubmit
@Test
fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsAlwaysVisible()
@Presubmit
@Test
fun appPairsDividerBecomesVisible() = testSpec.appPairsDividerBecomesVisible()
@Presubmit
@Test
fun layerBecomesVisible() = testSpec.layerBecomesVisible(splitScreenApp.getPackage())
@FlakyTest(bugId = 178447631)
@Test
fun visibleLayersShownMoreThanOneConsecutiveEntry() =
testSpec.visibleLayersShownMoreThanOneConsecutiveEntry(
listOf(LAUNCHER_PACKAGE_NAME, splitScreenApp.defaultWindowName)
)
@FlakyTest(bugId = 151179149)
@Test
fun focusChanges() = testSpec.focusChanges(splitScreenApp.`package`,
"recents_animation_input_consumer", "NexusLauncherActivity")
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<Array<Any>> {
val wmHelper = WindowManagerStateHelper()
val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration ->
withTestName {
buildTestTag("testOpenAppToLegacySplitScreen", configuration)
}
repeat { SplitScreenHelper.TEST_REPETITIONS }
transitions {
device.launchSplitScreen(wmHelper)
wmHelper.waitForAppTransitionIdle()
}
assertions {
windowManagerTrace {
visibleWindowsShownMoreThanOneConsecutiveEntry(
listOf(LAUNCHER_PACKAGE_NAME, splitScreenApp.defaultWindowName),
bugId = 178447631)
appWindowBecomesVisible(splitScreenApp.getPackage())
}
layersTrace {
noUncoveredRegions(configuration.startRotation, enabled = false)
statusBarLayerIsAlwaysVisible()
appPairsDividerBecomesVisible()
layerBecomesVisible(splitScreenApp.getPackage())
visibleLayersShownMoreThanOneConsecutiveEntry(
listOf(LAUNCHER_PACKAGE_NAME, splitScreenApp.defaultWindowName),
bugId = 178447631)
}
eventLog {
focusChanges(splitScreenApp.`package`,
"recents_animation_input_consumer", "NexusLauncherActivity",
bugId = 151179149)
}
}
}
return FlickerTestRunnerFactory.getInstance().buildTest(
instrumentation, defaultTransitionSetup, testSpec,
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests(
repetitions = SplitScreenHelper.TEST_REPETITIONS,
supportedRotations = listOf(Surface.ROTATION_0) // bugId = 179116910
)

View File

@@ -16,24 +16,21 @@
package com.android.wm.shell.flicker.legacysplitscreen
import android.platform.test.annotations.Presubmit
import android.graphics.Region
import android.os.Bundle
import android.util.Rational
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.By
import com.android.server.wm.flicker.DOCKED_STACK_DIVIDER
import com.android.server.wm.flicker.FlickerTestRunner
import com.android.server.wm.flicker.FlickerTestRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.endRotation
import com.android.server.wm.flicker.helpers.ImeAppHelper
import com.android.server.wm.flicker.focusDoesNotChange
import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.server.wm.flicker.helpers.buildTestTag
import com.android.server.wm.flicker.helpers.exitSplitScreen
import com.android.server.wm.flicker.helpers.isInSplitScreen
import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.flicker.helpers.resizeSplitScreen
import com.android.server.wm.flicker.helpers.setRotation
@@ -42,7 +39,6 @@ import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
import com.android.server.wm.flicker.noUncoveredRegions
import com.android.server.wm.flicker.repetitions
import com.android.server.wm.flicker.startRotation
import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales
@@ -52,6 +48,7 @@ import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
import com.android.server.wm.flicker.traces.layers.getVisibleBounds
import com.android.wm.shell.flicker.helpers.SimpleAppHelper
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
@@ -62,14 +59,162 @@ import org.junit.runners.Parameterized
*
* Currently it runs only in 0 degrees because of b/156100803
*/
@Presubmit
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@FlakyTest(bugId = 159096424)
class ResizeLegacySplitScreen(
testSpec: FlickerTestRunnerFactory.TestSpec
) : FlickerTestRunner(testSpec) {
testSpec: FlickerTestParameter
) : LegacySplitScreenTransition(testSpec) {
private val testAppTop = SimpleAppHelper(instrumentation)
private val testAppBottom = ImeAppHelper(instrumentation)
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = { configuration ->
setup {
eachRun {
device.wakeUpAndGoToHomeScreen()
this.setRotation(configuration.startRotation)
this.launcherStrategy.clearRecentAppsFromOverview()
testAppBottom.launchViaIntent(wmHelper)
device.pressHome()
testAppTop.launchViaIntent(wmHelper)
device.waitForIdle()
device.launchSplitScreen(wmHelper)
val snapshot =
device.findObject(By.res(device.launcherPackageName, "snapshot"))
snapshot.click()
testAppBottom.openIME(device)
device.pressBack()
device.resizeSplitScreen(startRatio)
}
}
teardown {
eachRun {
testAppTop.exit(wmHelper)
testAppBottom.exit(wmHelper)
}
}
transitions {
device.resizeSplitScreen(stopRatio)
}
}
@Test
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
@Test
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
@Test
fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry()
@FlakyTest(bugId = 156223549)
@Test
fun topAppWindowIsAlwaysVisible() {
testSpec.assertWm {
this.showsAppWindow(sSimpleActivity)
}
}
@FlakyTest(bugId = 156223549)
@Test
fun bottomAppWindowIsAlwaysVisible() {
testSpec.assertWm {
this.showsAppWindow(sImeActivity)
}
}
@Test
fun navBarLayerIsAlwaysVisible() = testSpec.navBarLayerIsAlwaysVisible()
@Test
fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsAlwaysVisible()
@Test
fun noUncoveredRegions() = testSpec.noUncoveredRegions(testSpec.config.endRotation)
@Test
fun navBarLayerRotatesAndScales() =
testSpec.navBarLayerRotatesAndScales(testSpec.config.endRotation)
@Test
fun statusBarLayerRotatesScales() =
testSpec.statusBarLayerRotatesScales(testSpec.config.endRotation)
@Test
fun visibleLayersShownMoreThanOneConsecutiveEntry() =
testSpec.visibleLayersShownMoreThanOneConsecutiveEntry()
@Test
fun topAppLayerIsAlwaysVisible() {
testSpec.assertLayers {
this.showsLayer(sSimpleActivity)
}
}
@Test
fun bottomAppLayerIsAlwaysVisible() {
testSpec.assertLayers {
this.showsLayer(sImeActivity)
}
}
@Test
fun dividerLayerIsAlwaysVisible() {
testSpec.assertLayers {
this.showsLayer(DOCKED_STACK_DIVIDER)
}
}
@FlakyTest
@Test
fun appsStartingBounds() {
testSpec.assertLayersStart {
val displayBounds = WindowUtils.displayBounds
val dividerBounds =
entry.getVisibleBounds(DOCKED_STACK_DIVIDER).bounds
val topAppBounds = Region(0, 0, dividerBounds.right,
dividerBounds.top + WindowUtils.dockedStackDividerInset)
val bottomAppBounds = Region(0,
dividerBounds.bottom - WindowUtils.dockedStackDividerInset,
displayBounds.right,
displayBounds.bottom - WindowUtils.navigationBarHeight)
this.hasVisibleRegion("SimpleActivity", topAppBounds)
.hasVisibleRegion("ImeActivity", bottomAppBounds)
}
}
@FlakyTest
@Test
fun appsEndingBounds() {
testSpec.assertLayersStart {
val displayBounds = WindowUtils.displayBounds
val dividerBounds =
entry.getVisibleBounds(DOCKED_STACK_DIVIDER).bounds
val topAppBounds = Region(0, 0, dividerBounds.right,
dividerBounds.top + WindowUtils.dockedStackDividerInset)
val bottomAppBounds = Region(0,
dividerBounds.bottom - WindowUtils.dockedStackDividerInset,
displayBounds.right,
displayBounds.bottom - WindowUtils.navigationBarHeight)
this.hasVisibleRegion(sSimpleActivity, topAppBounds)
.hasVisibleRegion(sImeActivity, bottomAppBounds)
}
}
@Test
fun focusDoesNotChange() {
testSpec.assertEventLog {
focusDoesNotChange()
}
}
companion object {
private const val sSimpleActivity = "SimpleActivity"
private const val sImeActivity = "ImeActivity"
@@ -78,126 +223,14 @@ class ResizeLegacySplitScreen(
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<Array<Any>> {
val instrumentation = InstrumentationRegistry.getInstrumentation()
val testAppTop = SimpleAppHelper(instrumentation)
val testAppBottom = ImeAppHelper(instrumentation)
return FlickerTestRunnerFactory.getInstance().buildTest(instrumentation,
supportedRotations = listOf(Surface.ROTATION_0)) { configuration ->
withTestName {
val description = (startRatio.toString().replace("/", "-") + "_to_" +
stopRatio.toString().replace("/", "-"))
buildTestTag("resizeSplitScreen", configuration, description)
}
repeat { configuration.repetitions }
setup {
eachRun {
device.wakeUpAndGoToHomeScreen()
this.setRotation(configuration.startRotation)
this.launcherStrategy.clearRecentAppsFromOverview()
testAppBottom.launchViaIntent(wmHelper)
device.pressHome()
testAppTop.launchViaIntent(wmHelper)
device.waitForIdle()
device.launchSplitScreen(wmHelper)
val snapshot =
device.findObject(By.res(device.launcherPackageName, "snapshot"))
snapshot.click()
testAppBottom.openIME(device)
device.pressBack()
device.resizeSplitScreen(startRatio)
}
}
teardown {
eachRun {
if (device.isInSplitScreen()) {
device.exitSplitScreen()
}
device.pressHome()
testAppTop.exit()
testAppBottom.exit()
}
test {
if (device.isInSplitScreen()) {
device.exitSplitScreen()
}
}
}
transitions {
device.resizeSplitScreen(stopRatio)
}
assertions {
windowManagerTrace {
navBarWindowIsAlwaysVisible()
statusBarWindowIsAlwaysVisible()
visibleWindowsShownMoreThanOneConsecutiveEntry()
all("topAppWindowIsAlwaysVisible", bugId = 156223549) {
this.showsAppWindow(sSimpleActivity)
}
all("bottomAppWindowIsAlwaysVisible", bugId = 156223549) {
this.showsAppWindow(sImeActivity)
}
}
layersTrace {
navBarLayerIsAlwaysVisible()
statusBarLayerIsAlwaysVisible()
noUncoveredRegions(configuration.endRotation)
navBarLayerRotatesAndScales(configuration.endRotation)
statusBarLayerRotatesScales(configuration.endRotation)
visibleLayersShownMoreThanOneConsecutiveEntry()
all("topAppLayerIsAlwaysVisible") {
this.showsLayer(sSimpleActivity)
}
all("bottomAppLayerIsAlwaysVisible") {
this.showsLayer(sImeActivity)
}
all("dividerLayerIsAlwaysVisible") {
this.showsLayer(DOCKED_STACK_DIVIDER)
}
start("appsStartingBounds", enabled = false) {
val displayBounds = WindowUtils.displayBounds
val dividerBounds =
entry.getVisibleBounds(DOCKED_STACK_DIVIDER).bounds
val topAppBounds = Region(0, 0, dividerBounds.right,
dividerBounds.top + WindowUtils.dockedStackDividerInset)
val bottomAppBounds = Region(0,
dividerBounds.bottom - WindowUtils.dockedStackDividerInset,
displayBounds.right,
displayBounds.bottom - WindowUtils.navigationBarHeight)
this.hasVisibleRegion("SimpleActivity", topAppBounds)
.hasVisibleRegion("ImeActivity", bottomAppBounds)
}
end("appsEndingBounds", enabled = false) {
val displayBounds = WindowUtils.displayBounds
val dividerBounds =
entry.getVisibleBounds(DOCKED_STACK_DIVIDER).bounds
val topAppBounds = Region(0, 0, dividerBounds.right,
dividerBounds.top + WindowUtils.dockedStackDividerInset)
val bottomAppBounds = Region(0,
dividerBounds.bottom - WindowUtils.dockedStackDividerInset,
displayBounds.right,
displayBounds.bottom - WindowUtils.navigationBarHeight)
this.hasVisibleRegion(sSimpleActivity, topAppBounds)
.hasVisibleRegion(sImeActivity, bottomAppBounds)
}
}
eventLog {
focusDoesNotChange()
}
}
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance()
.getConfigNonRotationTests(supportedRotations = listOf(Surface.ROTATION_0))
.map {
val description = (startRatio.toString().replace("/", "-") + "_to_" +
stopRatio.toString().replace("/", "-"))
val newName = "${FlickerTestParameter.defaultName(it.config)}_$description"
FlickerTestParameter(it.config, name = newName)
}
}
}

View File

@@ -19,14 +19,14 @@ package com.android.wm.shell.flicker.legacysplitscreen
import android.os.Bundle
import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerTestRunner
import com.android.server.wm.flicker.FlickerTestRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.appWindowBecomesVisible
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.endRotation
import com.android.server.wm.flicker.helpers.buildTestTag
import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
@@ -38,6 +38,7 @@ import com.android.wm.shell.flicker.dockedStackDividerIsVisible
import com.android.wm.shell.flicker.dockedStackPrimaryBoundsIsVisible
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
@@ -46,50 +47,64 @@ import org.junit.runners.Parameterized
* Test dock activity to primary split screen and rotate
* To run this test: `atest WMShellFlickerTests:RotateOneLaunchedAppAndEnterSplitScreen`
*/
@Presubmit
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class RotateOneLaunchedAppAndEnterSplitScreen(
testSpec: FlickerTestRunnerFactory.TestSpec
) : FlickerTestRunner(testSpec) {
companion object : LegacySplitScreenTransition(InstrumentationRegistry.getInstrumentation()) {
testSpec: FlickerTestParameter
) : LegacySplitScreenRotateTransition(testSpec) {
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = { configuration ->
super.transition(this, configuration)
transitions {
device.launchSplitScreen(wmHelper)
this.setRotation(testSpec.config.startRotation)
}
}
@FlakyTest(bugId = 175687842)
@Test
fun dockedStackDividerIsVisible() = testSpec.dockedStackDividerIsVisible()
@FlakyTest(bugId = 175687842)
@Test
fun dockedStackPrimaryBoundsIsVisible() =
testSpec.dockedStackPrimaryBoundsIsVisible(testSpec.config.startRotation,
splitScreenApp.defaultWindowName)
@FlakyTest(bugId = 169271943)
@Test
fun navBarLayerRotatesAndScales() =
testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation,
testSpec.config.endRotation)
@FlakyTest(bugId = 169271943)
@Test
fun statusBarLayerRotatesScales() =
testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation,
testSpec.config.endRotation)
@Presubmit
@Test
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun appWindowBecomesVisible() =
testSpec.appWindowBecomesVisible(splitScreenApp.defaultWindowName)
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<Array<Any>> {
val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration ->
withTestName {
buildTestTag("testRotateOneLaunchedAppAndEnterSplitScreen", configuration)
}
repeat { SplitScreenHelper.TEST_REPETITIONS }
transitions {
device.launchSplitScreen(wmHelper)
this.setRotation(configuration.startRotation)
}
assertions {
layersTrace {
dockedStackDividerIsVisible(bugId = 175687842)
dockedStackPrimaryBoundsIsVisible(
configuration.startRotation,
splitScreenApp.defaultWindowName, bugId = 175687842)
navBarLayerRotatesAndScales(
configuration.startRotation,
configuration.endRotation, bugId = 169271943)
statusBarLayerRotatesScales(
configuration.startRotation,
configuration.endRotation, bugId = 169271943)
}
windowManagerTrace {
navBarWindowIsAlwaysVisible()
statusBarWindowIsAlwaysVisible()
appWindowBecomesVisible(splitScreenApp.defaultWindowName)
}
}
}
return FlickerTestRunnerFactory.getInstance().buildTest(
instrumentation, customRotateSetup, testSpec,
repetitions = SplitScreenHelper.TEST_REPETITIONS,
supportedRotations = listOf(Surface.ROTATION_0 /* bugId = 178685668 */))
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance()
.getConfigNonRotationTests(repetitions = SplitScreenHelper.TEST_REPETITIONS,
supportedRotations = listOf(Surface.ROTATION_0)) // b/178685668
}
}
}
}

View File

@@ -19,14 +19,14 @@ package com.android.wm.shell.flicker.legacysplitscreen
import android.os.Bundle
import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerTestRunner
import com.android.server.wm.flicker.FlickerTestRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.appWindowBecomesVisible
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.endRotation
import com.android.server.wm.flicker.helpers.buildTestTag
import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
@@ -38,6 +38,7 @@ import com.android.wm.shell.flicker.dockedStackDividerIsVisible
import com.android.wm.shell.flicker.dockedStackPrimaryBoundsIsVisible
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
@@ -46,50 +47,61 @@ import org.junit.runners.Parameterized
* Rotate
* To run this test: `atest WMShellFlickerTests:RotateOneLaunchedAppInSplitScreenMode`
*/
@Presubmit
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class RotateOneLaunchedAppInSplitScreenMode(
testSpec: FlickerTestRunnerFactory.TestSpec
) : FlickerTestRunner(testSpec) {
companion object : LegacySplitScreenTransition(InstrumentationRegistry.getInstrumentation()) {
testSpec: FlickerTestParameter
) : LegacySplitScreenRotateTransition(testSpec) {
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = { configuration ->
super.transition(this, configuration)
transitions {
this.setRotation(testSpec.config.startRotation)
device.launchSplitScreen(wmHelper)
}
}
@FlakyTest(bugId = 175687842)
@Test
fun dockedStackDividerIsVisible() = testSpec.dockedStackDividerIsVisible()
@FlakyTest(bugId = 175687842)
@Test
fun dockedStackPrimaryBoundsIsVisible() = testSpec.dockedStackPrimaryBoundsIsVisible(
testSpec.config.startRotation, splitScreenApp.defaultWindowName)
@FlakyTest(bugId = 169271943)
@Test
fun navBarLayerRotatesAndScales() = testSpec.navBarLayerRotatesAndScales(
testSpec.config.startRotation, testSpec.config.endRotation)
@FlakyTest(bugId = 169271943)
@Test
fun statusBarLayerRotatesScales() = testSpec.statusBarLayerRotatesScales(
testSpec.config.startRotation, testSpec.config.endRotation)
@Presubmit
@Test
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun appWindowBecomesVisible() =
testSpec.appWindowBecomesVisible(splitScreenApp.defaultWindowName)
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<Array<Any>> {
val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration ->
withTestName {
buildTestTag("testRotateOneLaunchedAppInSplitScreenMode", configuration)
}
repeat { SplitScreenHelper.TEST_REPETITIONS }
transitions {
this.setRotation(configuration.startRotation)
device.launchSplitScreen(wmHelper)
}
assertions {
layersTrace {
dockedStackDividerIsVisible(bugId = 175687842)
dockedStackPrimaryBoundsIsVisible(
configuration.startRotation,
splitScreenApp.defaultWindowName, bugId = 175687842)
navBarLayerRotatesAndScales(
configuration.startRotation,
configuration.endRotation, bugId = 169271943)
statusBarLayerRotatesScales(
configuration.startRotation,
configuration.endRotation, bugId = 169271943)
}
windowManagerTrace {
navBarWindowIsAlwaysVisible()
statusBarWindowIsAlwaysVisible()
appWindowBecomesVisible(splitScreenApp.defaultWindowName)
}
}
}
return FlickerTestRunnerFactory.getInstance().buildTest(
instrumentation, customRotateSetup, testSpec,
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests(
repetitions = SplitScreenHelper.TEST_REPETITIONS,
supportedRotations = listOf(Surface.ROTATION_0 /* bugId = 178685668 */))
supportedRotations = listOf(Surface.ROTATION_0)) // b/178685668
}
}
}
}

View File

@@ -19,14 +19,14 @@ package com.android.wm.shell.flicker.legacysplitscreen
import android.os.Bundle
import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerTestRunner
import com.android.server.wm.flicker.FlickerTestRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.appWindowBecomesVisible
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.endRotation
import com.android.server.wm.flicker.helpers.buildTestTag
import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.flicker.helpers.reopenAppFromOverview
import com.android.server.wm.flicker.helpers.setRotation
@@ -40,6 +40,7 @@ import com.android.wm.shell.flicker.dockedStackPrimaryBoundsIsVisible
import com.android.wm.shell.flicker.dockedStackSecondaryBoundsIsVisible
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
@@ -48,54 +49,69 @@ import org.junit.runners.Parameterized
* Test open app to split screen.
* To run this test: `atest WMShellFlickerTests:RotateTwoLaunchedAppAndEnterSplitScreen`
*/
@Presubmit
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class RotateTwoLaunchedAppAndEnterSplitScreen(
testSpec: FlickerTestRunnerFactory.TestSpec
) : FlickerTestRunner(testSpec) {
companion object : LegacySplitScreenTransition(InstrumentationRegistry.getInstrumentation()) {
testSpec: FlickerTestParameter
) : LegacySplitScreenRotateTransition(testSpec) {
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = { configuration ->
super.transition(this, configuration)
transitions {
this.setRotation(testSpec.config.startRotation)
device.launchSplitScreen(wmHelper)
device.reopenAppFromOverview(wmHelper)
}
}
@FlakyTest(bugId = 175687842)
@Test
fun dockedStackDividerIsVisible() = testSpec.dockedStackDividerIsVisible()
@FlakyTest(bugId = 175687842)
@Test
fun dockedStackPrimaryBoundsIsVisible() =
testSpec.dockedStackPrimaryBoundsIsVisible(testSpec.config.startRotation,
splitScreenApp.defaultWindowName)
@FlakyTest(bugId = 175687842)
@Test
fun dockedStackSecondaryBoundsIsVisible() =
testSpec.dockedStackSecondaryBoundsIsVisible(testSpec.config.startRotation,
secondaryApp.defaultWindowName)
@FlakyTest(bugId = 169271943)
@Test
fun navBarLayerRotatesAndScales() =
testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation,
testSpec.config.endRotation)
@FlakyTest(bugId = 169271943)
@Test
fun statusBarLayerRotatesScales() = testSpec.statusBarLayerRotatesScales(
testSpec.config.startRotation, testSpec.config.endRotation)
@Presubmit
@Test
fun appWindowBecomesVisible() = testSpec.appWindowBecomesVisible(secondaryApp.defaultWindowName)
@Presubmit
@Test
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<Array<Any>> {
val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration ->
withTestName {
buildTestTag("testRotateTwoLaunchedAppAndEnterSplitScreen", configuration)
}
repeat { SplitScreenHelper.TEST_REPETITIONS }
transitions {
this.setRotation(configuration.startRotation)
device.launchSplitScreen(wmHelper)
device.reopenAppFromOverview(wmHelper)
}
assertions {
layersTrace {
dockedStackDividerIsVisible(bugId = 175687842)
dockedStackPrimaryBoundsIsVisible(
configuration.startRotation,
splitScreenApp.defaultWindowName, 175687842)
dockedStackSecondaryBoundsIsVisible(
configuration.startRotation,
secondaryApp.defaultWindowName, bugId = 175687842)
navBarLayerRotatesAndScales(
configuration.startRotation,
configuration.endRotation, bugId = 169271943)
statusBarLayerRotatesScales(
configuration.startRotation,
configuration.endRotation, bugId = 169271943)
}
windowManagerTrace {
appWindowBecomesVisible(secondaryApp.defaultWindowName)
navBarWindowIsAlwaysVisible()
statusBarWindowIsAlwaysVisible()
}
}
}
return FlickerTestRunnerFactory.getInstance().buildTest(
instrumentation, customRotateSetup, testSpec,
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests(
repetitions = SplitScreenHelper.TEST_REPETITIONS,
supportedRotations = listOf(Surface.ROTATION_0 /* bugId = 178685668 */))
supportedRotations = listOf(Surface.ROTATION_0)) // b/178685668
}
}
}
}

View File

@@ -19,14 +19,14 @@ package com.android.wm.shell.flicker.legacysplitscreen
import android.os.Bundle
import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerTestRunner
import com.android.server.wm.flicker.FlickerTestRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.appWindowBecomesVisible
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.endRotation
import com.android.server.wm.flicker.helpers.buildTestTag
import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.flicker.helpers.reopenAppFromOverview
import com.android.server.wm.flicker.helpers.setRotation
@@ -40,6 +40,7 @@ import com.android.wm.shell.flicker.dockedStackPrimaryBoundsIsVisible
import com.android.wm.shell.flicker.dockedStackSecondaryBoundsIsVisible
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
@@ -48,59 +49,76 @@ import org.junit.runners.Parameterized
* Test open app to split screen.
* To run this test: `atest WMShellFlickerTests:RotateTwoLaunchedAppInSplitScreenMode`
*/
@Presubmit
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class RotateTwoLaunchedAppInSplitScreenMode(
testSpec: FlickerTestRunnerFactory.TestSpec
) : FlickerTestRunner(testSpec) {
companion object : LegacySplitScreenTransition(InstrumentationRegistry.getInstrumentation()) {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<Array<Any>> {
val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration ->
withTestName {
buildTestTag("testRotateTwoLaunchedAppInSplitScreenMode", configuration)
}
repeat { SplitScreenHelper.TEST_REPETITIONS }
setup {
eachRun {
device.launchSplitScreen(wmHelper)
device.reopenAppFromOverview(wmHelper)
this.setRotation(configuration.startRotation)
}
}
transitions {
this.setRotation(configuration.startRotation)
}
assertions {
layersTrace {
dockedStackDividerIsVisible(bugId = 175687842)
dockedStackPrimaryBoundsIsVisible(
configuration.startRotation,
splitScreenApp.defaultWindowName, bugId = 175687842)
dockedStackSecondaryBoundsIsVisible(
configuration.startRotation,
secondaryApp.defaultWindowName, bugId = 175687842)
navBarLayerRotatesAndScales(
configuration.startRotation,
configuration.endRotation, bugId = 169271943)
statusBarLayerRotatesScales(
configuration.startRotation,
configuration.endRotation, bugId = 169271943)
}
windowManagerTrace {
appWindowBecomesVisible(secondaryApp.defaultWindowName)
navBarWindowIsAlwaysVisible()
statusBarWindowIsAlwaysVisible()
}
testSpec: FlickerTestParameter
) : LegacySplitScreenRotateTransition(testSpec) {
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = { configuration ->
super.transition(this, configuration)
setup {
eachRun {
device.launchSplitScreen(wmHelper)
device.reopenAppFromOverview(wmHelper)
this.setRotation(testSpec.config.startRotation)
}
}
return FlickerTestRunnerFactory.getInstance().buildTest(
instrumentation, customRotateSetup, testSpec,
transitions {
this.setRotation(testSpec.config.startRotation)
}
}
@FlakyTest(bugId = 175687842)
@Test
fun dockedStackDividerIsVisible() = testSpec.dockedStackDividerIsVisible()
@FlakyTest(bugId = 175687842)
@Test
fun dockedStackPrimaryBoundsIsVisible() =
testSpec.dockedStackPrimaryBoundsIsVisible(testSpec.config.startRotation,
splitScreenApp.defaultWindowName)
@FlakyTest(bugId = 175687842)
@Test
fun dockedStackSecondaryBoundsIsVisible() =
testSpec.dockedStackSecondaryBoundsIsVisible(testSpec.config.startRotation,
secondaryApp.defaultWindowName)
@FlakyTest(bugId = 169271943)
@Test
fun navBarLayerRotatesAndScales() =
testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation,
testSpec.config.endRotation)
@FlakyTest(bugId = 169271943)
@Test
fun statusBarLayerRotatesScales() =
testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation,
testSpec.config.endRotation)
@Presubmit
@Test
fun appWindowBecomesVisible() =
testSpec.appWindowBecomesVisible(secondaryApp.defaultWindowName)
@Presubmit
@Test
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests(
repetitions = SplitScreenHelper.TEST_REPETITIONS,
supportedRotations = listOf(Surface.ROTATION_0 /* bugId = 178685668 */))
supportedRotations = listOf(Surface.ROTATION_0)) // b/178685668
}
}
}
}

View File

@@ -1,33 +0,0 @@
/*
* Copyright (C) 2020 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.pip
import android.os.SystemClock
import com.android.wm.shell.flicker.NonRotationTestBase
abstract class AppTestBase(
rotationName: String,
rotation: Int
) : NonRotationTestBase(rotationName, rotation) {
companion object {
fun waitForAnimationComplete() {
// TODO: UiDevice doesn't have reliable way to wait for the completion of animation.
// Consider to introduce WindowManagerStateHelper to access Activity state.
SystemClock.sleep(1000)
}
}
}

View File

@@ -16,11 +16,14 @@
package com.android.wm.shell.flicker.pip
import android.os.Bundle
import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerTestRunner
import com.android.server.wm.flicker.FlickerTestRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.wm.shell.flicker.helpers.FixedAppHelper
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
@@ -29,6 +32,7 @@ import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible
import com.android.server.wm.flicker.startRotation
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
@@ -39,64 +43,96 @@ import org.junit.runners.Parameterized
*/
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class EnterExitPipTest(
testSpec: FlickerTestRunnerFactory.TestSpec
) : FlickerTestRunner(testSpec) {
companion object : PipTransitionBase(InstrumentationRegistry.getInstrumentation()) {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): List<Array<Any>> {
val testApp = FixedAppHelper(instrumentation)
val testSpec = getTransition(eachRun = true) { configuration ->
setup {
eachRun {
testApp.launchViaIntent(wmHelper)
}
}
transitions {
// This will bring PipApp to fullscreen
pipApp.launchViaIntent(wmHelper)
}
assertions {
val displayBounds = WindowUtils.getDisplayBounds(configuration.startRotation)
presubmit {
windowManagerTrace {
all("pipApp must remain inside visible bounds") {
coversAtMostRegion(pipApp.defaultWindowName, displayBounds)
}
all("Initially shows both app windows then pipApp hides testApp") {
showsAppWindow(testApp.defaultWindowName)
.showsAppWindowOnTop(pipApp.defaultWindowName)
.then()
.hidesAppWindow(testApp.defaultWindowName)
}
navBarWindowIsAlwaysVisible()
statusBarWindowIsAlwaysVisible()
}
layersTrace {
all("Initially shows both app layers then pipApp hides testApp") {
showsLayer(testApp.defaultWindowName)
.showsLayer(pipApp.defaultWindowName)
.then()
.hidesLayer(testApp.defaultWindowName)
}
start("testApp covers the fullscreen, pipApp remains inside display") {
hasVisibleRegion(testApp.defaultWindowName, displayBounds)
coversAtMostRegion(displayBounds, pipApp.defaultWindowName)
}
end("pipApp covers the fullscreen") {
hasVisibleRegion(pipApp.defaultWindowName, displayBounds)
}
navBarLayerIsAlwaysVisible()
statusBarLayerIsAlwaysVisible()
}
}
testSpec: FlickerTestParameter
) : PipTransition(testSpec) {
private val testApp = FixedAppHelper(instrumentation)
private val displayBounds = WindowUtils.getDisplayBounds(testSpec.config.startRotation)
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = buildTransition(eachRun = true) {
setup {
eachRun {
testApp.launchViaIntent(wmHelper)
}
}
return FlickerTestRunnerFactory.getInstance().buildTest(instrumentation,
testSpec, supportedRotations = listOf(Surface.ROTATION_0),
repetitions = 5)
transitions {
// This will bring PipApp to fullscreen
pipApp.launchViaIntent(wmHelper)
}
}
@Presubmit
@Test
fun pipAppRemainInsideVisibleBounds() {
testSpec.assertWm {
coversAtMostRegion(pipApp.defaultWindowName, displayBounds)
}
}
}
@Presubmit
@Test
fun showBothAppWindowsThenHidePip() {
testSpec.assertWm {
showsAppWindow(testApp.defaultWindowName)
.showsAppWindowOnTop(pipApp.defaultWindowName)
.then()
.hidesAppWindow(testApp.defaultWindowName)
}
}
@Presubmit
@Test
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun showBothAppLayersThenHidePip() {
testSpec.assertLayers {
showsLayer(testApp.defaultWindowName)
.showsLayer(pipApp.defaultWindowName)
.then()
.hidesLayer(testApp.defaultWindowName)
}
}
@Presubmit
@Test
fun testAppCoversFullScreenWithPipOnDisplay() {
testSpec.assertLayersStart {
hasVisibleRegion(testApp.defaultWindowName, displayBounds)
coversAtMostRegion(displayBounds, pipApp.defaultWindowName)
}
}
@Presubmit
@Test
fun pipAppCoversFullScreen() {
testSpec.assertLayersEnd {
hasVisibleRegion(pipApp.defaultWindowName, displayBounds)
}
}
@Presubmit
@Test
fun navBarLayerIsAlwaysVisible() = testSpec.navBarLayerIsAlwaysVisible()
@Presubmit
@Test
fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsAlwaysVisible()
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): List<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests(
supportedRotations = listOf(Surface.ROTATION_0), repetitions = 5)
}
}
}

View File

@@ -16,11 +16,15 @@
package com.android.wm.shell.flicker.pip
import android.os.Bundle
import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerTestRunner
import com.android.server.wm.flicker.FlickerTestRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible
@@ -30,6 +34,7 @@ import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
import com.android.server.wm.flicker.noUncoveredRegions
import com.android.server.wm.flicker.startRotation
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
@@ -40,58 +45,71 @@ import org.junit.runners.Parameterized
*/
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class EnterPipTest(
testSpec: FlickerTestRunnerFactory.TestSpec
) : FlickerTestRunner(testSpec) {
companion object : PipTransitionBase(InstrumentationRegistry.getInstrumentation()) {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): List<Array<Any>> {
val testSpec = getTransition(eachRun = true,
stringExtras = emptyMap()) { configuration ->
transitions {
pipApp.clickEnterPipButton()
pipApp.expandPipWindow(wmHelper)
}
assertions {
presubmit {
windowManagerTrace {
navBarWindowIsAlwaysVisible()
statusBarWindowIsAlwaysVisible()
all("pipWindowBecomesVisible") {
this.showsAppWindow(pipApp.defaultWindowName)
}
}
layersTrace {
statusBarLayerIsAlwaysVisible()
statusBarLayerRotatesScales(configuration.startRotation,
Surface.ROTATION_0)
}
layersTrace {
all("pipLayerBecomesVisible") {
this.showsLayer(pipApp.launcherName)
}
}
}
flaky {
layersTrace {
navBarLayerIsAlwaysVisible(bugId = 140855415)
noUncoveredRegions(configuration.startRotation, Surface.ROTATION_0)
navBarLayerRotatesAndScales(configuration.startRotation,
Surface.ROTATION_0, bugId = 140855415)
}
}
}
class EnterPipTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) {
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = buildTransition(eachRun = true, stringExtras = emptyMap()) {
transitions {
pipApp.clickEnterPipButton()
pipApp.expandPipWindow(wmHelper)
}
}
return FlickerTestRunnerFactory.getInstance().buildTest(instrumentation,
testSpec, supportedRotations = listOf(Surface.ROTATION_0),
repetitions = 5)
@Presubmit
@Test
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun pipWindowBecomesVisible() {
testSpec.assertWm {
this.showsAppWindow(pipApp.defaultWindowName)
}
}
}
@Presubmit
@Test
fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsAlwaysVisible()
@Presubmit
@Test
fun statusBarLayerRotatesScales() =
testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0)
@Presubmit
@Test
fun pipLayerBecomesVisible() {
testSpec.assertLayers {
this.showsLayer(pipApp.launcherName)
}
}
@FlakyTest(bugId = 140855415)
@Test
fun navBarLayerIsAlwaysVisible() = testSpec.navBarLayerIsAlwaysVisible()
@FlakyTest(bugId = 140855415)
@Test
fun navBarLayerRotatesAndScales() =
testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0)
@FlakyTest(bugId = 140855415)
@Test
fun noUncoveredRegions() =
testSpec.noUncoveredRegions(testSpec.config.startRotation, Surface.ROTATION_0)
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): List<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance()
.getConfigRotationTests(supportedRotations = listOf(Surface.ROTATION_0),
repetitions = 5)
}
}
}

View File

@@ -16,22 +16,27 @@
package com.android.wm.shell.flicker.pip
import android.os.Bundle
import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerTestRunner
import com.android.server.wm.flicker.FlickerTestRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.wm.shell.flicker.helpers.FixedAppHelper
import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible
import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
import com.android.wm.shell.flicker.pip.PipTransitionBase.BroadcastActionTrigger.Companion.ORIENTATION_LANDSCAPE
import com.android.wm.shell.flicker.pip.PipTransitionBase.BroadcastActionTrigger.Companion.ORIENTATION_PORTRAIT
import com.android.wm.shell.flicker.helpers.FixedAppHelper
import com.android.wm.shell.flicker.pip.PipTransition.BroadcastActionTrigger.Companion.ORIENTATION_LANDSCAPE
import com.android.wm.shell.flicker.pip.PipTransition.BroadcastActionTrigger.Companion.ORIENTATION_PORTRAIT
import com.android.wm.shell.flicker.testapp.Components.PipActivity.ACTION_ENTER_PIP
import com.android.wm.shell.flicker.testapp.Components.FixedActivity.EXTRA_FIXED_ORIENTATION
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
@@ -42,82 +47,108 @@ import org.junit.runners.Parameterized
*/
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class EnterPipToOtherOrientationTest(
testSpec: FlickerTestRunnerFactory.TestSpec
) : FlickerTestRunner(testSpec) {
companion object : PipTransitionBase(InstrumentationRegistry.getInstrumentation()) {
private val testApp = FixedAppHelper(instrumentation)
testSpec: FlickerTestParameter
) : PipTransition(testSpec) {
private val testApp = FixedAppHelper(instrumentation)
private val startingBounds = WindowUtils.getDisplayBounds(Surface.ROTATION_90)
private val endingBounds = WindowUtils.getDisplayBounds(Surface.ROTATION_0)
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<Array<Any>> {
return FlickerTestRunnerFactory.getInstance().buildTest(instrumentation,
supportedRotations = listOf(Surface.ROTATION_0),
repetitions = 5) { configuration ->
setupAndTeardown(this, configuration)
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = { configuration ->
setupAndTeardown(this, configuration)
setup {
eachRun {
// Launch a portrait only app on the fullscreen stack
testApp.launchViaIntent(wmHelper, stringExtras = mapOf(
EXTRA_FIXED_ORIENTATION to ORIENTATION_PORTRAIT.toString()))
// Launch the PiP activity fixed as landscape
pipApp.launchViaIntent(wmHelper, stringExtras = mapOf(
EXTRA_FIXED_ORIENTATION to ORIENTATION_LANDSCAPE.toString()))
}
}
teardown {
eachRun {
pipApp.exit()
testApp.exit()
}
}
transitions {
// Enter PiP, and assert that the PiP is within bounds now that the device is back
// in portrait
broadcastActionTrigger.doAction(ACTION_ENTER_PIP)
wmHelper.waitPipWindowShown()
wmHelper.waitForAppTransitionIdle()
}
assertions {
val startingBounds = WindowUtils.getDisplayBounds(Surface.ROTATION_90)
val endingBounds = WindowUtils.getDisplayBounds(Surface.ROTATION_0)
presubmit {
windowManagerTrace {
all("pipApp window is always on top") {
showsAppWindowOnTop(pipApp.defaultWindowName)
}
start("pipApp window hides testApp") {
isInvisible(testApp.defaultWindowName)
}
end("testApp windows is shown") {
isVisible(testApp.defaultWindowName)
}
navBarWindowIsAlwaysVisible()
statusBarWindowIsAlwaysVisible()
}
layersTrace {
start("pipApp layer hides testApp") {
hasVisibleRegion(pipApp.defaultWindowName, startingBounds)
isInvisible(testApp.defaultWindowName)
}
}
}
flaky {
layersTrace {
end("testApp layer covers fullscreen") {
hasVisibleRegion(testApp.defaultWindowName, endingBounds)
}
navBarLayerIsAlwaysVisible(bugId = 140855415)
statusBarLayerIsAlwaysVisible(bugId = 140855415)
}
}
setup {
eachRun {
// Launch a portrait only app on the fullscreen stack
testApp.launchViaIntent(wmHelper, stringExtras = mapOf(
EXTRA_FIXED_ORIENTATION to ORIENTATION_PORTRAIT.toString()))
// Launch the PiP activity fixed as landscape
pipApp.launchViaIntent(wmHelper, stringExtras = mapOf(
EXTRA_FIXED_ORIENTATION to ORIENTATION_LANDSCAPE.toString()))
}
}
teardown {
eachRun {
pipApp.exit(wmHelper)
testApp.exit(wmHelper)
}
}
transitions {
// Enter PiP, and assert that the PiP is within bounds now that the device is back
// in portrait
broadcastActionTrigger.doAction(ACTION_ENTER_PIP)
wmHelper.waitPipWindowShown()
wmHelper.waitForAppTransitionIdle()
}
}
@Presubmit
@Test
fun pipAppWindowIsAlwaysOnTop() {
testSpec.assertWm {
showsAppWindowOnTop(pipApp.defaultWindowName)
}
}
}
@Presubmit
@Test
fun pipAppHidesTestApp() {
testSpec.assertWmStart {
isInvisible(testApp.defaultWindowName)
}
}
@Presubmit
@Test
fun testAppWindowIsVisible() {
testSpec.assertWmEnd {
isVisible(testApp.defaultWindowName)
}
}
@Presubmit
@Test
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun pipAppLayerHidesTestApp() {
testSpec.assertLayersStart {
hasVisibleRegion(pipApp.defaultWindowName, startingBounds)
isInvisible(testApp.defaultWindowName)
}
}
@FlakyTest
@Test
fun testAppLayerCoversFullScreen() {
testSpec.assertLayersEnd {
hasVisibleRegion(testApp.defaultWindowName, endingBounds)
}
}
@FlakyTest(bugId = 140855415)
@Test
fun navBarLayerIsAlwaysVisible() = testSpec.navBarLayerIsAlwaysVisible()
@FlakyTest(bugId = 140855415)
@Test
fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsAlwaysVisible()
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance()
.getConfigNonRotationTests(supportedRotations = listOf(Surface.ROTATION_0),
repetitions = 5)
}
}
}

View File

@@ -16,17 +16,21 @@
package com.android.wm.shell.flicker.pip
import android.os.Bundle
import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerTestRunner
import com.android.server.wm.flicker.FlickerTestRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.flicker.startRotation
import com.android.wm.shell.flicker.IME_WINDOW_NAME
import com.android.wm.shell.flicker.helpers.ImeAppHelper
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
@@ -37,58 +41,67 @@ import org.junit.runners.Parameterized
*/
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class PipKeyboardTest(testSpec: FlickerTestRunnerFactory.TestSpec) : FlickerTestRunner(testSpec) {
companion object : PipTransitionBase(InstrumentationRegistry.getInstrumentation()) {
class PipKeyboardTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) {
private val imeApp = ImeAppHelper(instrumentation)
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = buildTransition(eachRun = false) { configuration ->
setup {
test {
imeApp.launchViaIntent(wmHelper)
setRotation(configuration.startRotation)
}
}
teardown {
test {
imeApp.exit(wmHelper)
setRotation(Surface.ROTATION_0)
}
}
transitions {
// open the soft keyboard
imeApp.openIME(wmHelper)
createTag(TAG_IME_VISIBLE)
// then close it again
imeApp.closeIME(wmHelper)
}
}
/**
* Ensure the pip window remains visible throughout any keyboard interactions
*/
@Presubmit
@Test
fun pipInVisibleBounds() {
testSpec.assertWm {
val displayBounds = WindowUtils.getDisplayBounds(testSpec.config.startRotation)
coversAtMostRegion(pipApp.defaultWindowName, displayBounds)
}
}
/**
* Ensure that the pip window does not obscure the keyboard
*/
@Presubmit
@Test
fun pipIsAboveAppWindow() {
testSpec.assertWmTag(TAG_IME_VISIBLE) {
isAboveWindow(IME_WINDOW_NAME, pipApp.defaultWindowName)
}
}
companion object {
private const val TAG_IME_VISIBLE = "imeIsVisible"
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<Array<Any>> {
val imeApp = ImeAppHelper(instrumentation)
val testSpec = getTransition(eachRun = false) { configuration ->
setup {
test {
imeApp.launchViaIntent(wmHelper)
setRotation(configuration.startRotation)
}
}
teardown {
test {
imeApp.exit()
setRotation(Surface.ROTATION_0)
}
}
transitions {
// open the soft keyboard
imeApp.openIME(wmHelper)
createTag(TAG_IME_VISIBLE)
// then close it again
imeApp.closeIME(wmHelper)
}
assertions {
presubmit {
windowManagerTrace {
// Ensure the pip window remains visible throughout
// any keyboard interactions
all("pipInVisibleBounds") {
val displayBounds = WindowUtils.getDisplayBounds(
configuration.startRotation)
coversAtMostRegion(pipApp.defaultWindowName, displayBounds)
}
// Ensure that the pip window does not obscure the keyboard
tag(TAG_IME_VISIBLE) {
isAboveWindow(IME_WINDOW_NAME, pipApp.defaultWindowName)
}
}
}
}
}
return FlickerTestRunnerFactory.getInstance().buildTest(instrumentation,
testSpec, supportedRotations = listOf(Surface.ROTATION_0),
repetitions = 5)
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance()
.getConfigNonRotationTests(supportedRotations = listOf(Surface.ROTATION_0),
repetitions = 5)
}
}
}

View File

@@ -16,21 +16,25 @@
package com.android.wm.shell.flicker.pip
import android.os.Bundle
import android.platform.test.annotations.Postsubmit
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import com.android.server.wm.flicker.dsl.runFlicker
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.server.wm.flicker.helpers.exitSplitScreen
import com.android.server.wm.flicker.helpers.isInSplitScreen
import com.android.server.wm.flicker.helpers.launchSplitScreen
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
import com.android.wm.shell.flicker.helpers.ImeAppHelper
import com.android.wm.shell.flicker.helpers.FixedAppHelper
import com.android.wm.shell.flicker.helpers.PipAppHelper
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
import com.android.server.wm.flicker.repetitions
import com.android.server.wm.flicker.startRotation
import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible
import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
import com.android.wm.shell.flicker.removeAllTasksButHome
import com.android.wm.shell.flicker.testapp.Components.PipActivity.EXTRA_ENTER_PIP
@@ -46,83 +50,103 @@ import org.junit.runners.Parameterized
*/
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@FlakyTest(bugId = 161435597)
class PipLegacySplitScreenTest(
rotationName: String,
rotation: Int
) : AppTestBase(rotationName, rotation) {
private val pipApp = PipAppHelper(instrumentation)
class PipLegacySplitScreenTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) {
private val imeApp = ImeAppHelper(instrumentation)
private val testApp = FixedAppHelper(instrumentation)
private val displayBounds = WindowUtils.getDisplayBounds(testSpec.config.startRotation)
@Test
fun testShowsPipLaunchingToSplitScreen() {
runFlicker(instrumentation) {
withTestName { "testShowsPipLaunchingToSplitScreen" }
repeat { TEST_REPETITIONS }
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = {
withTestName { testSpec.name }
repeat { testSpec.config.repetitions }
setup {
test {
removeAllTasksButHome()
device.wakeUpAndGoToHomeScreen()
pipApp.launchViaIntent(stringExtras = mapOf(EXTRA_ENTER_PIP to "true"))
waitForAnimationComplete()
pipApp.launchViaIntent(stringExtras = mapOf(EXTRA_ENTER_PIP to "true"),
wmHelper = wmHelper)
}
}
transitions {
testApp.launchViaIntent()
testApp.launchViaIntent(wmHelper)
device.launchSplitScreen(wmHelper)
imeApp.launchViaIntent()
waitForAnimationComplete()
imeApp.launchViaIntent(wmHelper)
}
teardown {
eachRun {
imeApp.exit()
if (device.isInSplitScreen()) {
device.exitSplitScreen()
}
testApp.exit()
imeApp.exit(wmHelper)
testApp.exit(wmHelper)
}
test {
removeAllTasksButHome()
}
}
assertions {
val displayBounds = WindowUtils.getDisplayBounds(rotation)
windowManagerTrace {
all("PIP window must remain inside visible bounds") {
coversAtMostRegion(pipApp.defaultWindowName, displayBounds)
}
end("Both app windows should be visible") {
isVisible(testApp.defaultWindowName)
isVisible(imeApp.defaultWindowName)
noWindowsOverlap(setOf(testApp.defaultWindowName, imeApp.defaultWindowName))
}
navBarWindowIsAlwaysVisible()
statusBarWindowIsAlwaysVisible()
}
layersTrace {
all("PIP layer must remain inside visible bounds") {
coversAtMostRegion(displayBounds, pipApp.defaultWindowName)
}
end("Both app layers should be visible") {
coversAtMostRegion(displayBounds, testApp.defaultWindowName)
coversAtMostRegion(displayBounds, imeApp.defaultWindowName)
}
navBarLayerIsAlwaysVisible()
statusBarLayerIsAlwaysVisible()
}
}
}
@Postsubmit
@Test
fun pipWindowInsideDisplayBounds() {
testSpec.assertWm {
coversAtMostRegion(pipApp.defaultWindowName, displayBounds)
}
}
companion object {
const val TEST_REPETITIONS = 2
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<Array<Any>> {
val supportedRotations = intArrayOf(Surface.ROTATION_0)
return supportedRotations.map { arrayOf(Surface.rotationToString(it), it) }
@Postsubmit
@Test
fun bothAppWindowsVisible() {
testSpec.assertWmEnd {
isVisible(testApp.defaultWindowName)
isVisible(imeApp.defaultWindowName)
noWindowsOverlap(setOf(testApp.defaultWindowName, imeApp.defaultWindowName))
}
}
}
@Postsubmit
@Test
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
@Postsubmit
@Test
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
@Postsubmit
@Test
fun pipLayerInsideDisplayBounds() {
testSpec.assertLayers {
coversAtMostRegion(displayBounds, pipApp.defaultWindowName)
}
}
@Postsubmit
@Test
fun bothAppLayersVisible() {
testSpec.assertLayersEnd {
coversAtMostRegion(displayBounds, testApp.defaultWindowName)
coversAtMostRegion(displayBounds, imeApp.defaultWindowName)
}
}
@Postsubmit
@Test
fun navBarLayerIsAlwaysVisible() = testSpec.navBarLayerIsAlwaysVisible()
@Postsubmit
@Test
fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsAlwaysVisible()
companion object {
const val TEST_REPETITIONS = 2
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests(
supportedRotations = listOf(Surface.ROTATION_0),
repetitions = TEST_REPETITIONS
)
}
}
}

View File

@@ -16,11 +16,15 @@
package com.android.wm.shell.flicker.pip
import android.os.Bundle
import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerTestRunner
import com.android.server.wm.flicker.FlickerTestRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.endRotation
import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.server.wm.flicker.helpers.setRotation
@@ -34,6 +38,7 @@ import com.android.server.wm.flicker.noUncoveredRegions
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
@@ -44,73 +49,91 @@ import org.junit.runners.Parameterized
*/
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class PipRotationTest(
testSpec: FlickerTestRunnerFactory.TestSpec
) : FlickerTestRunner(testSpec) {
companion object : PipTransitionBase(InstrumentationRegistry.getInstrumentation()) {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<Array<Any>> {
val fixedApp = FixedAppHelper(instrumentation)
val testSpec = getTransition(eachRun = false) { configuration ->
setup {
test {
fixedApp.launchViaIntent(wmHelper)
}
eachRun {
setRotation(configuration.startRotation)
}
class PipRotationTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) {
private val fixedApp = FixedAppHelper(instrumentation)
private val startingBounds = WindowUtils.getDisplayBounds(testSpec.config.startRotation)
private val endingBounds = WindowUtils.getDisplayBounds(testSpec.config.endRotation)
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = buildTransition(eachRun = false) { configuration ->
setup {
test {
fixedApp.launchViaIntent(wmHelper)
}
transitions {
setRotation(configuration.endRotation)
}
teardown {
eachRun {
setRotation(Surface.ROTATION_0)
}
}
assertions {
val startingBounds = WindowUtils.getDisplayBounds(configuration.startRotation)
val endingBounds = WindowUtils.getDisplayBounds(configuration.endRotation)
presubmit {
windowManagerTrace {
navBarWindowIsAlwaysVisible()
statusBarWindowIsAlwaysVisible()
}
layersTrace {
noUncoveredRegions(configuration.startRotation,
configuration.endRotation, allStates = false)
}
}
flaky {
layersTrace {
navBarLayerIsAlwaysVisible(bugId = 140855415)
statusBarLayerIsAlwaysVisible(bugId = 140855415)
navBarLayerRotatesAndScales(configuration.startRotation,
configuration.endRotation, bugId = 140855415)
statusBarLayerRotatesScales(configuration.startRotation,
configuration.endRotation, bugId = 140855415)
start("appLayerRotates_StartingBounds", bugId = 140855415) {
hasVisibleRegion(fixedApp.defaultWindowName, startingBounds)
coversAtMostRegion(startingBounds, pipApp.defaultWindowName)
}
end("appLayerRotates_EndingBounds", bugId = 140855415) {
hasVisibleRegion(fixedApp.defaultWindowName, endingBounds)
coversAtMostRegion(endingBounds, pipApp.defaultWindowName)
}
}
}
eachRun {
setRotation(configuration.startRotation)
}
}
transitions {
setRotation(configuration.endRotation)
}
teardown {
eachRun {
setRotation(Surface.ROTATION_0)
}
}
}
return FlickerTestRunnerFactory.getInstance().buildRotationTest(instrumentation,
testSpec, supportedRotations = listOf(Surface.ROTATION_0, Surface.ROTATION_90),
@Presubmit
@Test
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun noUncoveredRegions() = testSpec.noUncoveredRegions(testSpec.config.startRotation,
testSpec.config.endRotation, allStates = false)
@FlakyTest(bugId = 140855415)
@Test
fun navBarLayerIsAlwaysVisible() = testSpec.navBarLayerIsAlwaysVisible()
@FlakyTest(bugId = 140855415)
@Test
fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsAlwaysVisible()
@FlakyTest(bugId = 140855415)
@Test
fun navBarLayerRotatesAndScales() =
testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation,
testSpec.config.endRotation)
@FlakyTest(bugId = 140855415)
@Test
fun statusBarLayerRotatesScales() =
testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation,
testSpec.config.endRotation)
@FlakyTest(bugId = 140855415)
@Test
fun appLayerRotates_StartingBounds() {
testSpec.assertLayersStart {
hasVisibleRegion(fixedApp.defaultWindowName, startingBounds)
coversAtMostRegion(startingBounds, pipApp.defaultWindowName)
}
}
@FlakyTest(bugId = 140855415)
@Test
fun appLayerRotates_EndingBounds() {
testSpec.assertLayersEnd {
hasVisibleRegion(fixedApp.defaultWindowName, endingBounds)
coversAtMostRegion(endingBounds, pipApp.defaultWindowName)
}
}
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance().getConfigRotationTests(
supportedRotations = listOf(Surface.ROTATION_0, Surface.ROTATION_90),
repetitions = 5)
}
}
}
}

View File

@@ -16,13 +16,14 @@
package com.android.wm.shell.flicker.pip
import com.android.wm.shell.flicker.FlickerTestBase
import com.android.wm.shell.flicker.helpers.PipAppHelper
import org.junit.Before
abstract class PipTestBase(
rotationName: String,
rotation: Int
) : AppTestBase(rotationName, rotation) {
) : FlickerTestBase(rotationName, rotation) {
protected val testApp = PipAppHelper(instrumentation)
@Before

View File

@@ -16,11 +16,15 @@
package com.android.wm.shell.flicker.pip
import android.os.Bundle
import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerTestRunner
import com.android.server.wm.flicker.FlickerTestRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.focusChanges
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible
@@ -32,6 +36,7 @@ import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
@@ -42,73 +47,89 @@ import org.junit.runners.Parameterized
*/
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class PipToAppTest(
testSpec: FlickerTestRunnerFactory.TestSpec
) : FlickerTestRunner(testSpec) {
companion object : PipTransitionBase(InstrumentationRegistry.getInstrumentation()) {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): List<Array<Any>> {
val testSpec = getTransition(eachRun = true) { configuration ->
setup {
eachRun {
this.setRotation(configuration.startRotation)
}
}
teardown {
eachRun {
this.setRotation(Surface.ROTATION_0)
}
}
transitions {
pipApp.expandPipWindowToApp(wmHelper)
}
assertions {
presubmit {
windowManagerTrace {
navBarWindowIsAlwaysVisible()
statusBarWindowIsAlwaysVisible()
all("appReplacesPipWindow") {
this.showsAppWindow(PIP_WINDOW_TITLE)
.then()
.showsAppWindowOnTop(pipApp.launcherName)
}
}
layersTrace {
statusBarLayerIsAlwaysVisible()
statusBarLayerRotatesScales(configuration.startRotation,
Surface.ROTATION_0)
all("appReplacesPipLayer") {
this.showsLayer(PIP_WINDOW_TITLE)
.then()
.showsLayer(pipApp.launcherName)
}
}
}
flaky {
layersTrace {
navBarLayerIsAlwaysVisible(bugId = 140855415)
noUncoveredRegions(configuration.startRotation, Surface.ROTATION_0)
navBarLayerRotatesAndScales(configuration.startRotation,
Surface.ROTATION_0, bugId = 140855415)
}
eventLog {
focusChanges(
"NexusLauncherActivity", pipApp.launcherName,
"NexusLauncherActivity", bugId = 151179149)
}
}
class PipToAppTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) {
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = buildTransition(eachRun = true) { configuration ->
setup {
eachRun {
this.setRotation(configuration.startRotation)
}
}
teardown {
eachRun {
this.setRotation(Surface.ROTATION_0)
}
}
transitions {
pipApp.expandPipWindowToApp(wmHelper)
}
}
return FlickerTestRunnerFactory.getInstance().buildTest(instrumentation,
testSpec, supportedRotations = listOf(Surface.ROTATION_0), repetitions = 5)
@FlakyTest(bugId = 140855415)
@Test
fun navBarLayerIsAlwaysVisible() = testSpec.navBarLayerIsAlwaysVisible()
@Presubmit
@Test
fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsAlwaysVisible()
@Presubmit
@Test
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun appReplacesPipWindow() {
testSpec.assertWm {
this.showsAppWindow(PIP_WINDOW_TITLE)
.then()
.showsAppWindowOnTop(pipApp.launcherName)
}
}
@Presubmit
@Test
fun statusBarLayerRotatesScales() =
testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0)
@Presubmit
@Test
fun appReplacesPipLayer() {
testSpec.assertLayers {
this.showsLayer(PIP_WINDOW_TITLE)
.then()
.showsLayer(pipApp.launcherName)
}
}
@FlakyTest
@Test
fun noUncoveredRegions() =
testSpec.noUncoveredRegions(testSpec.config.startRotation, Surface.ROTATION_0)
@FlakyTest(bugId = 140855415)
@Test
fun navBarLayerRotatesAndScales() =
testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0)
@FlakyTest(bugId = 151179149)
@Test
fun focusChanges() = testSpec.focusChanges("NexusLauncherActivity",
pipApp.launcherName, "NexusLauncherActivity")
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): List<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance()
.getConfigNonRotationTests(supportedRotations = listOf(Surface.ROTATION_0),
repetitions = 5)
}
}
}

View File

@@ -16,15 +16,19 @@
package com.android.wm.shell.flicker.pip
import android.os.Bundle
import android.platform.test.annotations.Postsubmit
import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerTestRunner
import com.android.server.wm.flicker.FlickerTestRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.focusChanges
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
import com.android.server.wm.flicker.noUncoveredRegions
import com.android.server.wm.flicker.startRotation
@@ -32,6 +36,7 @@ import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
@@ -42,74 +47,88 @@ import org.junit.runners.Parameterized
*/
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class PipToHomeTest(
testSpec: FlickerTestRunnerFactory.TestSpec
) : FlickerTestRunner(testSpec) {
companion object : PipTransitionBase(InstrumentationRegistry.getInstrumentation()) {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): List<Array<Any>> {
val testSpec = getTransition(eachRun = true) { configuration ->
setup {
eachRun {
this.setRotation(configuration.startRotation)
}
}
teardown {
eachRun {
this.setRotation(Surface.ROTATION_0)
}
}
transitions {
pipApp.closePipWindow(wmHelper)
}
assertions {
presubmit {
windowManagerTrace {
navBarWindowIsAlwaysVisible()
statusBarWindowIsAlwaysVisible()
all("pipWindowBecomesInvisible") {
this.showsAppWindow(PIP_WINDOW_TITLE)
.then()
.hidesAppWindow(PIP_WINDOW_TITLE)
}
}
layersTrace {
statusBarLayerIsAlwaysVisible()
statusBarLayerRotatesScales(configuration.startRotation,
Surface.ROTATION_0)
all("pipLayerBecomesInvisible") {
this.showsLayer(PIP_WINDOW_TITLE)
.then()
.hidesLayer(PIP_WINDOW_TITLE)
}
}
}
postsubmit {
layersTrace {
navBarLayerIsAlwaysVisible()
noUncoveredRegions(configuration.startRotation, Surface.ROTATION_0)
navBarLayerRotatesAndScales(configuration.startRotation,
Surface.ROTATION_0)
}
}
flaky {
eventLog {
focusChanges(pipApp.launcherName, "NexusLauncherActivity",
bugId = 151179149)
}
}
class PipToHomeTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) {
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = buildTransition(eachRun = true) { configuration ->
setup {
eachRun {
this.setRotation(configuration.startRotation)
}
}
teardown {
eachRun {
this.setRotation(Surface.ROTATION_0)
}
}
transitions {
pipApp.closePipWindow(wmHelper)
}
}
return FlickerTestRunnerFactory.getInstance().buildTest(instrumentation,
testSpec, supportedRotations = listOf(Surface.ROTATION_0), repetitions = 5)
@Postsubmit
@Test
fun navBarLayerIsAlwaysVisible() = testSpec.navBarLayerIsAlwaysVisible()
@Presubmit
@Test
fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsAlwaysVisible()
@Presubmit
@Test
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun pipWindowBecomesInvisible() {
testSpec.assertWm {
this.showsAppWindow(PIP_WINDOW_TITLE)
.then()
.hidesAppWindow(PIP_WINDOW_TITLE)
}
}
@Presubmit
@Test
fun pipLayerBecomesInvisible() {
testSpec.assertLayers {
this.showsLayer(PIP_WINDOW_TITLE)
.then()
.hidesLayer(PIP_WINDOW_TITLE)
}
}
@Presubmit
@Test
fun statusBarLayerRotatesScales() =
testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0)
@Postsubmit
@Test
fun noUncoveredRegions() =
testSpec.noUncoveredRegions(testSpec.config.startRotation, Surface.ROTATION_0)
@Postsubmit
@Test
fun navBarLayerRotatesAndScales() =
testSpec.noUncoveredRegions(testSpec.config.startRotation, Surface.ROTATION_0)
@FlakyTest(bugId = 151179149)
@Test
fun focusChanges() = testSpec.focusChanges(pipApp.launcherName, "NexusLauncherActivity")
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): List<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance()
.getConfigNonRotationTests(supportedRotations = listOf(Surface.ROTATION_0),
repetitions = 5)
}
}
}

View File

@@ -20,16 +20,26 @@ import android.app.Instrumentation
import android.content.Intent
import android.os.Bundle
import android.view.Surface
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.buildTestTag
import com.android.server.wm.flicker.helpers.isRotated
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
import com.android.server.wm.flicker.repetitions
import com.android.server.wm.flicker.startRotation
import com.android.wm.shell.flicker.helpers.PipAppHelper
import com.android.wm.shell.flicker.removeAllTasksButHome
import com.android.wm.shell.flicker.testapp.Components
abstract class PipTransitionBase(protected val instrumentation: Instrumentation) {
abstract class PipTransition(protected val testSpec: FlickerTestParameter) {
protected val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
protected val isRotated = testSpec.config.startRotation.isRotated()
protected val pipApp = PipAppHelper(instrumentation)
protected val broadcastActionTrigger = BroadcastActionTrigger(instrumentation)
protected abstract val transition: FlickerBuilder.(Bundle) -> Unit
// Helper class to process test actions by broadcast.
protected class BroadcastActionTrigger(private val instrumentation: Instrumentation) {
private fun createIntentWithAction(broadcastAction: String): Intent {
@@ -59,16 +69,20 @@ abstract class PipTransitionBase(protected val instrumentation: Instrumentation)
}
}
protected val pipApp = PipAppHelper(instrumentation)
protected val broadcastActionTrigger = BroadcastActionTrigger(instrumentation)
@FlickerBuilderProvider
fun buildFlicker(): FlickerBuilder {
return FlickerBuilder(instrumentation).apply {
withTestName { testSpec.name }
repeat { testSpec.config.repetitions }
transition(this, testSpec.config)
}
}
/**
* Gets a configuration that handles basic setup and teardown of pip tests
*/
protected val setupAndTeardown: FlickerBuilder.(Bundle) -> Unit
get() = { configuration ->
withTestName { buildTestTag(configuration) }
repeat { configuration.repetitions }
get() = {
setup {
test {
removeAllTasksButHome()
@@ -81,7 +95,7 @@ abstract class PipTransitionBase(protected val instrumentation: Instrumentation)
}
test {
removeAllTasksButHome()
pipApp.exit()
pipApp.exit(wmHelper)
}
}
}
@@ -95,7 +109,7 @@ abstract class PipTransitionBase(protected val instrumentation: Instrumentation)
* @param extraSpec Addicional segment of flicker specification
*/
@JvmOverloads
open fun getTransition(
protected open fun buildTransition(
eachRun: Boolean,
stringExtras: Map<String, String> = mapOf(Components.PipActivity.EXTRA_ENTER_PIP to "true"),
extraSpec: FlickerBuilder.(Bundle) -> Unit = {}
@@ -121,12 +135,12 @@ abstract class PipTransitionBase(protected val instrumentation: Instrumentation)
teardown {
eachRun {
if (eachRun) {
pipApp.exit()
pipApp.exit(wmHelper)
}
}
test {
if (!eachRun) {
pipApp.exit()
pipApp.exit(wmHelper)
}
removeAllTasksButHome()
}

View File

@@ -16,21 +16,26 @@
package com.android.wm.shell.flicker.pip
import android.os.Bundle
import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerTestRunner
import com.android.server.wm.flicker.FlickerTestRunnerFactory
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
import com.android.wm.shell.flicker.pip.PipTransitionBase.BroadcastActionTrigger.Companion.ORIENTATION_LANDSCAPE
import com.android.wm.shell.flicker.pip.PipTransition.BroadcastActionTrigger.Companion.ORIENTATION_LANDSCAPE
import com.android.wm.shell.flicker.testapp.Components.FixedActivity.EXTRA_FIXED_ORIENTATION
import com.android.wm.shell.flicker.testapp.Components.PipActivity.EXTRA_ENTER_PIP
import org.junit.Assert.assertEquals
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
@@ -41,75 +46,99 @@ import org.junit.runners.Parameterized
*/
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class SetRequestedOrientationWhilePinnedTest(
testSpec: FlickerTestRunnerFactory.TestSpec
) : FlickerTestRunner(testSpec) {
companion object : PipTransitionBase(InstrumentationRegistry.getInstrumentation()) {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<Array<Any>> {
return FlickerTestRunnerFactory.getInstance().buildTest(instrumentation,
supportedRotations = listOf(Surface.ROTATION_0),
repetitions = 1) { configuration ->
setupAndTeardown(this, configuration)
testSpec: FlickerTestParameter
) : PipTransition(testSpec) {
private val startingBounds = WindowUtils.getDisplayBounds(Surface.ROTATION_0)
private val endingBounds = WindowUtils.getDisplayBounds(Surface.ROTATION_90)
setup {
eachRun {
// Launch the PiP activity fixed as landscape
pipApp.launchViaIntent(wmHelper, stringExtras = mapOf(
EXTRA_FIXED_ORIENTATION to ORIENTATION_LANDSCAPE.toString(),
EXTRA_ENTER_PIP to "true"))
}
}
teardown {
eachRun {
pipApp.exit()
}
}
transitions {
// Request that the orientation is set to landscape
broadcastActionTrigger.requestOrientationForPip(ORIENTATION_LANDSCAPE)
override val transition: FlickerBuilder.(Bundle) -> Unit
get() = { configuration ->
setupAndTeardown(this, configuration)
// Launch the activity back into fullscreen and
// ensure that it is now in landscape
pipApp.launchViaIntent(wmHelper)
wmHelper.waitForFullScreenApp(pipApp.component)
wmHelper.waitForRotation(Surface.ROTATION_90)
assertEquals(Surface.ROTATION_90, device.displayRotation)
}
assertions {
val startingBounds = WindowUtils.getDisplayBounds(Surface.ROTATION_0)
val endingBounds = WindowUtils.getDisplayBounds(Surface.ROTATION_90)
presubmit {
windowManagerTrace {
start("PIP window must remain inside display") {
coversAtMostRegion(pipApp.defaultWindowName, startingBounds)
}
end("pipApp shows on top") {
showsAppWindowOnTop(pipApp.defaultWindowName)
}
navBarWindowIsAlwaysVisible()
statusBarWindowIsAlwaysVisible()
}
layersTrace {
start("PIP layer must remain inside display") {
coversAtMostRegion(startingBounds, pipApp.defaultWindowName)
}
end("pipApp layer covers fullscreen") {
hasVisibleRegion(pipApp.defaultWindowName, endingBounds)
}
}
}
flaky {
layersTrace {
navBarLayerIsAlwaysVisible(bugId = 140855415)
statusBarLayerIsAlwaysVisible(bugId = 140855415)
}
}
setup {
eachRun {
// Launch the PiP activity fixed as landscape
pipApp.launchViaIntent(wmHelper, stringExtras = mapOf(
EXTRA_FIXED_ORIENTATION to ORIENTATION_LANDSCAPE.toString(),
EXTRA_ENTER_PIP to "true"))
}
}
teardown {
eachRun {
pipApp.exit(wmHelper)
}
}
transitions {
// Request that the orientation is set to landscape
broadcastActionTrigger.requestOrientationForPip(ORIENTATION_LANDSCAPE)
// Launch the activity back into fullscreen and
// ensure that it is now in landscape
pipApp.launchViaIntent(wmHelper)
wmHelper.waitForFullScreenApp(pipApp.component)
wmHelper.waitForRotation(Surface.ROTATION_90)
assertEquals(Surface.ROTATION_90, device.displayRotation)
}
}
@Presubmit
@Test
fun pipWindowInsideDisplay() {
testSpec.assertWmStart {
coversAtMostRegion(pipApp.defaultWindowName, startingBounds)
}
}
}
@Presubmit
@Test
fun pipAppShowsOnTop() {
testSpec.assertWmEnd {
showsAppWindowOnTop(pipApp.defaultWindowName)
}
}
@Presubmit
@Test
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
@Presubmit
@Test
fun pipLayerInsideDisplay() {
testSpec.assertLayersStart {
coversAtMostRegion(startingBounds, pipApp.defaultWindowName)
}
}
@Presubmit
@Test
fun pipAppLayerCoversFullScreen() {
testSpec.assertLayersEnd {
hasVisibleRegion(pipApp.defaultWindowName, endingBounds)
}
}
@FlakyTest(bugId = 140855415)
@Test
fun navBarLayerIsAlwaysVisible() = testSpec.navBarLayerIsAlwaysVisible()
@FlakyTest(bugId = 140855415)
@Test
fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsAlwaysVisible()
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun getParams(): Collection<FlickerTestParameter> {
return FlickerTestParameterFactory.getInstance()
.getConfigNonRotationTests(supportedRotations = listOf(Surface.ROTATION_0),
repetitions = 1)
}
}
}