5-1/ Migrate CTS split screen testNonResizeable tests
1. testNonResizeableNotDocked 2. testNonResizeableWhenAlreadyInSplitScreenPrimary 3. testNonResizeableWhenAlreadyInSplitScreenSecondary 4. Refine the test flow to be more effeciency Test: atest WMShellFlickerTests:EnterSplitScreenTest Test: atest WMShellFlickerTests:AppPairsTest Bug: 161435597 Change-Id: I271a522f220a65b1be7de6599a9ed185f06888b3
This commit is contained in:
@@ -37,3 +37,4 @@ const val TEST_APP_FIXED_ACTIVITY_LABEL = "FixedApp"
|
||||
// Test App > SplitScreen Activity
|
||||
const val TEST_APP_SPLITSCREEN_PRIMARY_LABEL = "SplitScreenPrimaryApp"
|
||||
const val TEST_APP_SPLITSCREEN_SECONDARY_LABEL = "SplitScreenSecondaryApp"
|
||||
const val TEST_APP_NONRESIZEABLE_LABEL = "NonResizeableApp"
|
||||
|
||||
@@ -61,10 +61,9 @@ class AppPairsTest(
|
||||
setup {
|
||||
eachRun {
|
||||
uiDevice.wakeUpAndGoToHomeScreen()
|
||||
primaryApp.open()
|
||||
uiDevice.pressHome()
|
||||
secondaryApp.open()
|
||||
uiDevice.pressHome()
|
||||
primaryApp.launchViaIntent()
|
||||
secondaryApp.launchViaIntent()
|
||||
nonResizeableApp.launchViaIntent()
|
||||
updateTaskId()
|
||||
}
|
||||
}
|
||||
@@ -90,7 +89,7 @@ class AppPairsTest(
|
||||
|
||||
@Test
|
||||
fun testAppPairs_pairPrimaryAndSecondaryApps() {
|
||||
val testTag = "testAppPaired_pairPrimaryAndSecondary"
|
||||
val testTag = "testAppPairs_pairPrimaryAndSecondaryApps"
|
||||
runWithFlicker(appPairsSetup) {
|
||||
withTestName { testTag }
|
||||
repeat {
|
||||
@@ -176,6 +175,36 @@ class AppPairsTest(
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testAppPairs_canNotPairNonResizeableApps() {
|
||||
val testTag = "testAppPairs_canNotPairNonResizeableApps"
|
||||
runWithFlicker(appPairsSetup) {
|
||||
withTestName { testTag }
|
||||
repeat {
|
||||
TEST_REPETITIONS
|
||||
}
|
||||
transitions {
|
||||
nonResizeableApp.launchViaIntent()
|
||||
// TODO pair apps through normal UX flow
|
||||
executeShellCommand(composePairsCommand(
|
||||
primaryTaskId, nonResizeableTaskId, true /* pair */))
|
||||
SystemClock.sleep(AppPairsHelper.TIMEOUT_MS)
|
||||
}
|
||||
assertions {
|
||||
layersTrace {
|
||||
appPairsDividerIsInvisible()
|
||||
}
|
||||
windowManagerTrace {
|
||||
end {
|
||||
showsAppWindow(nonResizeableApp.defaultWindowName)
|
||||
.and()
|
||||
.hidesAppWindow(primaryApp.defaultWindowName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun composePairsCommand(
|
||||
primaryApp: String,
|
||||
secondaryApp: String,
|
||||
@@ -202,6 +231,7 @@ class AppPairsTest(
|
||||
private fun updateTaskId() {
|
||||
val primaryAppComponent = primaryApp.openAppIntent.component
|
||||
val secondaryAppComponent = secondaryApp.openAppIntent.component
|
||||
val nonResizeableAppComponent = nonResizeableApp.openAppIntent.component
|
||||
if (primaryAppComponent != null) {
|
||||
primaryTaskId = appPairsHelper.getTaskIdForActivity(
|
||||
primaryAppComponent.packageName, primaryAppComponent.className).toString()
|
||||
@@ -210,11 +240,17 @@ class AppPairsTest(
|
||||
secondaryTaskId = appPairsHelper.getTaskIdForActivity(
|
||||
secondaryAppComponent.packageName, secondaryAppComponent.className).toString()
|
||||
}
|
||||
if (nonResizeableAppComponent != null) {
|
||||
nonResizeableTaskId = appPairsHelper.getTaskIdForActivity(
|
||||
nonResizeableAppComponent.packageName,
|
||||
nonResizeableAppComponent.className).toString()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
var primaryTaskId = ""
|
||||
var secondaryTaskId = ""
|
||||
var nonResizeableTaskId = ""
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
fun getParams(): Collection<Array<Any>> {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.wm.shell.flicker.apppairs
|
||||
|
||||
import com.android.wm.shell.flicker.NonRotationTestBase
|
||||
import com.android.wm.shell.flicker.TEST_APP_NONRESIZEABLE_LABEL
|
||||
import com.android.wm.shell.flicker.TEST_APP_SPLITSCREEN_PRIMARY_LABEL
|
||||
import com.android.wm.shell.flicker.TEST_APP_SPLITSCREEN_SECONDARY_LABEL
|
||||
import com.android.wm.shell.flicker.helpers.AppPairsHelper
|
||||
@@ -36,4 +37,7 @@ abstract class AppPairsTestBase(
|
||||
protected val secondaryApp = SplitScreenHelper(instrumentation,
|
||||
TEST_APP_SPLITSCREEN_SECONDARY_LABEL,
|
||||
Components.SplitScreenSecondaryActivity())
|
||||
protected val nonResizeableApp = SplitScreenHelper(instrumentation,
|
||||
TEST_APP_NONRESIZEABLE_LABEL,
|
||||
Components.NonResizeableActivity())
|
||||
}
|
||||
|
||||
@@ -21,14 +21,21 @@ 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.WindowUtils
|
||||
import com.android.server.wm.flicker.helpers.canSplitScreen
|
||||
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.openQuickstep
|
||||
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
|
||||
import com.android.wm.shell.flicker.dockedStackDividerIsInvisible
|
||||
import com.android.wm.shell.flicker.dockedStackDividerIsVisible
|
||||
import com.android.wm.shell.flicker.helpers.SplitScreenHelper.Companion.TEST_REPETITIONS
|
||||
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 org.junit.Assert
|
||||
import org.junit.FixMethodOrder
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
@@ -56,14 +63,16 @@ class EnterSplitScreenTest(
|
||||
setup {
|
||||
eachRun {
|
||||
uiDevice.wakeUpAndGoToHomeScreen()
|
||||
splitScreenApp.open()
|
||||
uiDevice.pressHome()
|
||||
}
|
||||
}
|
||||
teardown {
|
||||
eachRun {
|
||||
if (uiDevice.isInSplitScreen()) {
|
||||
uiDevice.exitSplitScreen()
|
||||
}
|
||||
splitScreenApp.exit()
|
||||
secondaryApp.exit()
|
||||
nonResizeableApp.exit()
|
||||
}
|
||||
}
|
||||
assertions {
|
||||
@@ -87,6 +96,7 @@ class EnterSplitScreenTest(
|
||||
TEST_REPETITIONS
|
||||
}
|
||||
transitions {
|
||||
splitScreenApp.launchViaIntent()
|
||||
uiDevice.launchSplitScreen()
|
||||
}
|
||||
assertions {
|
||||
@@ -118,10 +128,8 @@ class EnterSplitScreenTest(
|
||||
TEST_REPETITIONS
|
||||
}
|
||||
transitions {
|
||||
secondaryApp.open()
|
||||
uiDevice.pressHome()
|
||||
splitScreenApp.open()
|
||||
uiDevice.pressHome()
|
||||
secondaryApp.launchViaIntent()
|
||||
splitScreenApp.launchViaIntent()
|
||||
uiDevice.launchSplitScreen()
|
||||
splitScreenApp.reopenAppFromOverview()
|
||||
}
|
||||
@@ -150,6 +158,98 @@ class EnterSplitScreenTest(
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testNonResizeableNotDocked() {
|
||||
val testTag = "testNonResizeableNotDocked"
|
||||
runWithFlicker(splitScreenSetup) {
|
||||
withTestName { testTag }
|
||||
repeat {
|
||||
TEST_REPETITIONS
|
||||
}
|
||||
transitions {
|
||||
nonResizeableApp.launchViaIntent()
|
||||
uiDevice.openQuickstep()
|
||||
if (uiDevice.canSplitScreen()) {
|
||||
Assert.fail("Non-resizeable app should not enter split screen")
|
||||
}
|
||||
}
|
||||
assertions {
|
||||
layersTrace {
|
||||
dockedStackDividerIsInvisible()
|
||||
}
|
||||
windowManagerTrace {
|
||||
end {
|
||||
hidesAppWindow(nonResizeableApp.defaultWindowName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testNonResizeableWhenAlreadyInSplitScreenPrimary() {
|
||||
val testTag = "testNonResizeableWhenAlreadyInSplitScreenPrimary"
|
||||
runWithFlicker(splitScreenSetup) {
|
||||
withTestName { testTag }
|
||||
repeat {
|
||||
TEST_REPETITIONS
|
||||
}
|
||||
transitions {
|
||||
nonResizeableApp.launchViaIntent()
|
||||
splitScreenApp.launchViaIntent()
|
||||
uiDevice.launchSplitScreen()
|
||||
nonResizeableApp.reopenAppFromOverview()
|
||||
}
|
||||
assertions {
|
||||
layersTrace {
|
||||
dockedStackDividerIsInvisible()
|
||||
end("appsEndingBounds", enabled = false) {
|
||||
val displayBounds = WindowUtils.getDisplayBounds(rotation)
|
||||
this.hasVisibleRegion(nonResizeableApp.defaultWindowName, displayBounds)
|
||||
}
|
||||
}
|
||||
windowManagerTrace {
|
||||
end {
|
||||
showsAppWindow(nonResizeableApp.defaultWindowName)
|
||||
hidesAppWindow(splitScreenApp.defaultWindowName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testNonResizeableWhenAlreadyInSplitScreenSecondary() {
|
||||
val testTag = "testNonResizeableWhenAlreadyInSplitScreenSecondary"
|
||||
runWithFlicker(splitScreenSetup) {
|
||||
withTestName { testTag }
|
||||
repeat {
|
||||
TEST_REPETITIONS
|
||||
}
|
||||
transitions {
|
||||
splitScreenApp.launchViaIntent()
|
||||
uiDevice.launchSplitScreen()
|
||||
uiDevice.pressBack()
|
||||
nonResizeableApp.launchViaIntent()
|
||||
}
|
||||
assertions {
|
||||
layersTrace {
|
||||
dockedStackDividerIsInvisible()
|
||||
end("appsEndingBounds", enabled = false) {
|
||||
val displayBounds = WindowUtils.getDisplayBounds(rotation)
|
||||
this.hasVisibleRegion(nonResizeableApp.defaultWindowName, displayBounds)
|
||||
}
|
||||
}
|
||||
windowManagerTrace {
|
||||
end {
|
||||
showsAppWindow(nonResizeableApp.defaultWindowName)
|
||||
hidesAppWindow(splitScreenApp.defaultWindowName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.wm.shell.flicker.splitscreen
|
||||
|
||||
import com.android.wm.shell.flicker.NonRotationTestBase
|
||||
import com.android.wm.shell.flicker.TEST_APP_NONRESIZEABLE_LABEL
|
||||
import com.android.wm.shell.flicker.TEST_APP_SPLITSCREEN_PRIMARY_LABEL
|
||||
import com.android.wm.shell.flicker.TEST_APP_SPLITSCREEN_SECONDARY_LABEL
|
||||
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
|
||||
@@ -32,4 +33,7 @@ abstract class SplitScreenTestBase(
|
||||
protected val secondaryApp = SplitScreenHelper(instrumentation,
|
||||
TEST_APP_SPLITSCREEN_SECONDARY_LABEL,
|
||||
Components.SplitScreenSecondaryActivity())
|
||||
protected val nonResizeableApp = SplitScreenHelper(instrumentation,
|
||||
TEST_APP_NONRESIZEABLE_LABEL,
|
||||
Components.NonResizeableActivity())
|
||||
}
|
||||
|
||||
@@ -86,6 +86,17 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name=".NonResizeableActivity"
|
||||
android:resizeableActivity="false"
|
||||
android:taskAffinity="com.android.wm.shell.flicker.testapp.NonResizeableActivity"
|
||||
android:label="NonResizeableApp"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name=".SimpleActivity"
|
||||
android:taskAffinity="com.android.wm.shell.flicker.testapp.SimpleActivity"
|
||||
android:label="SimpleApp"
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 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.
|
||||
-->
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@android:color/holo_orange_light">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/NonResizeableTest"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
android:text="NonResizeableActivity"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -38,6 +38,13 @@ public class Components {
|
||||
}
|
||||
}
|
||||
|
||||
public static class NonResizeableActivity extends ComponentsInfo {
|
||||
@Override
|
||||
public String getActivityName() {
|
||||
return NonResizeableActivity.class.getSimpleName();
|
||||
}
|
||||
}
|
||||
|
||||
public static class PipActivity extends ComponentsInfo {
|
||||
// Intent action that this activity dynamically registers to enter picture-in-picture
|
||||
public static final String ACTION_ENTER_PIP = PACKAGE_NAME + ".PipActivity.ENTER_PIP";
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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.testapp;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class NonResizeableActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
setContentView(R.layout.activity_non_resizeable);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user