summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/FlickerTests/AndroidTest.xml8
-rw-r--r--tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java40
-rw-r--r--tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java15
-rw-r--r--tests/FlickerTests/src/com/android/server/wm/flicker/PipToAppTest.java89
-rw-r--r--tests/FlickerTests/src/com/android/server/wm/flicker/PipToHomeTest.java93
-rw-r--r--tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.java4
6 files changed, 227 insertions, 22 deletions
diff --git a/tests/FlickerTests/AndroidTest.xml b/tests/FlickerTests/AndroidTest.xml
index d1da47f0f9d8..a331ec5b52bd 100644
--- a/tests/FlickerTests/AndroidTest.xml
+++ b/tests/FlickerTests/AndroidTest.xml
@@ -9,6 +9,14 @@
<option name="screen-always-on" value="on" />
<!-- prevents the phone from restarting -->
<option name="force-skip-system-props" value="true" />
+ <!-- set WM tracing verbose level to all -->
+ <option name="run-command" value="adb shell cmd window tracing level all" />
+ <!-- inform WM to log all transactions -->
+ <option name="run-command" value="adb shell cmd window tracing transaction" />
+ </target_preparer>
+ <target_preparer class="com.android.tradefed.targetprep.DeviceCleaner">
+ <!-- keeps the screen on during tests -->
+ <option name="cleanup-action" value="REBOOT" />
</target_preparer>
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true"/>
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java
index e033d0ab9578..a9228a239a25 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java
@@ -20,7 +20,6 @@ import static android.os.SystemClock.sleep;
import static android.view.Surface.rotationToString;
import static com.android.server.wm.flicker.helpers.AutomationUtils.clearRecents;
-import static com.android.server.wm.flicker.helpers.AutomationUtils.closePipWindow;
import static com.android.server.wm.flicker.helpers.AutomationUtils.exitSplitScreen;
import static com.android.server.wm.flicker.helpers.AutomationUtils.expandPipWindow;
import static com.android.server.wm.flicker.helpers.AutomationUtils.launchSplitScreen;
@@ -285,41 +284,52 @@ class CommonTransitions {
.repeat(ITERATIONS);
}
- static TransitionBuilder enterPipMode(PipAppHelper testApp, UiDevice device) {
+ static TransitionBuilder enterPipMode(PipAppHelper testApp, UiDevice device,
+ int beginRotation) {
return TransitionRunner.newBuilder()
- .withTag("enterPipMode_" + testApp.getLauncherName())
+ .withTag("enterPipMode_" + testApp.getLauncherName()
+ + rotationToString(beginRotation))
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
.runBefore(device::pressHome)
+ .runBefore(() -> setRotation(device, beginRotation))
.runBefore(testApp::open)
.run(() -> testApp.clickEnterPipButton(device))
- .runAfter(() -> closePipWindow(device))
+ .runAfter(() -> testApp.closePipWindow(device))
.runAfterAll(testApp::exit)
.repeat(ITERATIONS);
}
- static TransitionBuilder exitPipModeToHome(PipAppHelper testApp, UiDevice device) {
+ static TransitionBuilder exitPipModeToHome(PipAppHelper testApp, UiDevice device,
+ int beginRotation) {
return TransitionRunner.newBuilder()
- .withTag("exitPipModeToHome_" + testApp.getLauncherName())
+ .withTag("exitPipModeToHome_" + testApp.getLauncherName()
+ + rotationToString(beginRotation))
+ .recordAllRuns()
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
.runBefore(device::pressHome)
+ .runBefore(() -> setRotation(device, beginRotation))
.runBefore(testApp::open)
- .runBefore(() -> testApp.clickEnterPipButton(device))
- .run(() -> closePipWindow(device))
+ .run(() -> testApp.clickEnterPipButton(device))
+ .run(() -> testApp.closePipWindow(device))
.run(device::waitForIdle)
- .runAfterAll(testApp::exit)
+ .run(testApp::exit)
.repeat(ITERATIONS);
}
- static TransitionBuilder exitPipModeToApp(PipAppHelper testApp, UiDevice device) {
+ static TransitionBuilder exitPipModeToApp(PipAppHelper testApp, UiDevice device,
+ int beginRotation) {
return TransitionRunner.newBuilder()
- .withTag("exitPipModeToApp_" + testApp.getLauncherName())
+ .withTag("exitPipModeToApp_" + testApp.getLauncherName()
+ + rotationToString(beginRotation))
+ .recordAllRuns()
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
- .runBefore(device::pressHome)
- .runBefore(testApp::open)
- .runBefore(() -> testApp.clickEnterPipButton(device))
+ .run(device::pressHome)
+ .run(() -> setRotation(device, beginRotation))
+ .run(testApp::open)
+ .run(() -> testApp.clickEnterPipButton(device))
.run(() -> expandPipWindow(device))
.run(device::waitForIdle)
- .runAfterAll(testApp::exit)
+ .run(testApp::exit)
.repeat(ITERATIONS);
}
}
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java
index 8f0177c7afc5..bf67e9db9955 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java
@@ -116,7 +116,7 @@ public class DebugTest {
ImeAppHelper bottomApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
CommonTransitions.resizeSplitScreen(testApp, bottomApp, uiDevice, Surface.ROTATION_0,
new Rational(1, 3), new Rational(2, 3))
- .includeJankyRuns().recordEachRun().build().run();
+ .includeJankyRuns().build().run();
}
// IME tests
@@ -128,7 +128,7 @@ public class DebugTest {
public void editTextSetFocus() {
ImeAppHelper testApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
CommonTransitions.editTextSetFocus(testApp, uiDevice, Surface.ROTATION_0)
- .includeJankyRuns().recordEachRun()
+ .includeJankyRuns()
.build().run();
}
@@ -139,7 +139,7 @@ public class DebugTest {
public void editTextLoseFocusToHome() {
ImeAppHelper testApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
CommonTransitions.editTextLoseFocusToHome(testApp, uiDevice, Surface.ROTATION_0)
- .includeJankyRuns().recordEachRun()
+ .includeJankyRuns()
.build().run();
}
@@ -150,7 +150,7 @@ public class DebugTest {
public void editTextLoseFocusToApp() {
ImeAppHelper testApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
CommonTransitions.editTextLoseFocusToHome(testApp, uiDevice, Surface.ROTATION_0)
- .includeJankyRuns().recordEachRun()
+ .includeJankyRuns()
.build().run();
}
@@ -162,7 +162,7 @@ public class DebugTest {
@Test
public void enterPipMode() {
PipAppHelper testApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation());
- CommonTransitions.enterPipMode(testApp, uiDevice).includeJankyRuns().recordEachRun()
+ CommonTransitions.enterPipMode(testApp, uiDevice, Surface.ROTATION_0).includeJankyRuns()
.build().run();
}
@@ -172,7 +172,8 @@ public class DebugTest {
@Test
public void exitPipModeToHome() {
PipAppHelper testApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation());
- CommonTransitions.exitPipModeToHome(testApp, uiDevice).includeJankyRuns().recordEachRun()
+ CommonTransitions.exitPipModeToHome(testApp, uiDevice, Surface.ROTATION_0)
+ .includeJankyRuns()
.build().run();
}
@@ -182,7 +183,7 @@ public class DebugTest {
@Test
public void exitPipModeToApp() {
PipAppHelper testApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation());
- CommonTransitions.exitPipModeToApp(testApp, uiDevice).includeJankyRuns().recordEachRun()
+ CommonTransitions.exitPipModeToApp(testApp, uiDevice, Surface.ROTATION_0).includeJankyRuns()
.build().run();
}
}
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/PipToAppTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/PipToAppTest.java
new file mode 100644
index 000000000000..85706bd14c5e
--- /dev/null
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/PipToAppTest.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2019 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.server.wm.flicker;
+
+import static com.android.server.wm.flicker.CommonTransitions.exitPipModeToApp;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+
+import com.android.server.wm.flicker.helpers.PipAppHelper;
+
+import org.junit.Before;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.MethodSorters;
+import org.junit.runners.Parameterized;
+
+/**
+ * Test Pip launch.
+ * To run this test: {@code atest FlickerTests:PipToAppTest}
+ */
+@LargeTest
+@RunWith(Parameterized.class)
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class PipToAppTest extends NonRotationTestBase {
+
+ static final String sPipWindowTitle = "PipMenuActivity";
+
+ public PipToAppTest(String beginRotationName, int beginRotation) {
+ super(beginRotationName, beginRotation);
+
+ this.mTestApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation());
+ }
+
+ @Before
+ public void runTransition() {
+ run(exitPipModeToApp((PipAppHelper) mTestApp, mUiDevice, mBeginRotation)
+ .includeJankyRuns().build());
+ }
+
+ @Test
+ public void checkVisibility_pipWindowBecomesVisible() {
+ checkResults(result -> WmTraceSubject.assertThat(result)
+ .skipUntilFirstAssertion()
+ .showsAppWindowOnTop(sPipWindowTitle)
+ .then()
+ .hidesAppWindow(sPipWindowTitle)
+ .forAllEntries());
+ }
+
+ @Test
+ public void checkVisibility_pipLayerBecomesVisible() {
+ checkResults(result -> LayersTraceSubject.assertThat(result)
+ .skipUntilFirstAssertion()
+ .showsLayer(sPipWindowTitle)
+ .then()
+ .hidesLayer(sPipWindowTitle)
+ .forAllEntries());
+ }
+
+ @Test
+ public void checkVisibility_backgroundWindowVisibleBehindPipLayer() {
+ checkResults(result -> WmTraceSubject.assertThat(result)
+ .skipUntilFirstAssertion()
+ .showsAppWindowOnTop(sPipWindowTitle)
+ .then()
+ .showsBelowAppWindow("Wallpaper")
+ .then()
+ .showsAppWindowOnTop(mTestApp.getPackage())
+ .then()
+ .hidesAppWindowOnTop(mTestApp.getPackage())
+ .forAllEntries());
+ }
+}
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/PipToHomeTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/PipToHomeTest.java
new file mode 100644
index 000000000000..ef856dc52167
--- /dev/null
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/PipToHomeTest.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2019 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.server.wm.flicker;
+
+import static com.android.server.wm.flicker.CommonTransitions.exitPipModeToHome;
+
+import android.view.Surface;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.server.wm.flicker.helpers.PipAppHelper;
+
+import org.junit.Before;
+import org.junit.FixMethodOrder;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.MethodSorters;
+
+/**
+ * Test Pip launch.
+ * To run this test: {@code atest FlickerTests:PipToHomeTest}
+ */
+@LargeTest
+@RunWith(AndroidJUnit4.class)
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class PipToHomeTest extends FlickerTestBase {
+
+ static final String sPipWindowTitle = "PipActivity";
+
+ // public PipToHomeTest(String beginRotationName, int beginRotation) {
+ public PipToHomeTest() {
+ // super(beginRotationName, beginRotation);
+
+ this.mTestApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation());
+ }
+
+ @Before
+ public void runTransition() {
+ // run(exitPipModeToHome((PipAppHelper) mTestApp, mUiDevice, mBeginRotation)
+ run(exitPipModeToHome((PipAppHelper) mTestApp, mUiDevice, Surface.ROTATION_0)
+ .includeJankyRuns().build());
+ }
+
+ @Ignore
+ @Test
+ public void checkVisibility_pipWindowBecomesVisible() {
+ checkResults(result -> WmTraceSubject.assertThat(result)
+ .skipUntilFirstAssertion()
+ .showsAppWindowOnTop(sPipWindowTitle)
+ .then()
+ .hidesAppWindow(sPipWindowTitle)
+ .forAllEntries());
+ }
+
+ @Test
+ public void checkVisibility_pipLayerBecomesVisible() {
+ checkResults(result -> LayersTraceSubject.assertThat(result)
+ .skipUntilFirstAssertion()
+ .showsLayer(sPipWindowTitle)
+ .then()
+ .hidesLayer(sPipWindowTitle)
+ .forAllEntries());
+ }
+
+ @Ignore
+ @Test
+ public void checkVisibility_backgroundWindowVisibleBehindPipLayer() {
+ checkResults(result -> WmTraceSubject.assertThat(result)
+ .showsAppWindowOnTop(sPipWindowTitle)
+ .then()
+ .showsBelowAppWindow("Wallpaper")
+ .then()
+ .showsAppWindowOnTop("Wallpaper")
+ .forAllEntries());
+ }
+}
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.java b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.java
index d00e11b2994d..d5f9a2062a17 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.java
@@ -40,4 +40,8 @@ public class PipAppHelper extends FlickerAppHelper {
}
}
+ public void closePipWindow(UiDevice device) {
+ AutomationUtils.closePipWindow(device);
+ }
+
}