Merge "6-1/ Integrate SplitScreen rotation flicker tests"
This commit is contained in:
committed by
Android (Google) Code Review
commit
5cbcf7619f
@@ -16,8 +16,10 @@
|
||||
|
||||
package com.android.wm.shell.flicker
|
||||
|
||||
import android.graphics.Region
|
||||
import com.android.server.wm.flicker.dsl.EventLogAssertion
|
||||
import com.android.server.wm.flicker.dsl.LayersAssertion
|
||||
import com.android.server.wm.flicker.helpers.WindowUtils
|
||||
|
||||
@JvmOverloads
|
||||
fun LayersAssertion.appPairsDividerIsVisible(
|
||||
@@ -59,6 +61,50 @@ fun LayersAssertion.dockedStackDividerIsInvisible(
|
||||
}
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun LayersAssertion.dockedStackPrimaryBoundsIsVisible(
|
||||
rotation: Int,
|
||||
primaryLayerName: String,
|
||||
bugId: Int = 0,
|
||||
enabled: Boolean = bugId == 0
|
||||
) {
|
||||
end("PrimaryAppBounds", bugId, enabled) {
|
||||
val entry = this.trace.entries.firstOrNull()
|
||||
?: throw IllegalStateException("Trace is empty")
|
||||
val dividerRegion = entry.getVisibleBounds(FlickerTestBase.DOCKED_STACK_DIVIDER)
|
||||
this.hasVisibleRegion(primaryLayerName, getPrimaryRegion(dividerRegion, rotation))
|
||||
}
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun LayersAssertion.dockedStackSecondaryBoundsIsVisible(
|
||||
rotation: Int,
|
||||
secondaryLayerName: String,
|
||||
bugId: Int = 0,
|
||||
enabled: Boolean = bugId == 0
|
||||
) {
|
||||
end("SecondaryAppBounds", bugId, enabled) {
|
||||
val entry = this.trace.entries.firstOrNull()
|
||||
?: throw IllegalStateException("Trace is empty")
|
||||
val dividerRegion = entry.getVisibleBounds(FlickerTestBase.DOCKED_STACK_DIVIDER)
|
||||
this.hasVisibleRegion(secondaryLayerName, getSecondaryRegion(dividerRegion, rotation))
|
||||
}
|
||||
}
|
||||
|
||||
fun getPrimaryRegion(dividerRegion: Region, rotation: Int): Region {
|
||||
val displayBounds = WindowUtils.getDisplayBounds(rotation)
|
||||
return Region(0, 0, displayBounds.getBounds().right,
|
||||
dividerRegion.getBounds().bottom - WindowUtils.dockedStackDividerInset)
|
||||
}
|
||||
|
||||
fun getSecondaryRegion(dividerRegion: Region, rotation: Int): Region {
|
||||
val displayBounds = WindowUtils.getDisplayBounds(rotation)
|
||||
return Region(0,
|
||||
dividerRegion.getBounds().bottom - WindowUtils.dockedStackDividerInset,
|
||||
displayBounds.getBounds().right,
|
||||
displayBounds.getBounds().bottom - WindowUtils.navigationBarHeight)
|
||||
}
|
||||
|
||||
fun EventLogAssertion.focusChanges(
|
||||
vararg windows: String,
|
||||
bugId: Int = 0,
|
||||
|
||||
@@ -17,9 +17,7 @@
|
||||
package com.android.wm.shell.flicker.helpers
|
||||
|
||||
import android.app.Instrumentation
|
||||
import android.graphics.Region
|
||||
import android.os.SystemClock
|
||||
import com.android.server.wm.flicker.helpers.WindowUtils
|
||||
import com.android.wm.shell.flicker.testapp.Components
|
||||
|
||||
class SplitScreenHelper(
|
||||
@@ -43,20 +41,6 @@ class SplitScreenHelper(
|
||||
SystemClock.sleep(TIMEOUT_MS)
|
||||
}
|
||||
|
||||
fun getPrimaryBounds(dividerBounds: Region): android.graphics.Region {
|
||||
val primaryAppBounds = Region(0, 0, dividerBounds.bounds.right,
|
||||
dividerBounds.bounds.bottom + WindowUtils.dockedStackDividerInset)
|
||||
return primaryAppBounds
|
||||
}
|
||||
|
||||
fun getSecondaryBounds(dividerBounds: Region): android.graphics.Region {
|
||||
val displayBounds = WindowUtils.displayBounds
|
||||
val secondaryAppBounds = Region(0,
|
||||
dividerBounds.bounds.bottom - WindowUtils.dockedStackDividerInset,
|
||||
displayBounds.right, displayBounds.bottom - WindowUtils.navigationBarHeight)
|
||||
return secondaryAppBounds
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TEST_REPETITIONS = 1
|
||||
const val TIMEOUT_MS = 3_000L
|
||||
|
||||
@@ -35,6 +35,8 @@ 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.dockedStackPrimaryBoundsIsVisible
|
||||
import com.android.wm.shell.flicker.dockedStackSecondaryBoundsIsVisible
|
||||
import org.junit.Assert
|
||||
import org.junit.FixMethodOrder
|
||||
import org.junit.Test
|
||||
@@ -102,13 +104,8 @@ class EnterSplitScreenTest(
|
||||
assertions {
|
||||
layersTrace {
|
||||
dockedStackDividerIsVisible()
|
||||
end("appsEndingBounds", enabled = false) {
|
||||
val entry = this.trace.entries.firstOrNull()
|
||||
?: throw IllegalStateException("Trace is empty")
|
||||
this.hasVisibleRegion(splitScreenApp.defaultWindowName,
|
||||
splitScreenApp.getPrimaryBounds(
|
||||
entry.getVisibleBounds(DOCKED_STACK_DIVIDER)))
|
||||
}
|
||||
dockedStackPrimaryBoundsIsVisible(
|
||||
rotation, splitScreenApp.defaultWindowName, 169271943)
|
||||
}
|
||||
windowManagerTrace {
|
||||
end {
|
||||
@@ -136,17 +133,10 @@ class EnterSplitScreenTest(
|
||||
assertions {
|
||||
layersTrace {
|
||||
dockedStackDividerIsVisible()
|
||||
end("appsEndingBounds", enabled = false) {
|
||||
val entry = this.trace.entries.firstOrNull()
|
||||
?: throw IllegalStateException("Trace is empty")
|
||||
this.hasVisibleRegion(splitScreenApp.defaultWindowName,
|
||||
splitScreenApp.getPrimaryBounds(
|
||||
entry.getVisibleBounds(DOCKED_STACK_DIVIDER)))
|
||||
.and()
|
||||
.hasVisibleRegion(secondaryApp.defaultWindowName,
|
||||
splitScreenApp.getSecondaryBounds(
|
||||
entry.getVisibleBounds(DOCKED_STACK_DIVIDER)))
|
||||
}
|
||||
dockedStackPrimaryBoundsIsVisible(
|
||||
rotation, splitScreenApp.defaultWindowName, 169271943)
|
||||
dockedStackSecondaryBoundsIsVisible(
|
||||
rotation, secondaryApp.defaultWindowName, 169271943)
|
||||
}
|
||||
windowManagerTrace {
|
||||
end {
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* 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.splitscreen
|
||||
|
||||
import android.view.Surface
|
||||
import androidx.test.filters.RequiresDevice
|
||||
import com.android.server.wm.flicker.dsl.FlickerBuilder
|
||||
import com.android.server.wm.flicker.dsl.runWithFlicker
|
||||
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.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.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
|
||||
|
||||
/**
|
||||
* Test open app to split screen.
|
||||
* To run this test: `atest WMShellFlickerTests:RotateOneLaunchedAppTest`
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
class RotateOneLaunchedAppTest(
|
||||
rotationName: String,
|
||||
rotation: Int
|
||||
) : SplitScreenTestBase(rotationName, rotation) {
|
||||
private val splitScreenRotationSetup: FlickerBuilder
|
||||
get() = FlickerBuilder(instrumentation).apply {
|
||||
val testSetupRotation = "testSetupRotation"
|
||||
withTestName {
|
||||
testSetupRotation
|
||||
}
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
}
|
||||
}
|
||||
teardown {
|
||||
eachRun {
|
||||
if (uiDevice.isInSplitScreen()) {
|
||||
uiDevice.exitSplitScreen()
|
||||
}
|
||||
setRotation(Surface.ROTATION_0)
|
||||
splitScreenApp.exit()
|
||||
secondaryApp.exit()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testRotateInSplitScreenMode() {
|
||||
val testTag = "testEnterSplitScreen_launchToSide"
|
||||
runWithFlicker(splitScreenRotationSetup) {
|
||||
withTestName { testTag }
|
||||
repeat {
|
||||
SplitScreenHelper.TEST_REPETITIONS
|
||||
}
|
||||
transitions {
|
||||
splitScreenApp.launchViaIntent()
|
||||
device.launchSplitScreen()
|
||||
setRotation(rotation)
|
||||
}
|
||||
assertions {
|
||||
layersTrace {
|
||||
navBarLayerRotatesAndScales(Surface.ROTATION_0, rotation, 169271943)
|
||||
statusBarLayerRotatesScales(Surface.ROTATION_0, rotation, 169271943)
|
||||
dockedStackDividerIsVisible()
|
||||
dockedStackPrimaryBoundsIsVisible(
|
||||
rotation, splitScreenApp.defaultWindowName, 169271943)
|
||||
}
|
||||
windowManagerTrace {
|
||||
navBarWindowIsAlwaysVisible()
|
||||
statusBarWindowIsAlwaysVisible()
|
||||
end {
|
||||
showsAppWindow(splitScreenApp.defaultWindowName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testRotateAndEnterSplitScreenMode() {
|
||||
val testTag = "testRotateAndEnterSplitScreenMode"
|
||||
runWithFlicker(splitScreenRotationSetup) {
|
||||
withTestName { testTag }
|
||||
repeat {
|
||||
SplitScreenHelper.TEST_REPETITIONS
|
||||
}
|
||||
transitions {
|
||||
splitScreenApp.launchViaIntent()
|
||||
setRotation(rotation)
|
||||
device.launchSplitScreen()
|
||||
}
|
||||
assertions {
|
||||
layersTrace {
|
||||
navBarLayerRotatesAndScales(Surface.ROTATION_0, rotation, 169271943)
|
||||
statusBarLayerRotatesScales(Surface.ROTATION_0, rotation, 169271943)
|
||||
dockedStackDividerIsVisible()
|
||||
dockedStackPrimaryBoundsIsVisible(
|
||||
rotation, splitScreenApp.defaultWindowName, 169271943)
|
||||
}
|
||||
windowManagerTrace {
|
||||
navBarWindowIsAlwaysVisible()
|
||||
statusBarWindowIsAlwaysVisible()
|
||||
end {
|
||||
showsAppWindow(splitScreenApp.defaultWindowName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<Array<Any>> {
|
||||
val supportedRotations = intArrayOf(Surface.ROTATION_90, Surface.ROTATION_270)
|
||||
return supportedRotations.map { arrayOf(Surface.rotationToString(it), it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* 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.splitscreen
|
||||
|
||||
import android.view.Surface
|
||||
import androidx.test.filters.RequiresDevice
|
||||
import com.android.server.wm.flicker.dsl.FlickerBuilder
|
||||
import com.android.server.wm.flicker.dsl.runWithFlicker
|
||||
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.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.dockedStackDividerIsVisible
|
||||
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
|
||||
|
||||
/**
|
||||
* Test open app to split screen.
|
||||
* To run this test: `atest WMShellFlickerTests:RotateTwoLaunchedAppTest`
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
class RotateTwoLaunchedAppTest(
|
||||
rotationName: String,
|
||||
rotation: Int
|
||||
) : SplitScreenTestBase(rotationName, rotation) {
|
||||
private val splitScreenRotationSetup: FlickerBuilder
|
||||
get() = FlickerBuilder(instrumentation).apply {
|
||||
val testSetupRotation = "testSetupRotation"
|
||||
withTestName {
|
||||
testSetupRotation
|
||||
}
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
}
|
||||
}
|
||||
teardown {
|
||||
eachRun {
|
||||
if (uiDevice.isInSplitScreen()) {
|
||||
uiDevice.exitSplitScreen()
|
||||
}
|
||||
setRotation(Surface.ROTATION_0)
|
||||
splitScreenApp.exit()
|
||||
secondaryApp.exit()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testRotateInSplitScreenMode() {
|
||||
val testTag = "testRotateInSplitScreenMode"
|
||||
runWithFlicker(splitScreenRotationSetup) {
|
||||
withTestName { testTag }
|
||||
repeat {
|
||||
SplitScreenHelper.TEST_REPETITIONS
|
||||
}
|
||||
transitions {
|
||||
secondaryApp.launchViaIntent()
|
||||
splitScreenApp.launchViaIntent()
|
||||
device.launchSplitScreen()
|
||||
splitScreenApp.reopenAppFromOverview()
|
||||
setRotation(rotation)
|
||||
}
|
||||
assertions {
|
||||
layersTrace {
|
||||
navBarLayerRotatesAndScales(Surface.ROTATION_0, rotation, 169271943)
|
||||
statusBarLayerRotatesScales(Surface.ROTATION_0, rotation, 169271943)
|
||||
dockedStackDividerIsVisible()
|
||||
dockedStackPrimaryBoundsIsVisible(
|
||||
rotation, splitScreenApp.defaultWindowName, 169271943)
|
||||
dockedStackSecondaryBoundsIsVisible(
|
||||
rotation, secondaryApp.defaultWindowName, 169271943)
|
||||
}
|
||||
windowManagerTrace {
|
||||
navBarWindowIsAlwaysVisible()
|
||||
statusBarWindowIsAlwaysVisible()
|
||||
end {
|
||||
showsAppWindow(splitScreenApp.defaultWindowName)
|
||||
.and().showsAppWindow(secondaryApp.defaultWindowName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testRotateAndEnterSplitScreenMode() {
|
||||
val testTag = "testRotateAndEnterSplitScreenMode"
|
||||
runWithFlicker(splitScreenRotationSetup) {
|
||||
withTestName { testTag }
|
||||
repeat {
|
||||
SplitScreenHelper.TEST_REPETITIONS
|
||||
}
|
||||
transitions {
|
||||
secondaryApp.launchViaIntent()
|
||||
splitScreenApp.launchViaIntent()
|
||||
setRotation(rotation)
|
||||
device.launchSplitScreen()
|
||||
splitScreenApp.reopenAppFromOverview()
|
||||
}
|
||||
assertions {
|
||||
layersTrace {
|
||||
navBarLayerRotatesAndScales(Surface.ROTATION_0, rotation, 169271943)
|
||||
statusBarLayerRotatesScales(Surface.ROTATION_0, rotation, 169271943)
|
||||
dockedStackDividerIsVisible()
|
||||
dockedStackPrimaryBoundsIsVisible(
|
||||
rotation, splitScreenApp.defaultWindowName, 169271943)
|
||||
dockedStackSecondaryBoundsIsVisible(
|
||||
rotation, secondaryApp.defaultWindowName, 169271943)
|
||||
}
|
||||
windowManagerTrace {
|
||||
navBarWindowIsAlwaysVisible()
|
||||
statusBarWindowIsAlwaysVisible()
|
||||
end {
|
||||
showsAppWindow(splitScreenApp.defaultWindowName)
|
||||
.and().showsAppWindow(secondaryApp.defaultWindowName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<Array<Any>> {
|
||||
val supportedRotations = intArrayOf(Surface.ROTATION_90, Surface.ROTATION_270)
|
||||
return supportedRotations.map { arrayOf(Surface.rotationToString(it), it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,95 +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.splitscreen
|
||||
|
||||
import androidx.test.filters.FlakyTest
|
||||
import android.view.Surface
|
||||
import androidx.test.filters.RequiresDevice
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import com.android.server.wm.flicker.Flicker
|
||||
import com.android.server.wm.flicker.FlickerTestRunner
|
||||
import com.android.server.wm.flicker.FlickerTestRunnerFactory
|
||||
import com.android.server.wm.flicker.helpers.StandardAppHelper
|
||||
import com.android.server.wm.flicker.startRotation
|
||||
import com.android.server.wm.flicker.endRotation
|
||||
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.setRotation
|
||||
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
|
||||
import com.android.server.wm.flicker.repetitions
|
||||
import org.junit.FixMethodOrder
|
||||
import org.junit.runner.RunWith
|
||||
import org.junit.runners.MethodSorters
|
||||
import org.junit.runners.Parameterized
|
||||
|
||||
/**
|
||||
* Test open app to split screen.
|
||||
* To run this test: `atest WMShellFlickerTests:SplitScreenRotateOneLaunchedAppTest`
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
@FlakyTest
|
||||
class SplitScreenRotateOneLaunchedAppTest(
|
||||
testName: String,
|
||||
flickerSpec: Flicker
|
||||
) : FlickerTestRunner(testName, flickerSpec) {
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<Array<Any>> {
|
||||
val instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
val testApp = StandardAppHelper(instrumentation,
|
||||
"com.android.wm.shell.flicker.testapp", "SimpleApp")
|
||||
|
||||
return FlickerTestRunnerFactory(instrumentation, repetitions = 3)
|
||||
.buildTest { configuration ->
|
||||
withTestName {
|
||||
buildTestTag("splitScreenRotateOneApp", testApp, configuration)
|
||||
}
|
||||
repeat { configuration.repetitions }
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
testApp.open()
|
||||
device.launchSplitScreen()
|
||||
device.waitForIdle()
|
||||
}
|
||||
eachRun {
|
||||
this.setRotation(configuration.startRotation)
|
||||
}
|
||||
}
|
||||
teardown {
|
||||
eachRun {
|
||||
setRotation(Surface.ROTATION_0)
|
||||
}
|
||||
test {
|
||||
testApp.exit()
|
||||
if (device.isInSplitScreen()) {
|
||||
device.exitSplitScreen()
|
||||
}
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
this.setRotation(configuration.endRotation)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,104 +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.splitscreen
|
||||
|
||||
import androidx.test.filters.FlakyTest
|
||||
import android.view.Surface
|
||||
import androidx.test.filters.RequiresDevice
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import com.android.server.wm.flicker.Flicker
|
||||
import com.android.server.wm.flicker.FlickerTestRunner
|
||||
import com.android.server.wm.flicker.FlickerTestRunnerFactory
|
||||
import com.android.server.wm.flicker.helpers.StandardAppHelper
|
||||
import com.android.server.wm.flicker.startRotation
|
||||
import com.android.server.wm.flicker.endRotation
|
||||
import com.android.server.wm.flicker.helpers.buildTestTag
|
||||
import com.android.server.wm.flicker.helpers.exitSplitScreen
|
||||
import com.android.server.wm.flicker.helpers.reopenAppFromOverview
|
||||
import com.android.server.wm.flicker.helpers.isInSplitScreen
|
||||
import com.android.server.wm.flicker.helpers.launchSplitScreen
|
||||
import com.android.server.wm.flicker.helpers.setRotation
|
||||
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
|
||||
import com.android.server.wm.flicker.repetitions
|
||||
import org.junit.FixMethodOrder
|
||||
import org.junit.runner.RunWith
|
||||
import org.junit.runners.MethodSorters
|
||||
import org.junit.runners.Parameterized
|
||||
|
||||
/**
|
||||
* Test open app to split screen.
|
||||
* To run this test: `atest WMShellFlickerTests:SplitScreenRotateTwoLaunchedAppTest`
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
@FlakyTest
|
||||
class SplitScreenRotateTwoLaunchedAppTest(
|
||||
testName: String,
|
||||
flickerSpec: Flicker
|
||||
) : FlickerTestRunner(testName, flickerSpec) {
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<Array<Any>> {
|
||||
val instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
val testApp = StandardAppHelper(instrumentation,
|
||||
"com.android.wm.shell.flicker.testapp", "SimpleApp")
|
||||
val secondaryApp = StandardAppHelper(instrumentation,
|
||||
"com.android.wm.shell.flicker.testapp",
|
||||
"SplitScreenSecondaryApp")
|
||||
|
||||
return FlickerTestRunnerFactory(instrumentation, repetitions = 3)
|
||||
.buildTest { configuration ->
|
||||
withTestName {
|
||||
buildTestTag("splitScreenRotateTwoApps", testApp, configuration)
|
||||
}
|
||||
repeat { configuration.repetitions }
|
||||
setup {
|
||||
test {
|
||||
device.wakeUpAndGoToHomeScreen()
|
||||
testApp.open()
|
||||
device.pressHome()
|
||||
secondaryApp.open()
|
||||
device.pressHome()
|
||||
device.launchSplitScreen()
|
||||
device.reopenAppFromOverview()
|
||||
device.waitForIdle()
|
||||
}
|
||||
eachRun {
|
||||
this.setRotation(configuration.startRotation)
|
||||
}
|
||||
}
|
||||
teardown {
|
||||
eachRun {
|
||||
setRotation(Surface.ROTATION_0)
|
||||
}
|
||||
test {
|
||||
testApp.exit()
|
||||
secondaryApp.exit()
|
||||
if (device.isInSplitScreen()) {
|
||||
device.exitSplitScreen()
|
||||
}
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
this.setRotation(configuration.endRotation)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user