Merge "Use FlickerParametersRunnerFactory" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
cd9b08647a
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
@@ -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)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,382 +17,91 @@
|
||||
package com.android.server.wm.flicker
|
||||
|
||||
import android.platform.helpers.IAppHelper
|
||||
import com.android.server.wm.flicker.dsl.EventLogAssertionBuilder
|
||||
import com.android.server.wm.flicker.dsl.EventLogAssertionBuilderLegacy
|
||||
import com.android.server.wm.flicker.dsl.LayersAssertionBuilder
|
||||
import com.android.server.wm.flicker.dsl.LayersAssertionBuilderLegacy
|
||||
import com.android.server.wm.flicker.dsl.WmAssertionBuilder
|
||||
import com.android.server.wm.flicker.dsl.WmAssertionBuilderLegacy
|
||||
import com.android.server.wm.flicker.helpers.WindowUtils
|
||||
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper.Companion.NAV_BAR_LAYER_NAME
|
||||
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper.Companion.NAV_BAR_WINDOW_NAME
|
||||
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper.Companion.STATUS_BAR_LAYER_NAME
|
||||
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper.Companion.STATUS_BAR_WINDOW_NAME
|
||||
|
||||
const val APP_PAIR_SPLIT_DIVIDER = "AppPairSplitDivider"
|
||||
const val DOCKED_STACK_DIVIDER = "DockedStackDivider"
|
||||
const val WALLPAPER_TITLE = "Wallpaper"
|
||||
|
||||
@JvmOverloads
|
||||
fun WmAssertionBuilder.statusBarWindowIsAlwaysVisible(bugId: Int = 0) {
|
||||
all("statusBarWindowIsAlwaysVisible", bugId) {
|
||||
fun FlickerTestParameter.statusBarWindowIsAlwaysVisible() {
|
||||
assertWm {
|
||||
this.showsAboveAppWindow(NAV_BAR_LAYER_NAME)
|
||||
}
|
||||
}
|
||||
|
||||
fun FlickerTestParameter.navBarWindowIsAlwaysVisible() {
|
||||
assertWm {
|
||||
this.showsAboveAppWindow(NAV_BAR_LAYER_NAME)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun WmAssertionBuilder.navBarWindowIsAlwaysVisible(bugId: Int = 0) {
|
||||
all("navBarWindowIsAlwaysVisible", bugId) {
|
||||
this.showsAboveAppWindow(NAV_BAR_LAYER_NAME)
|
||||
}
|
||||
}
|
||||
|
||||
fun WmAssertionBuilder.visibleWindowsShownMoreThanOneConsecutiveEntry(
|
||||
ignoreWindows: List<String> = emptyList(),
|
||||
bugId: Int = 0
|
||||
fun FlickerTestParameter.visibleWindowsShownMoreThanOneConsecutiveEntry(
|
||||
ignoreWindows: List<String> = emptyList()
|
||||
) {
|
||||
all("visibleWindowsShownMoreThanOneConsecutiveEntry", bugId) {
|
||||
assertWm {
|
||||
this.visibleWindowsShownMoreThanOneConsecutiveEntry(ignoreWindows)
|
||||
}
|
||||
}
|
||||
|
||||
fun WmAssertionBuilder.launcherReplacesAppWindowAsTopWindow(testApp: IAppHelper, bugId: Int = 0) {
|
||||
all("launcherReplacesAppWindowAsTopWindow", bugId) {
|
||||
this.showsAppWindowOnTop(testApp.getPackage())
|
||||
.then()
|
||||
.showsAppWindowOnTop("Launcher")
|
||||
}
|
||||
}
|
||||
|
||||
fun WmAssertionBuilder.wallpaperWindowBecomesVisible(bugId: Int = 0) {
|
||||
all("wallpaperWindowBecomesVisible", bugId) {
|
||||
this.hidesBelowAppWindow(WALLPAPER_TITLE)
|
||||
.then()
|
||||
.showsBelowAppWindow(WALLPAPER_TITLE)
|
||||
}
|
||||
}
|
||||
|
||||
fun WmAssertionBuilder.wallpaperWindowBecomesInvisible(bugId: Int = 0) {
|
||||
all("wallpaperWindowBecomesInvisible", bugId) {
|
||||
this.showsBelowAppWindow("Wallpaper")
|
||||
.then()
|
||||
.hidesBelowAppWindow("Wallpaper")
|
||||
}
|
||||
}
|
||||
|
||||
fun WmAssertionBuilder.appWindowAlwaysVisibleOnTop(
|
||||
packageName: String,
|
||||
bugId: Int = 0
|
||||
) {
|
||||
all("appWindowAlwaysVisibleOnTop", bugId) {
|
||||
this.showsAppWindowOnTop(packageName)
|
||||
}
|
||||
}
|
||||
|
||||
fun WmAssertionBuilder.appWindowBecomesVisible(appName: String, bugId: Int = 0) {
|
||||
all("appWindowBecomesVisible", bugId) {
|
||||
this.hidesAppWindow(appName)
|
||||
.then()
|
||||
.showsAppWindow(appName)
|
||||
}
|
||||
}
|
||||
|
||||
fun WmAssertionBuilder.appWindowBecomesInVisible(appName: String, bugId: Int = 0) {
|
||||
all("appWindowBecomesInVisible", bugId) {
|
||||
this.showsAppWindow(appName)
|
||||
.then()
|
||||
.hidesAppWindow(appName)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun LayersAssertionBuilder.noUncoveredRegions(
|
||||
beginRotation: Int,
|
||||
endRotation: Int = beginRotation,
|
||||
allStates: Boolean = true,
|
||||
bugId: Int = 0
|
||||
) {
|
||||
val startingBounds = WindowUtils.getDisplayBounds(beginRotation)
|
||||
val endingBounds = WindowUtils.getDisplayBounds(endRotation)
|
||||
if (allStates) {
|
||||
all("noUncoveredRegions", bugId) {
|
||||
if (startingBounds == endingBounds) {
|
||||
this.coversAtLeastRegion(startingBounds)
|
||||
} else {
|
||||
this.coversAtLeastRegion(startingBounds)
|
||||
.then()
|
||||
.coversAtLeastRegion(endingBounds)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
start("noUncoveredRegions_StartingPos") {
|
||||
this.coversAtLeastRegion(startingBounds)
|
||||
}
|
||||
end("noUncoveredRegions_EndingPos") {
|
||||
this.coversAtLeastRegion(endingBounds)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun LayersAssertionBuilder.navBarLayerIsAlwaysVisible(
|
||||
rotatesScreen: Boolean = false,
|
||||
bugId: Int = 0
|
||||
) {
|
||||
if (rotatesScreen) {
|
||||
all("navBarLayerIsAlwaysVisible", bugId) {
|
||||
this.showsLayer(NAV_BAR_LAYER_NAME)
|
||||
.then()
|
||||
.hidesLayer(NAV_BAR_LAYER_NAME)
|
||||
.then()
|
||||
.showsLayer(NAV_BAR_LAYER_NAME)
|
||||
}
|
||||
} else {
|
||||
all("navBarLayerIsAlwaysVisible", bugId) {
|
||||
this.showsLayer(NAV_BAR_LAYER_NAME)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun LayersAssertionBuilder.statusBarLayerIsAlwaysVisible(
|
||||
rotatesScreen: Boolean = false,
|
||||
bugId: Int = 0
|
||||
) {
|
||||
if (rotatesScreen) {
|
||||
all("statusBarLayerIsAlwaysVisible", bugId) {
|
||||
this.showsLayer(STATUS_BAR_WINDOW_NAME)
|
||||
.then()
|
||||
hidesLayer(STATUS_BAR_WINDOW_NAME)
|
||||
.then()
|
||||
.showsLayer(STATUS_BAR_WINDOW_NAME)
|
||||
}
|
||||
} else {
|
||||
all("statusBarLayerIsAlwaysVisible", bugId) {
|
||||
this.showsLayer(STATUS_BAR_WINDOW_NAME)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun LayersAssertionBuilder.navBarLayerRotatesAndScales(
|
||||
beginRotation: Int,
|
||||
endRotation: Int = beginRotation,
|
||||
bugId: Int = 0
|
||||
) {
|
||||
val startingPos = WindowUtils.getNavigationBarPosition(beginRotation)
|
||||
val endingPos = WindowUtils.getNavigationBarPosition(endRotation)
|
||||
|
||||
start("navBarLayerRotatesAndScales_StartingPos", bugId) {
|
||||
this.hasVisibleRegion(NAV_BAR_LAYER_NAME, startingPos)
|
||||
}
|
||||
end("navBarLayerRotatesAndScales_EndingPost", bugId) {
|
||||
this.hasVisibleRegion(NAV_BAR_LAYER_NAME, endingPos)
|
||||
}
|
||||
|
||||
/*if (startingPos == endingPos) {
|
||||
all("navBarLayerRotatesAndScales", enabled = false, bugId = 167747321) {
|
||||
this.hasVisibleRegion(NAVIGATION_BAR_WINDOW_TITLE, startingPos)
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun LayersAssertionBuilder.statusBarLayerRotatesScales(
|
||||
beginRotation: Int,
|
||||
endRotation: Int = beginRotation,
|
||||
bugId: Int = 0
|
||||
) {
|
||||
val startingPos = WindowUtils.getStatusBarPosition(beginRotation)
|
||||
val endingPos = WindowUtils.getStatusBarPosition(endRotation)
|
||||
|
||||
start("statusBarLayerRotatesScales_StartingPos", bugId) {
|
||||
this.hasVisibleRegion(STATUS_BAR_WINDOW_NAME, startingPos)
|
||||
}
|
||||
end("statusBarLayerRotatesScales_EndingPos", bugId) {
|
||||
this.hasVisibleRegion(STATUS_BAR_WINDOW_NAME, endingPos)
|
||||
}
|
||||
}
|
||||
|
||||
fun LayersAssertionBuilder.visibleLayersShownMoreThanOneConsecutiveEntry(
|
||||
ignoreLayers: List<String> = emptyList(),
|
||||
bugId: Int = 0
|
||||
) {
|
||||
all("visibleLayersShownMoreThanOneConsecutiveEntry", bugId) {
|
||||
this.visibleLayersShownMoreThanOneConsecutiveEntry(ignoreLayers)
|
||||
}
|
||||
}
|
||||
|
||||
fun LayersAssertionBuilder.appLayerReplacesWallpaperLayer(appName: String, bugId: Int = 0) {
|
||||
all("appLayerReplacesWallpaperLayer", bugId) {
|
||||
this.showsLayer("Wallpaper")
|
||||
.then()
|
||||
.replaceVisibleLayer("Wallpaper", appName)
|
||||
}
|
||||
}
|
||||
|
||||
fun LayersAssertionBuilder.wallpaperLayerReplacesAppLayer(testApp: IAppHelper, bugId: Int = 0) {
|
||||
all("appLayerReplacesWallpaperLayer", bugId) {
|
||||
this.showsLayer(testApp.getPackage())
|
||||
.then()
|
||||
.replaceVisibleLayer(testApp.getPackage(), WALLPAPER_TITLE)
|
||||
}
|
||||
}
|
||||
|
||||
fun LayersAssertionBuilder.layerAlwaysVisible(packageName: String, bugId: Int = 0) {
|
||||
all("layerAlwaysVisible", bugId) {
|
||||
this.showsLayer(packageName)
|
||||
}
|
||||
}
|
||||
|
||||
fun LayersAssertionBuilder.layerBecomesVisible(packageName: String, bugId: Int = 0) {
|
||||
all("layerBecomesVisible", bugId) {
|
||||
this.hidesLayer(packageName)
|
||||
.then()
|
||||
.showsLayer(packageName)
|
||||
}
|
||||
}
|
||||
|
||||
fun LayersAssertionBuilder.layerBecomesInvisible(packageName: String, bugId: Int = 0) {
|
||||
all("layerBecomesInvisible", bugId) {
|
||||
this.showsLayer(packageName)
|
||||
.then()
|
||||
.hidesLayer(packageName)
|
||||
}
|
||||
}
|
||||
|
||||
fun EventLogAssertionBuilder.focusChanges(vararg windows: String, bugId: Int = 0) {
|
||||
all("focusChanges", bugId) {
|
||||
this.focusChanges(windows)
|
||||
}
|
||||
}
|
||||
|
||||
fun EventLogAssertionBuilder.focusDoesNotChange(bugId: Int = 0) {
|
||||
all("focusDoesNotChange", bugId) {
|
||||
this.focusDoesNotChange()
|
||||
}
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
|
||||
fun WmAssertionBuilderLegacy.statusBarWindowIsAlwaysVisible(
|
||||
bugId: Int = 0,
|
||||
enabled: Boolean = bugId == 0
|
||||
) {
|
||||
all("statusBarWindowIsAlwaysVisible", bugId, enabled) {
|
||||
this.showsAboveAppWindow(STATUS_BAR_WINDOW_NAME)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
|
||||
fun WmAssertionBuilderLegacy.navBarWindowIsAlwaysVisible(
|
||||
bugId: Int = 0,
|
||||
enabled: Boolean = bugId == 0
|
||||
) {
|
||||
all("navBarWindowIsAlwaysVisible", bugId, enabled) {
|
||||
this.showsAboveAppWindow(NAV_BAR_WINDOW_NAME)
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
|
||||
fun WmAssertionBuilderLegacy.visibleWindowsShownMoreThanOneConsecutiveEntry(
|
||||
ignoreWindows: List<String> = emptyList(),
|
||||
bugId: Int = 0,
|
||||
enabled: Boolean = bugId == 0
|
||||
) {
|
||||
all("visibleWindowsShownMoreThanOneConsecutiveEntry", bugId, enabled) {
|
||||
this.visibleWindowsShownMoreThanOneConsecutiveEntry(ignoreWindows)
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
|
||||
fun WmAssertionBuilderLegacy.launcherReplacesAppWindowAsTopWindow(
|
||||
testApp: IAppHelper,
|
||||
bugId: Int = 0,
|
||||
enabled: Boolean = bugId == 0
|
||||
) {
|
||||
all("launcherReplacesAppWindowAsTopWindow", bugId, enabled) {
|
||||
fun FlickerTestParameter.launcherReplacesAppWindowAsTopWindow(testApp: IAppHelper) {
|
||||
assertWm {
|
||||
this.showsAppWindowOnTop(testApp.getPackage())
|
||||
.then()
|
||||
.showsAppWindowOnTop("Launcher")
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
|
||||
fun WmAssertionBuilderLegacy.wallpaperWindowBecomesVisible(
|
||||
bugId: Int = 0,
|
||||
enabled: Boolean = bugId == 0
|
||||
) {
|
||||
all("wallpaperWindowBecomesVisible", bugId, enabled) {
|
||||
fun FlickerTestParameter.wallpaperWindowBecomesVisible() {
|
||||
assertWm {
|
||||
this.hidesBelowAppWindow(WALLPAPER_TITLE)
|
||||
.then()
|
||||
.showsBelowAppWindow(WALLPAPER_TITLE)
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
|
||||
fun WmAssertionBuilderLegacy.wallpaperWindowBecomesInvisible(
|
||||
bugId: Int = 0,
|
||||
enabled: Boolean = bugId == 0
|
||||
) {
|
||||
all("wallpaperWindowBecomesInvisible", bugId, enabled) {
|
||||
fun FlickerTestParameter.wallpaperWindowBecomesInvisible() {
|
||||
assertWm {
|
||||
this.showsBelowAppWindow("Wallpaper")
|
||||
.then()
|
||||
.hidesBelowAppWindow("Wallpaper")
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
|
||||
fun WmAssertionBuilderLegacy.appWindowAlwaysVisibleOnTop(
|
||||
packageName: String,
|
||||
bugId: Int = 0,
|
||||
enabled: Boolean = bugId == 0
|
||||
) {
|
||||
all("appWindowAlwaysVisibleOnTop", bugId, enabled) {
|
||||
fun FlickerTestParameter.appWindowAlwaysVisibleOnTop(packageName: String) {
|
||||
assertWm {
|
||||
this.showsAppWindowOnTop(packageName)
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
|
||||
fun WmAssertionBuilderLegacy.appWindowBecomesVisible(
|
||||
appName: String,
|
||||
bugId: Int = 0,
|
||||
enabled: Boolean = bugId == 0
|
||||
) {
|
||||
all("appWindowBecomesVisible", bugId, enabled) {
|
||||
fun FlickerTestParameter.appWindowBecomesVisible(appName: String) {
|
||||
assertWm {
|
||||
this.hidesAppWindow(appName)
|
||||
.then()
|
||||
.showsAppWindow(appName)
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
|
||||
fun WmAssertionBuilderLegacy.appWindowBecomesInVisible(
|
||||
appName: String,
|
||||
bugId: Int = 0,
|
||||
enabled: Boolean = bugId == 0
|
||||
) {
|
||||
all("appWindowBecomesInVisible", bugId, enabled) {
|
||||
fun FlickerTestParameter.appWindowBecomesInVisible(appName: String) {
|
||||
assertWm {
|
||||
this.showsAppWindow(appName)
|
||||
.then()
|
||||
.hidesAppWindow(appName)
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
|
||||
@JvmOverloads
|
||||
fun LayersAssertionBuilderLegacy.noUncoveredRegions(
|
||||
fun FlickerTestParameter.noUncoveredRegions(
|
||||
beginRotation: Int,
|
||||
endRotation: Int = beginRotation,
|
||||
allStates: Boolean = true,
|
||||
bugId: Int = 0,
|
||||
enabled: Boolean = bugId == 0
|
||||
allStates: Boolean = true
|
||||
) {
|
||||
val startingBounds = WindowUtils.getDisplayBounds(beginRotation)
|
||||
val endingBounds = WindowUtils.getDisplayBounds(endRotation)
|
||||
if (allStates) {
|
||||
all("noUncoveredRegions", bugId, enabled) {
|
||||
assertLayers {
|
||||
if (startingBounds == endingBounds) {
|
||||
this.coversAtLeastRegion(startingBounds)
|
||||
} else {
|
||||
@@ -402,24 +111,19 @@ fun LayersAssertionBuilderLegacy.noUncoveredRegions(
|
||||
}
|
||||
}
|
||||
} else {
|
||||
start("noUncoveredRegions_StartingPos") {
|
||||
assertLayersStart {
|
||||
this.coversAtLeastRegion(startingBounds)
|
||||
}
|
||||
end("noUncoveredRegions_EndingPos") {
|
||||
assertLayersEnd {
|
||||
this.coversAtLeastRegion(endingBounds)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
|
||||
@JvmOverloads
|
||||
fun LayersAssertionBuilderLegacy.navBarLayerIsAlwaysVisible(
|
||||
rotatesScreen: Boolean = false,
|
||||
bugId: Int = 0,
|
||||
enabled: Boolean = bugId == 0
|
||||
) {
|
||||
fun FlickerTestParameter.navBarLayerIsAlwaysVisible(rotatesScreen: Boolean = false) {
|
||||
if (rotatesScreen) {
|
||||
all("navBarLayerIsAlwaysVisible", bugId, enabled) {
|
||||
assertLayers {
|
||||
this.showsLayer(NAV_BAR_LAYER_NAME)
|
||||
.then()
|
||||
.hidesLayer(NAV_BAR_LAYER_NAME)
|
||||
@@ -427,169 +131,116 @@ fun LayersAssertionBuilderLegacy.navBarLayerIsAlwaysVisible(
|
||||
.showsLayer(NAV_BAR_LAYER_NAME)
|
||||
}
|
||||
} else {
|
||||
all("navBarLayerIsAlwaysVisible", bugId, enabled) {
|
||||
assertLayers {
|
||||
this.showsLayer(NAV_BAR_LAYER_NAME)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
|
||||
@JvmOverloads
|
||||
fun LayersAssertionBuilderLegacy.statusBarLayerIsAlwaysVisible(
|
||||
rotatesScreen: Boolean = false,
|
||||
bugId: Int = 0,
|
||||
enabled: Boolean = bugId == 0
|
||||
) {
|
||||
fun FlickerTestParameter.statusBarLayerIsAlwaysVisible(rotatesScreen: Boolean = false) {
|
||||
if (rotatesScreen) {
|
||||
all("statusBarLayerIsAlwaysVisible", bugId, enabled) {
|
||||
this.showsLayer(STATUS_BAR_LAYER_NAME)
|
||||
assertLayers {
|
||||
this.showsLayer(STATUS_BAR_WINDOW_NAME)
|
||||
.then()
|
||||
.hidesLayer(STATUS_BAR_LAYER_NAME)
|
||||
hidesLayer(STATUS_BAR_WINDOW_NAME)
|
||||
.then()
|
||||
.showsLayer(STATUS_BAR_LAYER_NAME)
|
||||
.showsLayer(STATUS_BAR_WINDOW_NAME)
|
||||
}
|
||||
} else {
|
||||
all("statusBarLayerIsAlwaysVisible", bugId, enabled) {
|
||||
this.showsLayer(STATUS_BAR_LAYER_NAME)
|
||||
assertLayers {
|
||||
this.showsLayer(STATUS_BAR_WINDOW_NAME)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
|
||||
@JvmOverloads
|
||||
fun LayersAssertionBuilderLegacy.navBarLayerRotatesAndScales(
|
||||
fun FlickerTestParameter.navBarLayerRotatesAndScales(
|
||||
beginRotation: Int,
|
||||
endRotation: Int = beginRotation,
|
||||
bugId: Int = 0,
|
||||
enabled: Boolean = bugId == 0
|
||||
endRotation: Int = beginRotation
|
||||
) {
|
||||
val startingPos = WindowUtils.getNavigationBarPosition(beginRotation)
|
||||
val endingPos = WindowUtils.getNavigationBarPosition(endRotation)
|
||||
|
||||
start("navBarLayerRotatesAndScales_StartingPos", bugId, enabled) {
|
||||
assertLayersStart {
|
||||
this.hasVisibleRegion(NAV_BAR_LAYER_NAME, startingPos)
|
||||
}
|
||||
end("navBarLayerRotatesAndScales_EndingPost", bugId, enabled) {
|
||||
assertLayersEnd {
|
||||
this.hasVisibleRegion(NAV_BAR_LAYER_NAME, endingPos)
|
||||
}
|
||||
|
||||
if (startingPos == endingPos) {
|
||||
all("navBarLayerRotatesAndScales", enabled = false, bugId = 167747321) {
|
||||
this.hasVisibleRegion(NAV_BAR_LAYER_NAME, startingPos)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
|
||||
@JvmOverloads
|
||||
fun LayersAssertionBuilderLegacy.statusBarLayerRotatesScales(
|
||||
fun FlickerTestParameter.statusBarLayerRotatesScales(
|
||||
beginRotation: Int,
|
||||
endRotation: Int = beginRotation,
|
||||
bugId: Int = 0,
|
||||
enabled: Boolean = bugId == 0
|
||||
endRotation: Int = beginRotation
|
||||
) {
|
||||
val startingPos = WindowUtils.getStatusBarPosition(beginRotation)
|
||||
val endingPos = WindowUtils.getStatusBarPosition(endRotation)
|
||||
|
||||
start("statusBarLayerRotatesScales_StartingPos", bugId, enabled) {
|
||||
this.hasVisibleRegion(STATUS_BAR_LAYER_NAME, startingPos)
|
||||
assertLayersStart {
|
||||
this.hasVisibleRegion(STATUS_BAR_WINDOW_NAME, startingPos)
|
||||
}
|
||||
end("statusBarLayerRotatesScales_EndingPos", bugId, enabled) {
|
||||
this.hasVisibleRegion(STATUS_BAR_LAYER_NAME, endingPos)
|
||||
assertLayersEnd {
|
||||
this.hasVisibleRegion(STATUS_BAR_WINDOW_NAME, endingPos)
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
|
||||
fun LayersAssertionBuilderLegacy.visibleLayersShownMoreThanOneConsecutiveEntry(
|
||||
ignoreLayers: List<String> = kotlin.collections.emptyList(),
|
||||
bugId: Int = 0,
|
||||
enabled: Boolean = bugId == 0
|
||||
@JvmOverloads
|
||||
fun FlickerTestParameter.visibleLayersShownMoreThanOneConsecutiveEntry(
|
||||
ignoreLayers: List<String> = emptyList()
|
||||
) {
|
||||
all("visibleLayersShownMoreThanOneConsecutiveEntry", bugId, enabled) {
|
||||
assertLayers {
|
||||
this.visibleLayersShownMoreThanOneConsecutiveEntry(ignoreLayers)
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
|
||||
fun LayersAssertionBuilderLegacy.appLayerReplacesWallpaperLayer(
|
||||
appName: String,
|
||||
bugId: Int = 0,
|
||||
enabled: Boolean = bugId == 0
|
||||
) {
|
||||
all("appLayerReplacesWallpaperLayer", bugId, enabled) {
|
||||
fun FlickerTestParameter.appLayerReplacesWallpaperLayer(appName: String) {
|
||||
assertLayers {
|
||||
this.showsLayer("Wallpaper")
|
||||
.then()
|
||||
.replaceVisibleLayer("Wallpaper", appName)
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
|
||||
fun LayersAssertionBuilderLegacy.wallpaperLayerReplacesAppLayer(
|
||||
testApp: IAppHelper,
|
||||
bugId: Int = 0,
|
||||
enabled: Boolean = bugId == 0
|
||||
) {
|
||||
all("appLayerReplacesWallpaperLayer", bugId, enabled) {
|
||||
fun FlickerTestParameter.wallpaperLayerReplacesAppLayer(testApp: IAppHelper) {
|
||||
assertLayers {
|
||||
this.showsLayer(testApp.getPackage())
|
||||
.then()
|
||||
.replaceVisibleLayer(testApp.getPackage(), WALLPAPER_TITLE)
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
|
||||
fun LayersAssertionBuilderLegacy.layerAlwaysVisible(
|
||||
packageName: String,
|
||||
bugId: Int = 0,
|
||||
enabled: Boolean = bugId == 0
|
||||
) {
|
||||
all("layerAlwaysVisible", bugId, enabled) {
|
||||
fun FlickerTestParameter.layerAlwaysVisible(packageName: String) {
|
||||
assertLayers {
|
||||
this.showsLayer(packageName)
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
|
||||
fun LayersAssertionBuilderLegacy.layerBecomesVisible(
|
||||
packageName: String,
|
||||
bugId: Int = 0,
|
||||
enabled: Boolean = bugId == 0
|
||||
) {
|
||||
all("layerBecomesVisible", bugId, enabled) {
|
||||
fun FlickerTestParameter.layerBecomesVisible(packageName: String) {
|
||||
assertLayers {
|
||||
this.hidesLayer(packageName)
|
||||
.then()
|
||||
.showsLayer(packageName)
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
|
||||
fun LayersAssertionBuilderLegacy.layerBecomesInvisible(
|
||||
packageName: String,
|
||||
bugId: Int = 0,
|
||||
enabled: Boolean = bugId == 0
|
||||
) {
|
||||
all("layerBecomesInvisible", bugId, enabled) {
|
||||
fun FlickerTestParameter.layerBecomesInvisible(packageName: String) {
|
||||
assertLayers {
|
||||
this.showsLayer(packageName)
|
||||
.then()
|
||||
.hidesLayer(packageName)
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
|
||||
fun EventLogAssertionBuilderLegacy.focusChanges(
|
||||
vararg windows: String,
|
||||
bugId: Int = 0,
|
||||
enabled: Boolean = bugId == 0
|
||||
) {
|
||||
all("focusChanges", bugId, enabled) {
|
||||
fun FlickerTestParameter.focusChanges(vararg windows: String) {
|
||||
assertEventLog {
|
||||
this.focusChanges(windows)
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Move the assertion into one of the specific blocks (presubmit, postsubmit, flaky)")
|
||||
fun EventLogAssertionBuilderLegacy.focusDoesNotChange(
|
||||
bugId: Int = 0,
|
||||
enabled: Boolean = bugId == 0
|
||||
) {
|
||||
all("focusDoesNotChange", bugId, enabled) {
|
||||
fun FlickerTestParameter.focusDoesNotChange() {
|
||||
assertEventLog {
|
||||
this.focusDoesNotChange()
|
||||
}
|
||||
}
|
||||
@@ -16,11 +16,17 @@
|
||||
|
||||
package com.android.server.wm.flicker.close
|
||||
|
||||
import android.app.Instrumentation
|
||||
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.FlickerTestRunnerFactory
|
||||
import com.android.server.wm.flicker.FlickerTestRunner
|
||||
import com.android.server.wm.flicker.FlickerBuilderProvider
|
||||
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.SimpleAppHelper
|
||||
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
|
||||
@@ -35,12 +41,12 @@ import com.android.server.wm.flicker.statusBarLayerRotatesScales
|
||||
import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry
|
||||
import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry
|
||||
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
|
||||
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.repetitions
|
||||
import com.android.server.wm.flicker.startRotation
|
||||
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
|
||||
@@ -51,86 +57,119 @@ import org.junit.runners.Parameterized
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
class CloseAppBackButtonTest(
|
||||
testSpec: FlickerTestRunnerFactory.TestSpec
|
||||
) : FlickerTestRunner(testSpec) {
|
||||
class CloseAppBackButtonTest(private val testSpec: FlickerTestParameter) {
|
||||
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
private val testApp = SimpleAppHelper(instrumentation)
|
||||
|
||||
@FlickerBuilderProvider
|
||||
fun buildFlicker(): FlickerBuilder {
|
||||
return FlickerBuilder(instrumentation).apply {
|
||||
withTestName { testSpec.name }
|
||||
repeat { testSpec.config.repetitions }
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
}
|
||||
eachRun {
|
||||
this.setRotation(testSpec.config.startRotation)
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
device.pressBack()
|
||||
wmHelper.waitForHomeActivityVisible()
|
||||
}
|
||||
teardown {
|
||||
eachRun {
|
||||
this.setRotation(Surface.ROTATION_0)
|
||||
}
|
||||
test {
|
||||
testApp.exit()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun launcherReplacesAppWindowAsTopWindow() =
|
||||
testSpec.launcherReplacesAppWindowAsTopWindow(testApp)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun wallpaperWindowBecomesVisible() = testSpec.wallpaperWindowBecomesVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun noUncoveredRegions() = testSpec.noUncoveredRegions(testSpec.config.startRotation,
|
||||
Surface.ROTATION_0)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun navBarLayerIsAlwaysVisible() = testSpec.navBarLayerIsAlwaysVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsAlwaysVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun wallpaperLayerReplacesAppLayer() = testSpec.wallpaperLayerReplacesAppLayer(testApp)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun navBarLayerRotatesAndScales() {
|
||||
Assume.assumeFalse(testSpec.isRotated)
|
||||
testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun navBarLayerRotatesAndScales_Flaky() {
|
||||
Assume.assumeTrue(testSpec.isRotated)
|
||||
testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarLayerRotatesScales() {
|
||||
Assume.assumeFalse(testSpec.isRotated)
|
||||
testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun statusBarLayerRotatesScales_Flaky() {
|
||||
Assume.assumeTrue(testSpec.isRotated)
|
||||
testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
}
|
||||
|
||||
@FlakyTest(bugId = 173684672)
|
||||
@Test
|
||||
fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
|
||||
testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
@FlakyTest(bugId = 173684672)
|
||||
@Test
|
||||
fun visibleLayersShownMoreThanOneConsecutiveEntry() =
|
||||
testSpec.visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): List<Array<Any>> {
|
||||
val instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
val testApp = SimpleAppHelper(instrumentation)
|
||||
return FlickerTestRunnerFactory.getInstance()
|
||||
.buildTest(instrumentation, repetitions = 5) { configuration ->
|
||||
withTestName { buildTestTag(configuration) }
|
||||
repeat { configuration.repetitions }
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
}
|
||||
eachRun {
|
||||
this.setRotation(configuration.startRotation)
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
device.pressBack()
|
||||
wmHelper.waitForHomeActivityVisible()
|
||||
}
|
||||
teardown {
|
||||
eachRun {
|
||||
this.setRotation(Surface.ROTATION_0)
|
||||
}
|
||||
test {
|
||||
testApp.exit()
|
||||
}
|
||||
}
|
||||
assertions {
|
||||
val isRotated = configuration.startRotation.isRotated()
|
||||
|
||||
presubmit {
|
||||
windowManagerTrace {
|
||||
navBarWindowIsAlwaysVisible()
|
||||
statusBarWindowIsAlwaysVisible()
|
||||
launcherReplacesAppWindowAsTopWindow(testApp)
|
||||
wallpaperWindowBecomesVisible()
|
||||
}
|
||||
|
||||
layersTrace {
|
||||
noUncoveredRegions(configuration.startRotation,
|
||||
Surface.ROTATION_0)
|
||||
navBarLayerIsAlwaysVisible()
|
||||
statusBarLayerIsAlwaysVisible()
|
||||
wallpaperLayerReplacesAppLayer(testApp)
|
||||
|
||||
if (!isRotated) {
|
||||
navBarLayerRotatesAndScales(configuration.startRotation,
|
||||
Surface.ROTATION_0)
|
||||
statusBarLayerRotatesScales(configuration.startRotation,
|
||||
Surface.ROTATION_0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flaky {
|
||||
windowManagerTrace {
|
||||
visibleWindowsShownMoreThanOneConsecutiveEntry(bugId = 173684672)
|
||||
}
|
||||
|
||||
layersTrace {
|
||||
visibleLayersShownMoreThanOneConsecutiveEntry(bugId = 173684672)
|
||||
|
||||
if (isRotated) {
|
||||
navBarLayerRotatesAndScales(configuration.startRotation,
|
||||
Surface.ROTATION_0)
|
||||
statusBarLayerRotatesScales(configuration.startRotation,
|
||||
Surface.ROTATION_0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fun getParams(): List<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(repetitions = 5)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,12 +16,17 @@
|
||||
|
||||
package com.android.server.wm.flicker.close
|
||||
|
||||
import android.app.Instrumentation
|
||||
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.FlickerTestRunnerFactory
|
||||
import com.android.server.wm.flicker.FlickerTestRunner
|
||||
import com.android.server.wm.flicker.FlickerBuilderProvider
|
||||
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.SimpleAppHelper
|
||||
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
|
||||
@@ -36,12 +41,12 @@ import com.android.server.wm.flicker.statusBarLayerRotatesScales
|
||||
import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry
|
||||
import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry
|
||||
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
|
||||
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.repetitions
|
||||
import com.android.server.wm.flicker.startRotation
|
||||
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
|
||||
@@ -50,88 +55,121 @@ import org.junit.runners.Parameterized
|
||||
* Test app closes by pressing home button.
|
||||
* To run this test: `atest FlickerTests:CloseAppHomeButtonTest`
|
||||
*/
|
||||
@Presubmit
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
class CloseAppHomeButtonTest(
|
||||
testSpec: FlickerTestRunnerFactory.TestSpec
|
||||
) : FlickerTestRunner(testSpec) {
|
||||
class CloseAppHomeButtonTest(private val testSpec: FlickerTestParameter) {
|
||||
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
private val testApp = SimpleAppHelper(instrumentation)
|
||||
|
||||
@FlickerBuilderProvider
|
||||
fun buildFlicker(): FlickerBuilder {
|
||||
return FlickerBuilder(instrumentation).apply {
|
||||
withTestName { testSpec.name }
|
||||
repeat { testSpec.config.repetitions }
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
}
|
||||
eachRun {
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
this.setRotation(testSpec.config.startRotation)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
device.pressHome()
|
||||
wmHelper.waitForHomeActivityVisible()
|
||||
}
|
||||
teardown {
|
||||
eachRun {
|
||||
this.setRotation(Surface.ROTATION_0)
|
||||
}
|
||||
test {
|
||||
testApp.exit()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun launcherReplacesAppWindowAsTopWindow() =
|
||||
testSpec.launcherReplacesAppWindowAsTopWindow(testApp)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun wallpaperWindowBecomesVisible() = testSpec.wallpaperWindowBecomesVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun noUncoveredRegions() = testSpec.noUncoveredRegions(
|
||||
testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun navBarLayerIsAlwaysVisible() = testSpec.navBarLayerIsAlwaysVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsAlwaysVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun wallpaperLayerReplacesAppLayer() = testSpec.wallpaperLayerReplacesAppLayer(testApp)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun navBarLayerRotatesAndScales() {
|
||||
Assume.assumeFalse(testSpec.isRotated)
|
||||
testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun navBarLayerRotatesAndScales_Flaky() {
|
||||
Assume.assumeTrue(testSpec.isRotated)
|
||||
testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarLayerRotatesScales() {
|
||||
Assume.assumeFalse(testSpec.isRotated)
|
||||
testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun statusBarLayerRotatesScales_Flaky() {
|
||||
Assume.assumeTrue(testSpec.isRotated)
|
||||
testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
}
|
||||
|
||||
@FlakyTest(bugId = 173689015)
|
||||
@Test
|
||||
fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
|
||||
testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
@FlakyTest(bugId = 173689015)
|
||||
@Test
|
||||
fun visibleLayersShownMoreThanOneConsecutiveEntry() =
|
||||
testSpec.visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): List<Array<Any>> {
|
||||
val instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
val testApp = SimpleAppHelper(instrumentation)
|
||||
return FlickerTestRunnerFactory.getInstance()
|
||||
.buildTest(instrumentation, repetitions = 5) { configuration ->
|
||||
withTestName { buildTestTag(configuration) }
|
||||
repeat { configuration.repetitions }
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
}
|
||||
eachRun {
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
this.setRotation(configuration.startRotation)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
device.pressHome()
|
||||
wmHelper.waitForHomeActivityVisible()
|
||||
}
|
||||
teardown {
|
||||
eachRun {
|
||||
this.setRotation(Surface.ROTATION_0)
|
||||
}
|
||||
test {
|
||||
testApp.exit()
|
||||
}
|
||||
}
|
||||
assertions {
|
||||
val isRotated = configuration.startRotation.isRotated()
|
||||
|
||||
presubmit {
|
||||
windowManagerTrace {
|
||||
navBarWindowIsAlwaysVisible()
|
||||
statusBarWindowIsAlwaysVisible()
|
||||
launcherReplacesAppWindowAsTopWindow(testApp)
|
||||
wallpaperWindowBecomesVisible()
|
||||
}
|
||||
|
||||
layersTrace {
|
||||
noUncoveredRegions(configuration.startRotation,
|
||||
Surface.ROTATION_0)
|
||||
navBarLayerIsAlwaysVisible()
|
||||
statusBarLayerIsAlwaysVisible()
|
||||
wallpaperLayerReplacesAppLayer(testApp)
|
||||
|
||||
if (!isRotated) {
|
||||
navBarLayerRotatesAndScales(configuration.startRotation,
|
||||
Surface.ROTATION_0)
|
||||
statusBarLayerRotatesScales(configuration.startRotation,
|
||||
Surface.ROTATION_0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flaky {
|
||||
windowManagerTrace {
|
||||
visibleWindowsShownMoreThanOneConsecutiveEntry(bugId = 173689015)
|
||||
}
|
||||
layersTrace {
|
||||
visibleLayersShownMoreThanOneConsecutiveEntry(bugId = 173689015)
|
||||
|
||||
if (isRotated) {
|
||||
navBarLayerRotatesAndScales(configuration.startRotation,
|
||||
Surface.ROTATION_0)
|
||||
statusBarLayerRotatesScales(configuration.startRotation,
|
||||
Surface.ROTATION_0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(repetitions = 5)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,13 +16,9 @@
|
||||
|
||||
package com.android.server.wm.flicker.helpers
|
||||
|
||||
import android.os.Bundle
|
||||
import android.os.RemoteException
|
||||
import android.platform.helpers.IAppHelper
|
||||
import android.view.Surface
|
||||
import com.android.server.wm.flicker.Flicker
|
||||
import com.android.server.wm.flicker.endRotation
|
||||
import com.android.server.wm.flicker.startRotation
|
||||
|
||||
/**
|
||||
* Changes the device [rotation] and wait for the rotation animation to complete
|
||||
@@ -47,128 +43,4 @@ fun Flicker.setRotation(rotation: Int) {
|
||||
} catch (e: RemoteException) {
|
||||
throw RuntimeException(e)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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> */
|
||||
fun buildTestTag(
|
||||
testName: String,
|
||||
app: IAppHelper,
|
||||
beginRotation: Int,
|
||||
endRotation: Int
|
||||
): String {
|
||||
return buildTestTag(
|
||||
testName, app.launcherName, beginRotation, endRotation, app2 = null, extraInfo = "")
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a test tag for the test
|
||||
* @param testName Name of the transition(s) being tested
|
||||
* @param configuration Configuration for the test
|
||||
* @param extraInfo Additional information to append to the tag
|
||||
*
|
||||
* @return test tag with pattern <NAME>__<APP>__<BEGIN_ROTATION>-<END_ROTATION>
|
||||
</END_ROTATION></BEGIN_ROTATION></APP></NAME> */
|
||||
@JvmOverloads
|
||||
fun buildTestTag(
|
||||
testName: String,
|
||||
configuration: Bundle,
|
||||
extraInfo: String = ""
|
||||
): String {
|
||||
return buildTestTag(testName,
|
||||
app = null,
|
||||
beginRotation = configuration.startRotation,
|
||||
endRotation = configuration.endRotation,
|
||||
app2 = null,
|
||||
extraInfo = extraInfo)
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a test tag for the test
|
||||
* @param configuration Configuration for the test
|
||||
* @param extraInfo Additional information to append to the tag
|
||||
*
|
||||
* @return test tag with pattern <NAME>__<APP>__<BEGIN_ROTATION>-<END_ROTATION>
|
||||
</END_ROTATION></BEGIN_ROTATION></APP></NAME> */
|
||||
@JvmOverloads
|
||||
fun buildTestTag(
|
||||
configuration: Bundle,
|
||||
extraInfo: String = ""
|
||||
): String {
|
||||
return buildTestTag(testName = null,
|
||||
app = null,
|
||||
beginRotation = configuration.startRotation,
|
||||
endRotation = configuration.endRotation,
|
||||
app2 = null,
|
||||
extraInfo = extraInfo)
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a test tag for the test
|
||||
* @param testName Name of the transition(s) being tested
|
||||
* @param app App being launcher
|
||||
* @param configuration Configuration for the test
|
||||
* @param extraInfo Additional information to append to the tag
|
||||
*
|
||||
* @return test tag with pattern <NAME>__<APP>__<BEGIN_ROTATION>-<END_ROTATION>
|
||||
</END_ROTATION></BEGIN_ROTATION></APP></NAME> */
|
||||
@JvmOverloads
|
||||
fun buildTestTag(
|
||||
testName: String,
|
||||
app: IAppHelper?,
|
||||
configuration: Bundle,
|
||||
extraInfo: String = ""
|
||||
): String {
|
||||
return buildTestTag(testName, app?.launcherName ?: "", configuration.startRotation,
|
||||
configuration.endRotation, app2 = null, extraInfo = 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> */
|
||||
fun buildTestTag(
|
||||
testName: String?,
|
||||
app: String?,
|
||||
beginRotation: Int,
|
||||
endRotation: Int,
|
||||
app2: String?,
|
||||
extraInfo: String
|
||||
): String {
|
||||
var testTag = ""
|
||||
if (testName != null) {
|
||||
testTag += testName
|
||||
}
|
||||
if (app != null) {
|
||||
testTag += "__$app"
|
||||
}
|
||||
if (app2 != null) {
|
||||
testTag += "-$app2"
|
||||
}
|
||||
testTag += "__${Surface.rotationToString(beginRotation)}"
|
||||
if (endRotation != beginRotation) {
|
||||
testTag += "-${Surface.rotationToString(endRotation)}"
|
||||
}
|
||||
if (extraInfo.isNotEmpty()) {
|
||||
testTag += "__$extraInfo"
|
||||
}
|
||||
|
||||
if (testTag.startsWith("__")) {
|
||||
testTag = testTag.drop(2)
|
||||
}
|
||||
return testTag
|
||||
}
|
||||
}
|
||||
@@ -16,14 +16,19 @@
|
||||
|
||||
package com.android.server.wm.flicker.ime
|
||||
|
||||
import android.app.Instrumentation
|
||||
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.FlickerBuilderProvider
|
||||
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.ImeAppAutoFocusHelper
|
||||
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.visibleWindowsShownMoreThanOneConsecutiveEntry
|
||||
@@ -37,7 +42,9 @@ import com.android.server.wm.flicker.startRotation
|
||||
import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.statusBarLayerRotatesScales
|
||||
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
|
||||
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,79 +55,116 @@ import org.junit.runners.Parameterized
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
class CloseImeAutoOpenWindowToAppTest(
|
||||
testSpec: FlickerTestRunnerFactory.TestSpec
|
||||
) : FlickerTestRunner(testSpec) {
|
||||
class CloseImeAutoOpenWindowToAppTest(private val testSpec: FlickerTestParameter) {
|
||||
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
private val testApp = ImeAppAutoFocusHelper(instrumentation, testSpec.config.startRotation)
|
||||
|
||||
@FlickerBuilderProvider
|
||||
fun buildFlicker(): FlickerBuilder {
|
||||
return FlickerBuilder(instrumentation).apply {
|
||||
withTestName { testSpec.name }
|
||||
repeat { testSpec.config.repetitions }
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
}
|
||||
eachRun {
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
testApp.openIME(device, wmHelper)
|
||||
this.setRotation(testSpec.config.startRotation)
|
||||
}
|
||||
}
|
||||
teardown {
|
||||
test {
|
||||
testApp.exit()
|
||||
wmHelper.waitForAppTransitionIdle()
|
||||
this.setRotation(Surface.ROTATION_0)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
testApp.closeIME(device, wmHelper)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
|
||||
testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry(listOf(IME_WINDOW_TITLE))
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun imeAppWindowIsAlwaysVisible() = testSpec.imeAppWindowIsAlwaysVisible(testApp)
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun navBarLayerIsAlwaysVisible() = testSpec.navBarLayerIsAlwaysVisible()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsAlwaysVisible()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun noUncoveredRegions() = testSpec.noUncoveredRegions(testSpec.config.startRotation)
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun imeLayerBecomesInvisible() = testSpec.imeLayerBecomesInvisible()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun imeAppLayerIsAlwaysVisible() = testSpec.imeAppLayerIsAlwaysVisible(testApp)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun navBarLayerRotatesAndScales() {
|
||||
Assume.assumeFalse(testSpec.isRotated)
|
||||
testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation)
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun navBarLayerRotatesAndScales_Flaky() {
|
||||
Assume.assumeTrue(testSpec.isRotated)
|
||||
testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation)
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarLayerRotatesScales() {
|
||||
Assume.assumeFalse(testSpec.isRotated)
|
||||
testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation)
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun statusBarLayerRotatesScales_Flaky() {
|
||||
Assume.assumeTrue(testSpec.isRotated)
|
||||
testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation)
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun visibleLayersShownMoreThanOneConsecutiveEntry() =
|
||||
testSpec.visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): List<Array<Any>> {
|
||||
val instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
return FlickerTestRunnerFactory.getInstance()
|
||||
.buildTest(instrumentation, repetitions = 5) { configuration ->
|
||||
val testApp = ImeAppAutoFocusHelper(instrumentation,
|
||||
configuration.startRotation)
|
||||
withTestName { buildTestTag(configuration) }
|
||||
repeat { configuration.repetitions }
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
}
|
||||
eachRun {
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
testApp.openIME(device, wmHelper)
|
||||
this.setRotation(configuration.startRotation)
|
||||
}
|
||||
}
|
||||
teardown {
|
||||
test {
|
||||
testApp.exit()
|
||||
wmHelper.waitForAppTransitionIdle()
|
||||
this.setRotation(Surface.ROTATION_0)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
testApp.closeIME(device, wmHelper)
|
||||
}
|
||||
assertions {
|
||||
val isRotated = configuration.startRotation.isRotated()
|
||||
|
||||
postsubmit {
|
||||
windowManagerTrace {
|
||||
navBarWindowIsAlwaysVisible()
|
||||
statusBarWindowIsAlwaysVisible()
|
||||
visibleWindowsShownMoreThanOneConsecutiveEntry(
|
||||
listOf(IME_WINDOW_TITLE))
|
||||
imeAppWindowIsAlwaysVisible(testApp)
|
||||
}
|
||||
|
||||
layersTrace {
|
||||
navBarLayerIsAlwaysVisible()
|
||||
statusBarLayerIsAlwaysVisible()
|
||||
noUncoveredRegions(configuration.startRotation)
|
||||
imeLayerBecomesInvisible()
|
||||
imeAppLayerIsAlwaysVisible(testApp)
|
||||
if (!isRotated) {
|
||||
navBarLayerRotatesAndScales(configuration.startRotation)
|
||||
statusBarLayerRotatesScales(configuration.startRotation)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flaky {
|
||||
layersTrace {
|
||||
visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
if (isRotated) {
|
||||
navBarLayerRotatesAndScales(configuration.startRotation)
|
||||
statusBarLayerRotatesScales(configuration.startRotation)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(repetitions = 5)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,14 +16,18 @@
|
||||
|
||||
package com.android.server.wm.flicker.ime
|
||||
|
||||
import android.app.Instrumentation
|
||||
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.FlickerBuilderProvider
|
||||
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.ImeAppAutoFocusHelper
|
||||
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.visibleWindowsShownMoreThanOneConsecutiveEntry
|
||||
@@ -37,7 +41,9 @@ import com.android.server.wm.flicker.startRotation
|
||||
import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.statusBarLayerRotatesScales
|
||||
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
|
||||
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,93 +54,151 @@ import org.junit.runners.Parameterized
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
class CloseImeAutoOpenWindowToHomeTest(
|
||||
testSpec: FlickerTestRunnerFactory.TestSpec
|
||||
) : FlickerTestRunner(testSpec) {
|
||||
class CloseImeAutoOpenWindowToHomeTest(private val testSpec: FlickerTestParameter) {
|
||||
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
private val testApp = ImeAppAutoFocusHelper(instrumentation, testSpec.config.startRotation)
|
||||
|
||||
@FlickerBuilderProvider
|
||||
fun buildFlicker(): FlickerBuilder {
|
||||
return FlickerBuilder(instrumentation).apply {
|
||||
withTestName { testSpec.name }
|
||||
repeat { testSpec.config.repetitions }
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
}
|
||||
eachRun {
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
testApp.openIME(device, wmHelper)
|
||||
this.setRotation(testSpec.config.startRotation)
|
||||
}
|
||||
}
|
||||
teardown {
|
||||
test {
|
||||
testApp.exit()
|
||||
this.setRotation(Surface.ROTATION_0)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
device.pressHome()
|
||||
wmHelper.waitForHomeActivityVisible()
|
||||
wmHelper.waitImeWindowGone()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
|
||||
testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry(listOf(IME_WINDOW_TITLE))
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeWindowBecomesInvisible() = testSpec.imeWindowBecomesInvisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeAppWindowBecomesInvisible() = testSpec.imeAppWindowBecomesInvisible(testApp)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun noUncoveredRegions() = testSpec.noUncoveredRegions(testSpec.config.startRotation,
|
||||
Surface.ROTATION_0)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeLayerBecomesInvisible() = testSpec.imeLayerBecomesInvisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeAppLayerBecomesInvisible() = testSpec.imeAppLayerBecomesInvisible(testApp)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun navBarLayerRotatesAndScales() {
|
||||
Assume.assumeFalse(testSpec.isRotated)
|
||||
testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun navBarLayerRotatesAndScales_Flaky() {
|
||||
Assume.assumeTrue(testSpec.isRotated)
|
||||
testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarLayerRotatesScales() {
|
||||
Assume.assumeFalse(testSpec.isRotated)
|
||||
testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun statusBarLayerRotatesScales_Flaky() {
|
||||
Assume.assumeTrue(testSpec.isRotated)
|
||||
testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun navBarLayerIsAlwaysVisible() {
|
||||
Assume.assumeFalse(testSpec.isRotated)
|
||||
testSpec.navBarLayerIsAlwaysVisible()
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun navBarLayerIsAlwaysVisible_Flaky() {
|
||||
Assume.assumeTrue(testSpec.isRotated)
|
||||
testSpec.navBarLayerIsAlwaysVisible()
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarLayerIsAlwaysVisible() {
|
||||
Assume.assumeFalse(testSpec.isRotated)
|
||||
testSpec.statusBarLayerIsAlwaysVisible()
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun statusBarLayerIsAlwaysVisible_Flaky() {
|
||||
Assume.assumeTrue(testSpec.isRotated)
|
||||
testSpec.statusBarLayerIsAlwaysVisible()
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun visibleLayersShownMoreThanOneConsecutiveEntry() {
|
||||
Assume.assumeFalse(testSpec.isRotated)
|
||||
testSpec.visibleLayersShownMoreThanOneConsecutiveEntry(listOf(IME_WINDOW_TITLE))
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun visibleLayersShownMoreThanOneConsecutiveEntry_Flaky() {
|
||||
Assume.assumeTrue(testSpec.isRotated)
|
||||
testSpec.visibleLayersShownMoreThanOneConsecutiveEntry(listOf(IME_WINDOW_TITLE))
|
||||
}
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): List<Array<Any>> {
|
||||
val instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
return FlickerTestRunnerFactory.getInstance()
|
||||
.buildTest(instrumentation, repetitions = 5) { configuration ->
|
||||
val testApp = ImeAppAutoFocusHelper(instrumentation,
|
||||
configuration.startRotation)
|
||||
withTestName {
|
||||
buildTestTag(configuration)
|
||||
}
|
||||
repeat { configuration.repetitions }
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
}
|
||||
eachRun {
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
testApp.openIME(device, wmHelper)
|
||||
this.setRotation(configuration.startRotation)
|
||||
}
|
||||
}
|
||||
teardown {
|
||||
test {
|
||||
testApp.exit()
|
||||
this.setRotation(Surface.ROTATION_0)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
device.pressHome()
|
||||
wmHelper.waitForHomeActivityVisible()
|
||||
wmHelper.waitImeWindowGone()
|
||||
}
|
||||
assertions {
|
||||
val isRotated = configuration.startRotation.isRotated()
|
||||
|
||||
presubmit {
|
||||
windowManagerTrace {
|
||||
navBarWindowIsAlwaysVisible()
|
||||
statusBarWindowIsAlwaysVisible()
|
||||
visibleWindowsShownMoreThanOneConsecutiveEntry(
|
||||
listOf(IME_WINDOW_TITLE))
|
||||
|
||||
imeWindowBecomesInvisible()
|
||||
imeAppWindowBecomesInvisible(testApp)
|
||||
}
|
||||
|
||||
layersTrace {
|
||||
noUncoveredRegions(configuration.startRotation, Surface.ROTATION_0)
|
||||
imeLayerBecomesInvisible()
|
||||
imeAppLayerBecomesInvisible(testApp)
|
||||
|
||||
if (!isRotated) {
|
||||
navBarLayerRotatesAndScales(configuration.startRotation,
|
||||
Surface.ROTATION_0)
|
||||
statusBarLayerRotatesScales(configuration.startRotation,
|
||||
Surface.ROTATION_0)
|
||||
navBarLayerIsAlwaysVisible()
|
||||
statusBarLayerIsAlwaysVisible()
|
||||
visibleLayersShownMoreThanOneConsecutiveEntry(
|
||||
listOf(IME_WINDOW_TITLE))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flaky {
|
||||
layersTrace {
|
||||
if (isRotated) {
|
||||
navBarLayerRotatesAndScales(configuration.startRotation,
|
||||
Surface.ROTATION_0)
|
||||
statusBarLayerRotatesScales(configuration.startRotation,
|
||||
Surface.ROTATION_0)
|
||||
navBarLayerIsAlwaysVisible()
|
||||
statusBarLayerIsAlwaysVisible()
|
||||
visibleLayersShownMoreThanOneConsecutiveEntry(
|
||||
listOf(IME_WINDOW_TITLE))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(repetitions = 5)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,18 @@
|
||||
|
||||
package com.android.server.wm.flicker.ime
|
||||
|
||||
import android.app.Instrumentation
|
||||
import android.platform.test.annotations.Postsubmit
|
||||
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.FlickerBuilderProvider
|
||||
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.ImeAppHelper
|
||||
import com.android.server.wm.flicker.helpers.buildTestTag
|
||||
import com.android.server.wm.flicker.helpers.setRotation
|
||||
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
|
||||
import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible
|
||||
@@ -33,10 +38,10 @@ import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEn
|
||||
import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry
|
||||
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
|
||||
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
|
||||
@@ -47,63 +52,97 @@ import org.junit.runners.Parameterized
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
class CloseImeWindowToAppTest(
|
||||
testSpec: FlickerTestRunnerFactory.TestSpec
|
||||
) : FlickerTestRunner(testSpec) {
|
||||
class CloseImeWindowToAppTest(private val testSpec: FlickerTestParameter) {
|
||||
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
private val testApp = ImeAppHelper(instrumentation)
|
||||
|
||||
@FlickerBuilderProvider
|
||||
fun buildFlicker(): FlickerBuilder {
|
||||
return FlickerBuilder(instrumentation).apply {
|
||||
withTestName { testSpec.name }
|
||||
repeat { testSpec.config.repetitions }
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
testApp.launchViaIntent()
|
||||
this.setRotation(testSpec.config.startRotation)
|
||||
}
|
||||
eachRun {
|
||||
testApp.openIME(device, wmHelper)
|
||||
}
|
||||
}
|
||||
teardown {
|
||||
test {
|
||||
testApp.exit()
|
||||
this.setRotation(Surface.ROTATION_0)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
testApp.closeIME(device, wmHelper)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
|
||||
testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry(listOf(IME_WINDOW_TITLE))
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun imeAppWindowIsAlwaysVisible() = testSpec.imeAppWindowIsAlwaysVisible(testApp)
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun navBarLayerIsAlwaysVisible() = testSpec.navBarLayerIsAlwaysVisible()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun statusBarLayerIsAlwaysVisible() = testSpec.navBarLayerIsAlwaysVisible()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun noUncoveredRegions() = testSpec.noUncoveredRegions(testSpec.config.startRotation)
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun navBarLayerRotatesAndScales() =
|
||||
testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation)
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun statusBarLayerRotatesScales() =
|
||||
testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation)
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun visibleLayersShownMoreThanOneConsecutiveEntry() =
|
||||
testSpec.visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun imeLayerBecomesInvisible() = testSpec.imeLayerBecomesInvisible()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun imeAppLayerIsAlwaysVisible() = testSpec.imeAppLayerIsAlwaysVisible(testApp)
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): List<Array<Any>> {
|
||||
val instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
val testApp = ImeAppHelper(instrumentation)
|
||||
return FlickerTestRunnerFactory.getInstance()
|
||||
.buildTest(instrumentation, repetitions = 5) { configuration ->
|
||||
withTestName { buildTestTag(configuration) }
|
||||
repeat { configuration.repetitions }
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
testApp.launchViaIntent()
|
||||
this.setRotation(configuration.startRotation)
|
||||
}
|
||||
eachRun {
|
||||
testApp.openIME(device, wmHelper)
|
||||
}
|
||||
}
|
||||
teardown {
|
||||
test {
|
||||
testApp.exit()
|
||||
this.setRotation(Surface.ROTATION_0)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
testApp.closeIME(device, wmHelper)
|
||||
}
|
||||
assertions {
|
||||
postsubmit {
|
||||
windowManagerTrace {
|
||||
navBarWindowIsAlwaysVisible()
|
||||
statusBarWindowIsAlwaysVisible()
|
||||
visibleWindowsShownMoreThanOneConsecutiveEntry(
|
||||
listOf(IME_WINDOW_TITLE))
|
||||
imeAppWindowIsAlwaysVisible(testApp)
|
||||
}
|
||||
|
||||
layersTrace {
|
||||
navBarLayerIsAlwaysVisible()
|
||||
statusBarLayerIsAlwaysVisible()
|
||||
noUncoveredRegions(configuration.startRotation)
|
||||
navBarLayerRotatesAndScales(configuration.startRotation)
|
||||
statusBarLayerRotatesScales(configuration.startRotation)
|
||||
visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
imeLayerBecomesInvisible()
|
||||
imeAppLayerIsAlwaysVisible(testApp)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(repetitions = 5)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,28 +16,33 @@
|
||||
|
||||
package com.android.server.wm.flicker.ime
|
||||
|
||||
import android.app.Instrumentation
|
||||
import android.platform.test.annotations.Postsubmit
|
||||
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.FlickerBuilderProvider
|
||||
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.ImeAppHelper
|
||||
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.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.visibleWindowsShownMoreThanOneConsecutiveEntry
|
||||
import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry
|
||||
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
|
||||
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry
|
||||
import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry
|
||||
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
|
||||
@@ -47,90 +52,126 @@ import org.junit.runners.Parameterized
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
class CloseImeWindowToHomeTest(
|
||||
testSpec: FlickerTestRunnerFactory.TestSpec
|
||||
) : FlickerTestRunner(testSpec) {
|
||||
class CloseImeWindowToHomeTest(private val testSpec: FlickerTestParameter) {
|
||||
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
private val testApp = ImeAppHelper(instrumentation)
|
||||
|
||||
@FlickerBuilderProvider
|
||||
fun buildFlicker(): FlickerBuilder {
|
||||
return FlickerBuilder(instrumentation).apply {
|
||||
withTestName { testSpec.name }
|
||||
repeat { testSpec.config.repetitions }
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
}
|
||||
eachRun {
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
this.setRotation(testSpec.config.startRotation)
|
||||
testApp.openIME(device, wmHelper)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
device.pressHome()
|
||||
wmHelper.waitForHomeActivityVisible()
|
||||
wmHelper.waitImeWindowGone()
|
||||
}
|
||||
teardown {
|
||||
eachRun {
|
||||
device.pressHome()
|
||||
wmHelper.waitForHomeActivityVisible()
|
||||
}
|
||||
test {
|
||||
testApp.exit()
|
||||
this.setRotation(Surface.ROTATION_0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
|
||||
testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry(listOf(IME_WINDOW_TITLE))
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun imeWindowBecomesInvisible() = testSpec.imeWindowBecomesInvisible()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun imeAppWindowBecomesInvisible() = testSpec.imeAppWindowBecomesInvisible(testApp)
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun navBarLayerIsAlwaysVisible() = testSpec.navBarLayerIsAlwaysVisible()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun statusBarLayerIsAlwaysVisible() = testSpec.navBarLayerIsAlwaysVisible()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun noUncoveredRegions() = testSpec.noUncoveredRegions(testSpec.config.startRotation,
|
||||
Surface.ROTATION_0)
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun imeLayerBecomesInvisible() = testSpec.imeLayerBecomesInvisible()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun imeAppLayerBecomesInvisible() = testSpec.imeAppLayerBecomesInvisible(testApp)
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun navBarLayerRotatesAndScales() {
|
||||
Assume.assumeFalse(testSpec.isRotated)
|
||||
testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun navBarLayerRotatesAndScales_Flaky() {
|
||||
Assume.assumeTrue(testSpec.isRotated)
|
||||
testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
}
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun statusBarLayerRotatesScales() {
|
||||
Assume.assumeFalse(testSpec.isRotated)
|
||||
testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun statusBarLayerRotatesScales_Flaky() {
|
||||
Assume.assumeTrue(testSpec.isRotated)
|
||||
testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun visibleLayersShownMoreThanOneConsecutiveEntry() =
|
||||
testSpec.visibleLayersShownMoreThanOneConsecutiveEntry(listOf(IME_WINDOW_TITLE))
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): List<Array<Any>> {
|
||||
val instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
val testApp = ImeAppHelper(instrumentation)
|
||||
return FlickerTestRunnerFactory.getInstance()
|
||||
.buildTest(instrumentation, repetitions = 5) { configuration ->
|
||||
withTestName { buildTestTag(configuration) }
|
||||
repeat { configuration.repetitions }
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
}
|
||||
eachRun {
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
this.setRotation(configuration.startRotation)
|
||||
testApp.openIME(device, wmHelper)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
device.pressHome()
|
||||
wmHelper.waitForHomeActivityVisible()
|
||||
wmHelper.waitImeWindowGone()
|
||||
}
|
||||
teardown {
|
||||
eachRun {
|
||||
device.pressHome()
|
||||
wmHelper.waitForHomeActivityVisible()
|
||||
}
|
||||
test {
|
||||
testApp.exit()
|
||||
this.setRotation(Surface.ROTATION_0)
|
||||
}
|
||||
}
|
||||
assertions {
|
||||
val isRotated = configuration.startRotation.isRotated()
|
||||
|
||||
postsubmit {
|
||||
windowManagerTrace {
|
||||
navBarWindowIsAlwaysVisible()
|
||||
statusBarWindowIsAlwaysVisible()
|
||||
visibleWindowsShownMoreThanOneConsecutiveEntry(
|
||||
listOf(IME_WINDOW_TITLE))
|
||||
imeWindowBecomesInvisible()
|
||||
imeAppWindowBecomesInvisible(testApp)
|
||||
}
|
||||
|
||||
layersTrace {
|
||||
navBarLayerIsAlwaysVisible()
|
||||
statusBarLayerIsAlwaysVisible()
|
||||
imeLayerBecomesInvisible()
|
||||
imeAppLayerBecomesInvisible(testApp)
|
||||
noUncoveredRegions(configuration.startRotation,
|
||||
Surface.ROTATION_0)
|
||||
|
||||
if (!isRotated) {
|
||||
navBarLayerRotatesAndScales(configuration.startRotation,
|
||||
Surface.ROTATION_0)
|
||||
statusBarLayerRotatesScales(configuration.startRotation,
|
||||
Surface.ROTATION_0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flaky {
|
||||
layersTrace {
|
||||
visibleLayersShownMoreThanOneConsecutiveEntry(
|
||||
listOf(IME_WINDOW_TITLE))
|
||||
|
||||
if (isRotated) {
|
||||
navBarLayerRotatesAndScales(configuration.startRotation,
|
||||
Surface.ROTATION_0)
|
||||
statusBarLayerRotatesScales(configuration.startRotation,
|
||||
Surface.ROTATION_0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(repetitions = 5)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,85 +17,75 @@
|
||||
package com.android.server.wm.flicker.ime
|
||||
|
||||
import android.platform.helpers.IAppHelper
|
||||
import com.android.server.wm.flicker.dsl.LayersAssertionBuilder
|
||||
import com.android.server.wm.flicker.dsl.WmAssertionBuilder
|
||||
import com.android.server.wm.flicker.FlickerTestParameter
|
||||
|
||||
const val IME_WINDOW_TITLE = "InputMethod"
|
||||
|
||||
@JvmOverloads
|
||||
fun LayersAssertionBuilder.imeLayerBecomesVisible(bugId: Int = 0) {
|
||||
all("imeLayerBecomesVisible", bugId) {
|
||||
fun FlickerTestParameter.imeLayerBecomesVisible() {
|
||||
assertLayers {
|
||||
this.hidesLayer(IME_WINDOW_TITLE)
|
||||
.then()
|
||||
.showsLayer(IME_WINDOW_TITLE)
|
||||
.then()
|
||||
.showsLayer(IME_WINDOW_TITLE)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun LayersAssertionBuilder.imeLayerBecomesInvisible(bugId: Int = 0) {
|
||||
all("imeLayerBecomesInvisible", bugId) {
|
||||
fun FlickerTestParameter.imeLayerBecomesInvisible() {
|
||||
assertLayers {
|
||||
this.showsLayer(IME_WINDOW_TITLE)
|
||||
.then()
|
||||
.hidesLayer(IME_WINDOW_TITLE)
|
||||
.then()
|
||||
.hidesLayer(IME_WINDOW_TITLE)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun LayersAssertionBuilder.imeAppLayerIsAlwaysVisible(testApp: IAppHelper, bugId: Int = 0) {
|
||||
all("imeAppLayerIsAlwaysVisible", bugId) {
|
||||
fun FlickerTestParameter.imeAppLayerIsAlwaysVisible(testApp: IAppHelper) {
|
||||
assertLayers {
|
||||
this.showsLayer(testApp.getPackage())
|
||||
}
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun WmAssertionBuilder.imeAppWindowIsAlwaysVisible(testApp: IAppHelper, bugId: Int = 0) {
|
||||
all("imeAppWindowIsAlwaysVisible", bugId) {
|
||||
fun FlickerTestParameter.imeAppWindowIsAlwaysVisible(testApp: IAppHelper) {
|
||||
assertWm {
|
||||
this.showsAppWindowOnTop(testApp.getPackage())
|
||||
}
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun WmAssertionBuilder.imeWindowBecomesVisible(bugId: Int = 0) {
|
||||
all("imeWindowBecomesVisible", bugId) {
|
||||
fun FlickerTestParameter.imeWindowBecomesVisible() {
|
||||
assertWm {
|
||||
this.hidesNonAppWindow(IME_WINDOW_TITLE)
|
||||
.then()
|
||||
.showsNonAppWindow(IME_WINDOW_TITLE)
|
||||
.then()
|
||||
.showsNonAppWindow(IME_WINDOW_TITLE)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun WmAssertionBuilder.imeWindowBecomesInvisible(bugId: Int = 0) {
|
||||
all("imeWindowBecomesInvisible", bugId) {
|
||||
fun FlickerTestParameter.imeWindowBecomesInvisible() {
|
||||
assertWm {
|
||||
this.showsNonAppWindow(IME_WINDOW_TITLE)
|
||||
.then()
|
||||
.hidesNonAppWindow(IME_WINDOW_TITLE)
|
||||
.then()
|
||||
.hidesNonAppWindow(IME_WINDOW_TITLE)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun WmAssertionBuilder.imeAppWindowBecomesVisible(windowName: String, bugId: Int = 0) {
|
||||
all("imeAppWindowBecomesVisible", bugId) {
|
||||
fun FlickerTestParameter.imeAppWindowBecomesVisible(windowName: String) {
|
||||
assertWm {
|
||||
this.hidesAppWindow(windowName)
|
||||
.then()
|
||||
.showsAppWindow(windowName)
|
||||
.then()
|
||||
.showsAppWindow(windowName)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun WmAssertionBuilder.imeAppWindowBecomesInvisible(testApp: IAppHelper, bugId: Int = 0) {
|
||||
all("imeAppWindowBecomesInvisible", bugId) {
|
||||
fun FlickerTestParameter.imeAppWindowBecomesInvisible(testApp: IAppHelper) {
|
||||
assertWm {
|
||||
this.showsAppWindowOnTop(testApp.getPackage())
|
||||
.then()
|
||||
.appWindowNotOnTop(testApp.getPackage())
|
||||
.then()
|
||||
.appWindowNotOnTop(testApp.getPackage())
|
||||
}
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun LayersAssertionBuilder.imeAppLayerBecomesInvisible(testApp: IAppHelper, bugId: Int = 0) {
|
||||
all("imeAppLayerBecomesInvisible", bugId) {
|
||||
fun FlickerTestParameter.imeAppLayerBecomesInvisible(testApp: IAppHelper) {
|
||||
assertLayers {
|
||||
this.skipUntilFirstAssertion()
|
||||
.showsLayer(testApp.getPackage())
|
||||
.then()
|
||||
.hidesLayer(testApp.getPackage())
|
||||
.showsLayer(testApp.getPackage())
|
||||
.then()
|
||||
.hidesLayer(testApp.getPackage())
|
||||
}
|
||||
}
|
||||
@@ -16,13 +16,17 @@
|
||||
|
||||
package com.android.server.wm.flicker.ime
|
||||
|
||||
import android.app.Instrumentation
|
||||
import android.platform.test.annotations.Postsubmit
|
||||
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.FlickerBuilderProvider
|
||||
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.helpers.ImeAppHelper
|
||||
import com.android.server.wm.flicker.helpers.buildTestTag
|
||||
import com.android.server.wm.flicker.helpers.setRotation
|
||||
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
|
||||
import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible
|
||||
@@ -32,14 +36,16 @@ import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEn
|
||||
import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry
|
||||
import com.android.server.wm.flicker.noUncoveredRegions
|
||||
import com.android.server.wm.flicker.appWindowAlwaysVisibleOnTop
|
||||
import com.android.server.wm.flicker.helpers.isRotated
|
||||
import com.android.server.wm.flicker.dsl.FlickerBuilder
|
||||
import com.android.server.wm.flicker.layerAlwaysVisible
|
||||
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
|
||||
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
|
||||
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
|
||||
@@ -50,80 +56,119 @@ import org.junit.runners.Parameterized
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
class OpenImeWindowTest(
|
||||
testSpec: FlickerTestRunnerFactory.TestSpec
|
||||
) : FlickerTestRunner(testSpec) {
|
||||
class OpenImeWindowTest(private val testSpec: FlickerTestParameter) {
|
||||
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
private val testApp = ImeAppHelper(instrumentation)
|
||||
|
||||
@FlickerBuilderProvider
|
||||
fun buildFlicker(): FlickerBuilder {
|
||||
return FlickerBuilder(instrumentation).apply {
|
||||
withTestName { testSpec.name }
|
||||
repeat { testSpec.config.repetitions }
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
this.setRotation(testSpec.config.startRotation)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
testApp.openIME(device, wmHelper)
|
||||
}
|
||||
teardown {
|
||||
eachRun {
|
||||
testApp.closeIME(device, wmHelper)
|
||||
}
|
||||
test {
|
||||
testApp.exit()
|
||||
this.setRotation(Surface.ROTATION_0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun imeWindowBecomesVisible() = testSpec.imeWindowBecomesVisible()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun appWindowAlwaysVisibleOnTop() = testSpec.appWindowAlwaysVisibleOnTop(testApp.`package`)
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun navBarLayerIsAlwaysVisible() = testSpec.navBarLayerIsAlwaysVisible()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsAlwaysVisible()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun noUncoveredRegions() = testSpec.noUncoveredRegions(testSpec.config.startRotation)
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun imeLayerBecomesVisible() = testSpec.imeLayerBecomesVisible()
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun layerAlwaysVisible() = testSpec.layerAlwaysVisible(testApp.`package`)
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun navBarLayerRotatesAndScales() {
|
||||
Assume.assumeFalse(testSpec.isRotated)
|
||||
testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation)
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun navBarLayerRotatesAndScales_Flaky() {
|
||||
Assume.assumeTrue(testSpec.isRotated)
|
||||
testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation)
|
||||
}
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun statusBarLayerRotatesScales() {
|
||||
Assume.assumeFalse(testSpec.isRotated)
|
||||
testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation)
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun statusBarLayerRotatesScales_Flaky() {
|
||||
Assume.assumeTrue(testSpec.isRotated)
|
||||
testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation)
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun visibleLayersShownMoreThanOneConsecutiveEntry() =
|
||||
testSpec.visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
|
||||
testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): List<Array<Any>> {
|
||||
val instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
val testApp = ImeAppHelper(instrumentation)
|
||||
return FlickerTestRunnerFactory.getInstance()
|
||||
.buildTest(instrumentation, repetitions = 5) { configuration ->
|
||||
withTestName { buildTestTag(configuration) }
|
||||
repeat { configuration.repetitions }
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
this.setRotation(configuration.startRotation)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
testApp.openIME(device, wmHelper)
|
||||
}
|
||||
teardown {
|
||||
eachRun {
|
||||
testApp.closeIME(device, wmHelper)
|
||||
}
|
||||
test {
|
||||
testApp.exit()
|
||||
this.setRotation(Surface.ROTATION_0)
|
||||
}
|
||||
}
|
||||
assertions {
|
||||
val isRotated = configuration.startRotation.isRotated()
|
||||
|
||||
postsubmit {
|
||||
windowManagerTrace {
|
||||
navBarWindowIsAlwaysVisible()
|
||||
statusBarWindowIsAlwaysVisible()
|
||||
|
||||
imeWindowBecomesVisible()
|
||||
appWindowAlwaysVisibleOnTop(testApp.`package`)
|
||||
}
|
||||
|
||||
layersTrace {
|
||||
navBarLayerIsAlwaysVisible()
|
||||
statusBarLayerIsAlwaysVisible()
|
||||
noUncoveredRegions(configuration.startRotation)
|
||||
imeLayerBecomesVisible()
|
||||
layerAlwaysVisible(testApp.`package`)
|
||||
|
||||
if (!isRotated) {
|
||||
navBarLayerRotatesAndScales(configuration.startRotation)
|
||||
statusBarLayerRotatesScales(configuration.startRotation)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flaky {
|
||||
windowManagerTrace {
|
||||
visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||
}
|
||||
layersTrace {
|
||||
visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
if (isRotated) {
|
||||
navBarLayerRotatesAndScales(configuration.startRotation)
|
||||
statusBarLayerRotatesScales(configuration.startRotation)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(repetitions = 5)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,14 +16,18 @@
|
||||
|
||||
package com.android.server.wm.flicker.ime
|
||||
|
||||
import android.app.Instrumentation
|
||||
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.FlickerBuilderProvider
|
||||
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.helpers.ImeAppAutoFocusHelper
|
||||
import com.android.server.wm.flicker.helpers.reopenAppFromOverview
|
||||
import com.android.server.wm.flicker.helpers.buildTestTag
|
||||
import com.android.server.wm.flicker.helpers.setRotation
|
||||
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
|
||||
import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible
|
||||
@@ -31,18 +35,20 @@ import com.android.server.wm.flicker.navBarLayerRotatesAndScales
|
||||
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.wallpaperWindowBecomesInvisible
|
||||
import com.android.server.wm.flicker.appLayerReplacesWallpaperLayer
|
||||
import com.android.server.wm.flicker.dsl.FlickerBuilder
|
||||
import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry
|
||||
import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry
|
||||
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.endRotation
|
||||
import com.android.server.wm.flicker.helpers.isRotated
|
||||
import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.statusBarLayerRotatesScales
|
||||
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.testapp.ActivityOptions
|
||||
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
|
||||
@@ -53,89 +59,132 @@ import org.junit.runners.Parameterized
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
class ReOpenImeWindowTest(
|
||||
testSpec: FlickerTestRunnerFactory.TestSpec
|
||||
) : FlickerTestRunner(testSpec) {
|
||||
class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) {
|
||||
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
private val testApp = ImeAppAutoFocusHelper(instrumentation, testSpec.config.startRotation)
|
||||
private val testAppComponentName = ActivityOptions.IME_ACTIVITY_AUTO_FOCUS_COMPONENT_NAME
|
||||
|
||||
@FlickerBuilderProvider
|
||||
fun buildFlicker(): FlickerBuilder {
|
||||
return FlickerBuilder(instrumentation).apply {
|
||||
withTestName { testSpec.name }
|
||||
repeat { testSpec.config.repetitions }
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
testApp.openIME(device, wmHelper)
|
||||
}
|
||||
eachRun {
|
||||
device.pressRecentApps()
|
||||
wmHelper.waitImeWindowGone()
|
||||
wmHelper.waitForAppTransitionIdle()
|
||||
this.setRotation(testSpec.config.startRotation)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
device.reopenAppFromOverview(wmHelper)
|
||||
wmHelper.waitImeWindowShown()
|
||||
}
|
||||
teardown {
|
||||
test {
|
||||
this.setRotation(Surface.ROTATION_0)
|
||||
testApp.exit()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
|
||||
testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun wallpaperWindowBecomesInvisible() = testSpec.wallpaperWindowBecomesInvisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeWindowBecomesVisible() = testSpec.imeWindowBecomesVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeAppWindowBecomesVisible() =
|
||||
testSpec.imeAppWindowBecomesVisible(testAppComponentName.className)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
// During testing the launcher is always in portrait mode
|
||||
fun noUncoveredRegions() = testSpec.noUncoveredRegions(testSpec.config.startRotation,
|
||||
testSpec.config.endRotation)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun navBarLayerIsAlwaysVisible() = testSpec.navBarLayerIsAlwaysVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsAlwaysVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun imeLayerBecomesVisible() = testSpec.imeLayerBecomesVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun appLayerReplacesWallpaperLayer() =
|
||||
testSpec.appLayerReplacesWallpaperLayer(testAppComponentName.className)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun navBarLayerRotatesAndScales() {
|
||||
Assume.assumeFalse(testSpec.isRotated)
|
||||
testSpec.navBarLayerRotatesAndScales(Surface.ROTATION_0, testSpec.config.endRotation)
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun navBarLayerRotatesAndScales_Flaky() {
|
||||
Assume.assumeTrue(testSpec.isRotated)
|
||||
testSpec.navBarLayerRotatesAndScales(Surface.ROTATION_0, testSpec.config.endRotation)
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarLayerRotatesScales() {
|
||||
Assume.assumeFalse(testSpec.isRotated)
|
||||
testSpec.statusBarLayerRotatesScales(Surface.ROTATION_0, testSpec.config.endRotation)
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun statusBarLayerRotatesScales_Flaky() {
|
||||
Assume.assumeTrue(testSpec.isRotated)
|
||||
testSpec.statusBarLayerRotatesScales(Surface.ROTATION_0, testSpec.config.endRotation)
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun visibleLayersShownMoreThanOneConsecutiveEntry() =
|
||||
testSpec.visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): List<Array<Any>> {
|
||||
val instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
val testAppComponentName = ActivityOptions.IME_ACTIVITY_AUTO_FOCUS_COMPONENT_NAME
|
||||
return FlickerTestRunnerFactory.getInstance()
|
||||
.buildTest(instrumentation, repetitions = 1) { configuration ->
|
||||
val testApp = ImeAppAutoFocusHelper(instrumentation,
|
||||
configuration.startRotation)
|
||||
withTestName { buildTestTag(configuration) }
|
||||
repeat { configuration.repetitions }
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
testApp.openIME(device, wmHelper)
|
||||
}
|
||||
eachRun {
|
||||
device.pressRecentApps()
|
||||
wmHelper.waitImeWindowGone()
|
||||
wmHelper.waitForAppTransitionIdle()
|
||||
this.setRotation(configuration.startRotation)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
device.reopenAppFromOverview(wmHelper)
|
||||
wmHelper.waitImeWindowShown()
|
||||
}
|
||||
teardown {
|
||||
test {
|
||||
this.setRotation(Surface.ROTATION_0)
|
||||
testApp.exit()
|
||||
}
|
||||
}
|
||||
assertions {
|
||||
val isRotated = configuration.startRotation.isRotated()
|
||||
|
||||
presubmit {
|
||||
windowManagerTrace {
|
||||
navBarWindowIsAlwaysVisible()
|
||||
statusBarWindowIsAlwaysVisible()
|
||||
visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
imeWindowBecomesVisible()
|
||||
imeAppWindowBecomesVisible(testAppComponentName.className)
|
||||
wallpaperWindowBecomesInvisible()
|
||||
}
|
||||
|
||||
layersTrace {
|
||||
noUncoveredRegions(Surface.ROTATION_0, configuration.endRotation)
|
||||
statusBarLayerIsAlwaysVisible()
|
||||
navBarLayerIsAlwaysVisible()
|
||||
imeLayerBecomesVisible()
|
||||
appLayerReplacesWallpaperLayer(testAppComponentName.className)
|
||||
|
||||
if (!isRotated) {
|
||||
navBarLayerRotatesAndScales(Surface.ROTATION_0,
|
||||
configuration.endRotation)
|
||||
statusBarLayerRotatesScales(Surface.ROTATION_0,
|
||||
configuration.endRotation)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flaky {
|
||||
layersTrace {
|
||||
visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
if (isRotated) {
|
||||
navBarLayerRotatesAndScales(Surface.ROTATION_0,
|
||||
configuration.endRotation)
|
||||
statusBarLayerRotatesScales(Surface.ROTATION_0,
|
||||
configuration.endRotation)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(repetitions = 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
package com.android.server.wm.flicker.launch
|
||||
|
||||
import android.platform.helpers.IAppHelper
|
||||
import com.android.server.wm.flicker.dsl.WmAssertionBuilder
|
||||
import com.android.server.wm.flicker.FlickerTestParameter
|
||||
|
||||
fun WmAssertionBuilder.appWindowReplacesLauncherAsTopWindow(testApp: IAppHelper, bugId: Int = 0) {
|
||||
all("appWindowReplacesLauncherAsTopWindow", bugId) {
|
||||
fun FlickerTestParameter.appWindowReplacesLauncherAsTopWindow(testApp: IAppHelper) {
|
||||
assertWm {
|
||||
this.showsAppWindowOnTop("Launcher")
|
||||
.then()
|
||||
.showsAppWindowOnTop("Snapshot", testApp.getPackage())
|
||||
.then()
|
||||
.showsAppWindowOnTop("Snapshot", testApp.getPackage())
|
||||
}
|
||||
}
|
||||
@@ -16,14 +16,17 @@
|
||||
|
||||
package com.android.server.wm.flicker.launch
|
||||
|
||||
import android.app.Instrumentation
|
||||
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.FlickerTestRunnerFactory
|
||||
import com.android.server.wm.flicker.FlickerTestRunner
|
||||
import com.android.server.wm.flicker.endRotation
|
||||
import com.android.server.wm.flicker.FlickerBuilderProvider
|
||||
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.focusChanges
|
||||
import com.android.server.wm.flicker.helpers.buildTestTag
|
||||
import com.android.server.wm.flicker.helpers.setRotation
|
||||
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
|
||||
import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible
|
||||
@@ -39,9 +42,11 @@ import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEn
|
||||
import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry
|
||||
import com.android.server.wm.flicker.wallpaperWindowBecomesInvisible
|
||||
import com.android.server.wm.flicker.appLayerReplacesWallpaperLayer
|
||||
import com.android.server.wm.flicker.dsl.FlickerBuilder
|
||||
import com.android.server.wm.flicker.helpers.SimpleAppHelper
|
||||
import com.android.server.wm.flicker.helpers.isRotated
|
||||
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
|
||||
@@ -52,85 +57,122 @@ import org.junit.runners.Parameterized
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
class OpenAppColdTest(
|
||||
testSpec: FlickerTestRunnerFactory.TestSpec
|
||||
) : FlickerTestRunner(testSpec) {
|
||||
class OpenAppColdTest(private val testSpec: FlickerTestParameter) {
|
||||
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
private val testApp = SimpleAppHelper(instrumentation)
|
||||
|
||||
@FlickerBuilderProvider
|
||||
fun buildFlicker(): FlickerBuilder {
|
||||
return FlickerBuilder(instrumentation).apply {
|
||||
withTestName { testSpec.name }
|
||||
repeat { testSpec.config.repetitions }
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
}
|
||||
eachRun {
|
||||
this.setRotation(testSpec.config.startRotation)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
// wmHelper.waitForFullScreenApp(testApp.component)
|
||||
}
|
||||
teardown {
|
||||
eachRun {
|
||||
testApp.exit()
|
||||
wmHelper.waitForAppTransitionIdle()
|
||||
this.setRotation(Surface.ROTATION_0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
|
||||
testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun appWindowReplacesLauncherAsTopWindow() =
|
||||
testSpec.appWindowReplacesLauncherAsTopWindow(testApp)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun wallpaperWindowBecomesInvisible() = testSpec.wallpaperWindowBecomesInvisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
// During testing the launcher is always in portrait mode
|
||||
fun noUncoveredRegions() = testSpec.noUncoveredRegions(testSpec.config.startRotation,
|
||||
Surface.ROTATION_0)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun navBarLayerIsAlwaysVisible() = testSpec.navBarLayerIsAlwaysVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsAlwaysVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun appLayerReplacesWallpaperLayer() =
|
||||
testSpec.appLayerReplacesWallpaperLayer(testApp.`package`)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun navBarLayerRotatesAndScales() {
|
||||
Assume.assumeFalse(testSpec.isRotated)
|
||||
testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun navBarLayerRotatesAndScales_Flaky() {
|
||||
Assume.assumeTrue(testSpec.isRotated)
|
||||
testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarLayerRotatesScales() {
|
||||
Assume.assumeFalse(testSpec.isRotated)
|
||||
testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun statusBarLayerRotatesScales_Flaky() {
|
||||
Assume.assumeTrue(testSpec.isRotated)
|
||||
testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun focusChanges() = testSpec.focusChanges("NexusLauncherActivity", testApp.`package`)
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun visibleLayersShownMoreThanOneConsecutiveEntry() =
|
||||
testSpec.visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): List<Array<Any>> {
|
||||
val instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
val testApp = SimpleAppHelper(instrumentation)
|
||||
return FlickerTestRunnerFactory.getInstance()
|
||||
.buildTest(instrumentation) { configuration ->
|
||||
withTestName { buildTestTag(configuration) }
|
||||
repeat { configuration.repetitions }
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
}
|
||||
eachRun {
|
||||
this.setRotation(configuration.startRotation)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
testApp.open()
|
||||
wmHelper.waitForFullScreenApp(testApp.component)
|
||||
}
|
||||
teardown {
|
||||
eachRun {
|
||||
testApp.exit()
|
||||
wmHelper.waitForAppTransitionIdle()
|
||||
this.setRotation(Surface.ROTATION_0)
|
||||
}
|
||||
}
|
||||
assertions {
|
||||
val isRotated = configuration.startRotation.isRotated()
|
||||
|
||||
presubmit {
|
||||
windowManagerTrace {
|
||||
navBarWindowIsAlwaysVisible()
|
||||
statusBarWindowIsAlwaysVisible()
|
||||
visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||
appWindowReplacesLauncherAsTopWindow(testApp)
|
||||
wallpaperWindowBecomesInvisible()
|
||||
}
|
||||
|
||||
layersTrace {
|
||||
// During testing the launcher is always in portrait mode
|
||||
noUncoveredRegions(Surface.ROTATION_0, configuration.endRotation)
|
||||
navBarLayerIsAlwaysVisible()
|
||||
statusBarLayerIsAlwaysVisible()
|
||||
appLayerReplacesWallpaperLayer(testApp.`package`)
|
||||
|
||||
if (!isRotated) {
|
||||
navBarLayerRotatesAndScales(Surface.ROTATION_0,
|
||||
configuration.endRotation)
|
||||
statusBarLayerRotatesScales(Surface.ROTATION_0,
|
||||
configuration.endRotation)
|
||||
}
|
||||
}
|
||||
|
||||
eventLog {
|
||||
focusChanges("NexusLauncherActivity", testApp.`package`)
|
||||
}
|
||||
}
|
||||
|
||||
flaky {
|
||||
layersTrace {
|
||||
visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
if (isRotated) {
|
||||
navBarLayerRotatesAndScales(Surface.ROTATION_0,
|
||||
configuration.endRotation)
|
||||
statusBarLayerRotatesScales(Surface.ROTATION_0,
|
||||
configuration.endRotation)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,17 +16,22 @@
|
||||
|
||||
package com.android.server.wm.flicker.launch
|
||||
|
||||
import android.app.Instrumentation
|
||||
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.FlickerTestRunnerFactory
|
||||
import com.android.server.wm.flicker.FlickerTestRunner
|
||||
import com.android.server.wm.flicker.FlickerBuilderProvider
|
||||
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.endRotation
|
||||
import com.android.server.wm.flicker.focusChanges
|
||||
import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry
|
||||
import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry
|
||||
import com.android.server.wm.flicker.helpers.reopenAppFromOverview
|
||||
import com.android.server.wm.flicker.helpers.buildTestTag
|
||||
import com.android.server.wm.flicker.helpers.setRotation
|
||||
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
|
||||
import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible
|
||||
@@ -40,9 +45,11 @@ import com.android.server.wm.flicker.statusBarLayerRotatesScales
|
||||
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.wallpaperWindowBecomesInvisible
|
||||
import com.android.server.wm.flicker.appLayerReplacesWallpaperLayer
|
||||
import com.android.server.wm.flicker.dsl.FlickerBuilder
|
||||
import com.android.server.wm.flicker.helpers.SimpleAppHelper
|
||||
import com.android.server.wm.flicker.helpers.isRotated
|
||||
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
|
||||
@@ -53,97 +60,115 @@ import org.junit.runners.Parameterized
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
class OpenAppFromOverviewTest(
|
||||
testSpec: FlickerTestRunnerFactory.TestSpec
|
||||
) : FlickerTestRunner(testSpec) {
|
||||
class OpenAppFromOverviewTest(private val testSpec: FlickerTestParameter) {
|
||||
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
private val testApp = SimpleAppHelper(instrumentation)
|
||||
|
||||
@FlickerBuilderProvider
|
||||
fun buildFlicker(): FlickerBuilder {
|
||||
return FlickerBuilder(instrumentation).apply {
|
||||
withTestName { testSpec.name }
|
||||
repeat { testSpec.config.repetitions }
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
}
|
||||
eachRun {
|
||||
device.pressHome()
|
||||
wmHelper.waitForAppTransitionIdle()
|
||||
device.pressRecentApps()
|
||||
wmHelper.waitForAppTransitionIdle()
|
||||
this.setRotation(testSpec.config.startRotation)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
device.reopenAppFromOverview(wmHelper)
|
||||
wmHelper.waitForFullScreenApp(testApp.component)
|
||||
}
|
||||
teardown {
|
||||
test {
|
||||
testApp.exit()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
@Test
|
||||
fun appWindowReplacesLauncherAsTopWindow() =
|
||||
testSpec.appWindowReplacesLauncherAsTopWindow(testApp)
|
||||
|
||||
@Test
|
||||
fun wallpaperWindowBecomesInvisible() = testSpec.wallpaperWindowBecomesInvisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun appLayerReplacesWallpaperLayer() =
|
||||
testSpec.appLayerReplacesWallpaperLayer(testApp.`package`)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun navBarLayerRotatesAndScales() {
|
||||
Assume.assumeFalse(testSpec.isRotated)
|
||||
testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarLayerRotatesScales() {
|
||||
Assume.assumeFalse(testSpec.isRotated)
|
||||
testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarLayerIsAlwaysVisible() {
|
||||
Assume.assumeTrue(testSpec.isRotated)
|
||||
testSpec.statusBarLayerIsAlwaysVisible()
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun navBarLayerIsAlwaysVisible() {
|
||||
Assume.assumeTrue(testSpec.isRotated)
|
||||
testSpec.navBarLayerIsAlwaysVisible()
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun focusChanges() = testSpec.focusChanges("NexusLauncherActivity", testApp.`package`)
|
||||
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
|
||||
testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun visibleLayersShownMoreThanOneConsecutiveEntry() =
|
||||
testSpec.visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
@FlakyTest(bugId = 141361128)
|
||||
@Test
|
||||
fun noUncoveredRegions() = testSpec.noUncoveredRegions(Surface.ROTATION_0,
|
||||
testSpec.config.endRotation)
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): List<Array<Any>> {
|
||||
val instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
val testApp = SimpleAppHelper(instrumentation)
|
||||
return FlickerTestRunnerFactory.getInstance()
|
||||
.buildTest(instrumentation, repetitions = 5) { configuration ->
|
||||
withTestName { buildTestTag(configuration) }
|
||||
repeat { configuration.repetitions }
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
}
|
||||
eachRun {
|
||||
device.pressHome()
|
||||
wmHelper.waitForAppTransitionIdle()
|
||||
device.pressRecentApps()
|
||||
wmHelper.waitForAppTransitionIdle()
|
||||
this.setRotation(configuration.startRotation)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
device.reopenAppFromOverview(wmHelper)
|
||||
wmHelper.waitForFullScreenApp(testApp.component)
|
||||
}
|
||||
teardown {
|
||||
test {
|
||||
testApp.exit()
|
||||
}
|
||||
}
|
||||
assertions {
|
||||
val isRotated = configuration.startRotation.isRotated()
|
||||
|
||||
presubmit {
|
||||
windowManagerTrace {
|
||||
navBarWindowIsAlwaysVisible()
|
||||
statusBarWindowIsAlwaysVisible()
|
||||
appWindowReplacesLauncherAsTopWindow(testApp)
|
||||
wallpaperWindowBecomesInvisible()
|
||||
}
|
||||
|
||||
layersTrace {
|
||||
appLayerReplacesWallpaperLayer(testApp.`package`)
|
||||
|
||||
if (!isRotated) {
|
||||
navBarLayerRotatesAndScales(Surface.ROTATION_0,
|
||||
configuration.endRotation)
|
||||
statusBarLayerRotatesScales(Surface.ROTATION_0,
|
||||
configuration.endRotation)
|
||||
} else {
|
||||
statusBarLayerIsAlwaysVisible()
|
||||
navBarLayerIsAlwaysVisible()
|
||||
}
|
||||
}
|
||||
|
||||
eventLog {
|
||||
focusChanges("NexusLauncherActivity", testApp.`package`)
|
||||
}
|
||||
}
|
||||
|
||||
postsubmit {
|
||||
windowManagerTrace {
|
||||
visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||
}
|
||||
}
|
||||
|
||||
flaky {
|
||||
layersTrace {
|
||||
visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
noUncoveredRegions(Surface.ROTATION_0, configuration.endRotation,
|
||||
bugId = 141361128)
|
||||
|
||||
if (isRotated) {
|
||||
navBarLayerRotatesAndScales(Surface.ROTATION_0,
|
||||
configuration.endRotation)
|
||||
statusBarLayerRotatesScales(Surface.ROTATION_0,
|
||||
configuration.endRotation)
|
||||
} else {
|
||||
statusBarLayerIsAlwaysVisible()
|
||||
navBarLayerIsAlwaysVisible()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigNonRotationTests(repetitions = 5)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,14 +16,17 @@
|
||||
|
||||
package com.android.server.wm.flicker.launch
|
||||
|
||||
import android.app.Instrumentation
|
||||
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.FlickerTestRunnerFactory
|
||||
import com.android.server.wm.flicker.FlickerTestRunner
|
||||
import com.android.server.wm.flicker.endRotation
|
||||
import com.android.server.wm.flicker.FlickerBuilderProvider
|
||||
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.focusChanges
|
||||
import com.android.server.wm.flicker.helpers.buildTestTag
|
||||
import com.android.server.wm.flicker.helpers.setRotation
|
||||
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
|
||||
import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible
|
||||
@@ -36,12 +39,13 @@ import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.statusBarLayerRotatesScales
|
||||
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry
|
||||
import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry
|
||||
import com.android.server.wm.flicker.wallpaperWindowBecomesInvisible
|
||||
import com.android.server.wm.flicker.appLayerReplacesWallpaperLayer
|
||||
import com.android.server.wm.flicker.dsl.FlickerBuilder
|
||||
import com.android.server.wm.flicker.helpers.SimpleAppHelper
|
||||
import com.android.server.wm.flicker.helpers.isRotated
|
||||
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
|
||||
@@ -52,89 +56,122 @@ import org.junit.runners.Parameterized
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
class OpenAppWarmTest(testSpec: FlickerTestRunnerFactory.TestSpec) : FlickerTestRunner(testSpec) {
|
||||
class OpenAppWarmTest(private val testSpec: FlickerTestParameter) {
|
||||
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
private val testApp = SimpleAppHelper(instrumentation)
|
||||
|
||||
@FlickerBuilderProvider
|
||||
fun buildFlicker(): FlickerBuilder {
|
||||
return FlickerBuilder(instrumentation).apply {
|
||||
withTestName { testSpec.name }
|
||||
repeat { testSpec.config.repetitions }
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
// wmHelper.waitForFullScreenApp(testApp.component)
|
||||
}
|
||||
eachRun {
|
||||
device.pressHome()
|
||||
wmHelper.waitForHomeActivityVisible()
|
||||
this.setRotation(testSpec.config.startRotation)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
wmHelper.waitForFullScreenApp(testApp.component)
|
||||
}
|
||||
teardown {
|
||||
eachRun {
|
||||
this.setRotation(Surface.ROTATION_0)
|
||||
}
|
||||
test {
|
||||
testApp.exit()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
|
||||
testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun appWindowReplacesLauncherAsTopWindow() =
|
||||
testSpec.appWindowReplacesLauncherAsTopWindow(testApp)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun wallpaperWindowBecomesInvisible() = testSpec.wallpaperWindowBecomesInvisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
// During testing the launcher is always in portrait mode
|
||||
fun noUncoveredRegions() = testSpec.noUncoveredRegions(testSpec.config.startRotation,
|
||||
Surface.ROTATION_0)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun navBarLayerIsAlwaysVisible() = testSpec.navBarLayerIsAlwaysVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsAlwaysVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun appLayerReplacesWallpaperLayer() =
|
||||
testSpec.appLayerReplacesWallpaperLayer(testApp.`package`)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun navBarLayerRotatesAndScales() {
|
||||
Assume.assumeFalse(testSpec.isRotated)
|
||||
testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun navBarLayerRotatesAndScales_Flaky() {
|
||||
Assume.assumeTrue(testSpec.isRotated)
|
||||
testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarLayerRotatesScales() {
|
||||
Assume.assumeFalse(testSpec.isRotated)
|
||||
testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun statusBarLayerRotatesScales_Flaky() {
|
||||
Assume.assumeTrue(testSpec.isRotated)
|
||||
testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun focusChanges() = testSpec.focusChanges("NexusLauncherActivity", testApp.`package`)
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): List<Array<Any>> {
|
||||
val instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
val testApp = SimpleAppHelper(instrumentation)
|
||||
return FlickerTestRunnerFactory.getInstance()
|
||||
.buildTest(instrumentation) { configuration ->
|
||||
withTestName { buildTestTag(configuration) }
|
||||
repeat { configuration.repetitions }
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
testApp.open()
|
||||
wmHelper.waitForFullScreenApp(testApp.component)
|
||||
}
|
||||
eachRun {
|
||||
device.pressHome()
|
||||
wmHelper.waitForHomeActivityVisible()
|
||||
this.setRotation(configuration.startRotation)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
testApp.open()
|
||||
wmHelper.waitForFullScreenApp(testApp.component)
|
||||
}
|
||||
teardown {
|
||||
eachRun {
|
||||
this.setRotation(Surface.ROTATION_0)
|
||||
}
|
||||
test {
|
||||
testApp.exit()
|
||||
}
|
||||
}
|
||||
assertions {
|
||||
val isRotated = configuration.startRotation.isRotated()
|
||||
|
||||
presubmit {
|
||||
windowManagerTrace {
|
||||
navBarWindowIsAlwaysVisible()
|
||||
statusBarWindowIsAlwaysVisible()
|
||||
visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
appWindowReplacesLauncherAsTopWindow(testApp)
|
||||
wallpaperWindowBecomesInvisible()
|
||||
}
|
||||
|
||||
layersTrace {
|
||||
// During testing the launcher is always in portrait mode
|
||||
noUncoveredRegions(Surface.ROTATION_0, configuration.endRotation)
|
||||
navBarLayerIsAlwaysVisible()
|
||||
statusBarLayerIsAlwaysVisible()
|
||||
appLayerReplacesWallpaperLayer(testApp.`package`)
|
||||
|
||||
if (!isRotated) {
|
||||
navBarLayerRotatesAndScales(Surface.ROTATION_0,
|
||||
configuration.endRotation)
|
||||
statusBarLayerRotatesScales(Surface.ROTATION_0,
|
||||
configuration.endRotation)
|
||||
}
|
||||
}
|
||||
|
||||
eventLog {
|
||||
focusChanges("NexusLauncherActivity", testApp.`package`)
|
||||
}
|
||||
}
|
||||
|
||||
flaky {
|
||||
layersTrace {
|
||||
visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
if (isRotated) {
|
||||
navBarLayerRotatesAndScales(Surface.ROTATION_0,
|
||||
configuration.endRotation)
|
||||
statusBarLayerRotatesScales(Surface.ROTATION_0,
|
||||
configuration.endRotation)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,28 +17,27 @@
|
||||
package com.android.server.wm.flicker.rotation
|
||||
|
||||
import android.os.Bundle
|
||||
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.FlickerTestRunner
|
||||
import com.android.server.wm.flicker.FlickerTestRunnerFactory
|
||||
import com.android.server.wm.flicker.dsl.FlickerBuilder
|
||||
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.endRotation
|
||||
import com.android.server.wm.flicker.focusDoesNotChange
|
||||
import com.android.server.wm.flicker.helpers.SimpleAppHelper
|
||||
import com.android.server.wm.flicker.helpers.StandardAppHelper
|
||||
import com.android.server.wm.flicker.helpers.WindowUtils
|
||||
import com.android.server.wm.flicker.helpers.buildTestTag
|
||||
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
|
||||
import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry
|
||||
import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry
|
||||
import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.statusBarLayerRotatesScales
|
||||
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry
|
||||
import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry
|
||||
import org.junit.FixMethodOrder
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.junit.runners.MethodSorters
|
||||
import org.junit.runners.Parameterized
|
||||
@@ -49,78 +48,95 @@ import org.junit.runners.Parameterized
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
class ChangeAppRotationTest(
|
||||
testSpec: FlickerTestRunnerFactory.TestSpec
|
||||
) : FlickerTestRunner(testSpec) {
|
||||
companion object : RotationTransition(InstrumentationRegistry.getInstrumentation()) {
|
||||
override val testApp: StandardAppHelper
|
||||
get() = SimpleAppHelper(instrumentation)
|
||||
testSpec: FlickerTestParameter
|
||||
) : RotationTransition(testSpec) {
|
||||
override val testApp = SimpleAppHelper(instrumentation)
|
||||
override fun getAppLaunchParams(configuration: Bundle): Map<String, String> = emptyMap()
|
||||
|
||||
override fun getAppLaunchParams(configuration: Bundle): Map<String, String> = emptyMap()
|
||||
@Presubmit
|
||||
@Test
|
||||
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
|
||||
testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun noUncoveredRegions() = testSpec.noUncoveredRegions(testSpec.config.startRotation,
|
||||
testSpec.config.endRotation, allStates = false)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun screenshotLayerBecomesInvisible() {
|
||||
testSpec.assertLayers {
|
||||
this.showsLayer(testApp.getPackage())
|
||||
.then()
|
||||
.showsLayer(SCREENSHOT_LAYER)
|
||||
.then()
|
||||
.showsLayer(testApp.getPackage())
|
||||
}
|
||||
}
|
||||
|
||||
@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 visibleLayersShownMoreThanOneConsecutiveEntry() =
|
||||
testSpec.visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
@FlakyTest(bugId = 140855415)
|
||||
@Test
|
||||
fun appLayerRotates_StartingPos() {
|
||||
testSpec.assertLayersStart {
|
||||
this.hasVisibleRegion(testApp.getPackage(), startingPos)
|
||||
}
|
||||
}
|
||||
|
||||
@FlakyTest(bugId = 140855415)
|
||||
@Test
|
||||
fun appLayerRotates_EndingPos() {
|
||||
testSpec.assertLayersEnd {
|
||||
this.hasVisibleRegion(testApp.getPackage(), endingPos)
|
||||
}
|
||||
}
|
||||
|
||||
@FlakyTest(bugId = 151179149)
|
||||
@Test
|
||||
fun focusDoesNotChange() = testSpec.focusDoesNotChange()
|
||||
|
||||
companion object {
|
||||
private const val SCREENSHOT_LAYER = "RotationLayer"
|
||||
|
||||
@Parameterized.Parameters(name = "{0}1}")
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<Array<Any>> {
|
||||
val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration ->
|
||||
withTestName { buildTestTag(configuration) }
|
||||
assertions {
|
||||
presubmit {
|
||||
windowManagerTrace {
|
||||
navBarWindowIsAlwaysVisible()
|
||||
statusBarWindowIsAlwaysVisible()
|
||||
visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||
}
|
||||
|
||||
layersTrace {
|
||||
noUncoveredRegions(configuration.startRotation,
|
||||
configuration.endRotation, allStates = false)
|
||||
|
||||
all("screenshotLayerBecomesInvisible") {
|
||||
this.showsLayer(testApp.getPackage())
|
||||
.then()
|
||||
.showsLayer(SCREENSHOT_LAYER)
|
||||
.then()
|
||||
.showsLayer(testApp.getPackage())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flaky {
|
||||
layersTrace {
|
||||
navBarLayerIsAlwaysVisible(bugId = 140855415)
|
||||
statusBarLayerIsAlwaysVisible(bugId = 140855415)
|
||||
navBarLayerRotatesAndScales(configuration.startRotation,
|
||||
configuration.endRotation, bugId = 140855415)
|
||||
statusBarLayerRotatesScales(configuration.startRotation,
|
||||
configuration.endRotation, bugId = 140855415)
|
||||
visibleLayersShownMoreThanOneConsecutiveEntry(bugId = 140855415)
|
||||
|
||||
val startingPos = WindowUtils.getDisplayBounds(
|
||||
configuration.startRotation)
|
||||
val endingPos = WindowUtils.getDisplayBounds(
|
||||
configuration.endRotation)
|
||||
|
||||
start("appLayerRotates_StartingPos", bugId = 140855415) {
|
||||
this.hasVisibleRegion(testApp.getPackage(), startingPos)
|
||||
}
|
||||
|
||||
end("appLayerRotates_EndingPos", bugId = 140855415) {
|
||||
this.hasVisibleRegion(testApp.getPackage(), endingPos)
|
||||
}
|
||||
}
|
||||
|
||||
eventLog {
|
||||
focusDoesNotChange(bugId = 151179149)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FlickerTestRunnerFactory.getInstance()
|
||||
.buildRotationTest(instrumentation, transition, testSpec, repetitions = 5)
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return FlickerTestParameterFactory.getInstance()
|
||||
.getConfigRotationTests(repetitions = 5)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,29 +18,39 @@ package com.android.server.wm.flicker.rotation
|
||||
|
||||
import android.app.Instrumentation
|
||||
import android.os.Bundle
|
||||
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.endRotation
|
||||
import com.android.server.wm.flicker.helpers.StandardAppHelper
|
||||
import com.android.server.wm.flicker.helpers.WindowUtils
|
||||
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
|
||||
|
||||
abstract class RotationTransition(protected val instrumentation: Instrumentation) {
|
||||
abstract val testApp: StandardAppHelper
|
||||
abstract fun getAppLaunchParams(configuration: Bundle): Map<String, String>
|
||||
abstract class RotationTransition(protected val testSpec: FlickerTestParameter) {
|
||||
protected val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
protected val startingPos get() = WindowUtils.getDisplayBounds(testSpec.config.startRotation)
|
||||
protected val endingPos get() = WindowUtils.getDisplayBounds(testSpec.config.endRotation)
|
||||
|
||||
protected open val transition: FlickerBuilder.(Bundle) -> Unit
|
||||
get() = { configuration ->
|
||||
repeat { configuration.repetitions }
|
||||
protected abstract val testApp: StandardAppHelper
|
||||
protected abstract fun getAppLaunchParams(configuration: Bundle): Map<String, String>
|
||||
|
||||
@FlickerBuilderProvider
|
||||
fun buildFlicker(): FlickerBuilder {
|
||||
return FlickerBuilder(instrumentation).apply {
|
||||
withTestName { testSpec.name }
|
||||
repeat { testSpec.config.repetitions }
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
val extras = getAppLaunchParams(configuration)
|
||||
val extras = getAppLaunchParams(testSpec.config)
|
||||
testApp.launchViaIntent(wmHelper, stringExtras = extras)
|
||||
}
|
||||
eachRun {
|
||||
this.setRotation(configuration.startRotation)
|
||||
this.setRotation(testSpec.config.startRotation)
|
||||
}
|
||||
}
|
||||
teardown {
|
||||
@@ -49,7 +59,8 @@ abstract class RotationTransition(protected val instrumentation: Instrumentation
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
this.setRotation(configuration.endRotation)
|
||||
this.setRotation(testSpec.config.endRotation)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,31 +17,30 @@
|
||||
package com.android.server.wm.flicker.rotation
|
||||
|
||||
import android.os.Bundle
|
||||
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.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.appWindowAlwaysVisibleOnTop
|
||||
import com.android.server.wm.flicker.endRotation
|
||||
import com.android.server.wm.flicker.focusDoesNotChange
|
||||
import com.android.server.wm.flicker.appWindowAlwaysVisibleOnTop
|
||||
import com.android.server.wm.flicker.dsl.FlickerBuilder
|
||||
import com.android.server.wm.flicker.helpers.SeamlessRotationAppHelper
|
||||
import com.android.server.wm.flicker.helpers.StandardAppHelper
|
||||
import com.android.server.wm.flicker.layerAlwaysVisible
|
||||
import com.android.server.wm.flicker.helpers.WindowUtils
|
||||
import com.android.server.wm.flicker.helpers.buildTestTag
|
||||
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.visibleWindowsShownMoreThanOneConsecutiveEntry
|
||||
import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry
|
||||
import com.android.server.wm.flicker.startRotation
|
||||
import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.statusBarLayerRotatesScales
|
||||
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.testapp.ActivityOptions
|
||||
import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry
|
||||
import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry
|
||||
import org.junit.FixMethodOrder
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.junit.runners.MethodSorters
|
||||
import org.junit.runners.Parameterized
|
||||
@@ -52,116 +51,108 @@ import org.junit.runners.Parameterized
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
class SeamlessAppRotationTest(
|
||||
testSpec: FlickerTestRunnerFactory.TestSpec
|
||||
) : FlickerTestRunner(testSpec) {
|
||||
companion object : RotationTransition(InstrumentationRegistry.getInstrumentation()) {
|
||||
override val testApp: StandardAppHelper
|
||||
get() = SeamlessRotationAppHelper(instrumentation)
|
||||
testSpec: FlickerTestParameter
|
||||
) : RotationTransition(testSpec) {
|
||||
override val testApp = SeamlessRotationAppHelper(instrumentation)
|
||||
|
||||
override fun getAppLaunchParams(configuration: Bundle): Map<String, String> = mapOf(
|
||||
ActivityOptions.EXTRA_STARVE_UI_THREAD to configuration.starveUiThread.toString()
|
||||
)
|
||||
override fun getAppLaunchParams(configuration: Bundle): Map<String, String> = mapOf(
|
||||
ActivityOptions.EXTRA_STARVE_UI_THREAD to configuration.starveUiThread.toString()
|
||||
)
|
||||
|
||||
private val testFactory = FlickerTestRunnerFactory.getInstance()
|
||||
@Presubmit
|
||||
@Test
|
||||
fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
|
||||
testSpec.visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun appWindowAlwaysVisibleOnTop() = testSpec.appWindowAlwaysVisibleOnTop(testApp.`package`)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun layerAlwaysVisible() = testSpec.layerAlwaysVisible(testApp.`package`)
|
||||
|
||||
@FlakyTest(bugId = 140855415)
|
||||
@Test
|
||||
fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsAlwaysVisible()
|
||||
|
||||
@FlakyTest(bugId = 140855415)
|
||||
@Test
|
||||
fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
@FlakyTest(bugId = 140855415)
|
||||
@Test
|
||||
fun navBarLayerIsAlwaysVisible() = testSpec.navBarLayerIsAlwaysVisible()
|
||||
|
||||
@FlakyTest(bugId = 140855415)
|
||||
@Test
|
||||
fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsAlwaysVisible()
|
||||
|
||||
@FlakyTest(bugId = 147659548)
|
||||
@Test
|
||||
fun noUncoveredRegions() = testSpec.noUncoveredRegions(testSpec.config.startRotation,
|
||||
testSpec.config.endRotation, allStates = false)
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun navBarLayerRotatesAndScales() = testSpec.navBarLayerRotatesAndScales(
|
||||
testSpec.config.startRotation, testSpec.config.endRotation)
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun statusBarLayerRotatesScales() = testSpec.statusBarLayerRotatesScales(
|
||||
testSpec.config.startRotation, testSpec.config.endRotation)
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun visibleLayersShownMoreThanOneConsecutiveEntry() =
|
||||
testSpec.visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
@FlakyTest(bugId = 147659548)
|
||||
@Test
|
||||
fun appLayerRotates() {
|
||||
testSpec.assertLayers {
|
||||
this.hasVisibleRegion(testApp.`package`, startingPos)
|
||||
}
|
||||
}
|
||||
|
||||
@FlakyTest(bugId = 151179149)
|
||||
@Test
|
||||
fun focusDoesNotChange() = testSpec.focusDoesNotChange()
|
||||
|
||||
companion object {
|
||||
private val testFactory = FlickerTestParameterFactory.getInstance()
|
||||
|
||||
private val Bundle.starveUiThread
|
||||
get() = this.getBoolean(ActivityOptions.EXTRA_STARVE_UI_THREAD, false)
|
||||
|
||||
private fun Bundle.createConfig(starveUiThread: Boolean): Bundle {
|
||||
val config = this.deepCopy()
|
||||
private fun FlickerTestParameter.createConfig(starveUiThread: Boolean): Bundle {
|
||||
val config = this.config.deepCopy()
|
||||
config.putBoolean(ActivityOptions.EXTRA_STARVE_UI_THREAD, starveUiThread)
|
||||
return config
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
private fun getConfigurations(): List<Bundle> {
|
||||
return testFactory.getConfigRotationTests().flatMap {
|
||||
private fun getConfigurations(): List<FlickerTestParameter> {
|
||||
return testFactory.getConfigRotationTests(repetitions = 2).flatMap {
|
||||
val defaultRun = it.createConfig(starveUiThread = false)
|
||||
val busyUiRun = it.createConfig(starveUiThread = true)
|
||||
listOf(defaultRun, busyUiRun)
|
||||
listOf(
|
||||
FlickerTestParameter(defaultRun),
|
||||
FlickerTestParameter(busyUiRun,
|
||||
name = "${FlickerTestParameter.defaultName(busyUiRun)}_BUSY_UI_THREAD"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<Array<Any>> {
|
||||
val configurations = getConfigurations()
|
||||
val testSpec: FlickerBuilder.(Bundle) -> Unit = { configuration ->
|
||||
withTestName {
|
||||
val extra = if (configuration.starveUiThread) {
|
||||
"BUSY_UI_THREAD"
|
||||
} else {
|
||||
""
|
||||
}
|
||||
buildTestTag(configuration, extraInfo = extra)
|
||||
}
|
||||
assertions {
|
||||
val startingBounds = WindowUtils.getDisplayBounds(configuration.startRotation)
|
||||
val endingBounds = WindowUtils.getDisplayBounds(configuration.endRotation)
|
||||
|
||||
presubmit {
|
||||
windowManagerTrace {
|
||||
visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||
appWindowAlwaysVisibleOnTop(testApp.`package`)
|
||||
}
|
||||
|
||||
layersTrace {
|
||||
layerAlwaysVisible(testApp.`package`)
|
||||
}
|
||||
}
|
||||
|
||||
flaky {
|
||||
windowManagerTrace {
|
||||
navBarWindowIsAlwaysVisible(bugId = 140855415)
|
||||
statusBarWindowIsAlwaysVisible(bugId = 140855415)
|
||||
}
|
||||
|
||||
layersTrace {
|
||||
navBarLayerIsAlwaysVisible(bugId = 140855415)
|
||||
statusBarLayerIsAlwaysVisible(bugId = 140855415)
|
||||
noUncoveredRegions(configuration.startRotation,
|
||||
configuration.endRotation, allStates = false, bugId = 147659548)
|
||||
navBarLayerRotatesAndScales(configuration.startRotation,
|
||||
configuration.endRotation)
|
||||
statusBarLayerRotatesScales(configuration.startRotation,
|
||||
configuration.endRotation)
|
||||
visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
all("appLayerRotates", bugId = 147659548) {
|
||||
if (startingBounds == endingBounds) {
|
||||
this.hasVisibleRegion(
|
||||
testApp.`package`, startingBounds)
|
||||
} else {
|
||||
this.hasVisibleRegion(testApp.`package`,
|
||||
startingBounds)
|
||||
.then()
|
||||
.hasVisibleRegion(testApp.`package`,
|
||||
endingBounds)
|
||||
}
|
||||
}
|
||||
|
||||
all("noUncoveredRegions", bugId = 147659548) {
|
||||
if (startingBounds == endingBounds) {
|
||||
this.coversAtLeastRegion(startingBounds)
|
||||
} else {
|
||||
this.coversAtLeastRegion(startingBounds)
|
||||
.then()
|
||||
.coversAtLeastRegion(endingBounds)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
eventLog {
|
||||
focusDoesNotChange(bugId = 151179149)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return testFactory.buildRotationTest(instrumentation, transition, testSpec,
|
||||
deviceConfigurations = configurations, repetitions = 2)
|
||||
fun getParams(): Collection<FlickerTestParameter> {
|
||||
return getConfigurations()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user