New FlickerTests: Create initial flicker tests for Pip am: 992a155b61
Change-Id: I50d0d2294e297d062e4384b342e8577c66e62f02
This commit is contained in:
@@ -9,6 +9,14 @@
|
|||||||
<option name="screen-always-on" value="on" />
|
<option name="screen-always-on" value="on" />
|
||||||
<!-- prevents the phone from restarting -->
|
<!-- prevents the phone from restarting -->
|
||||||
<option name="force-skip-system-props" value="true" />
|
<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>
|
||||||
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
|
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
|
||||||
<option name="cleanup-apks" value="true"/>
|
<option name="cleanup-apks" value="true"/>
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import static android.os.SystemClock.sleep;
|
|||||||
import static android.view.Surface.rotationToString;
|
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.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.exitSplitScreen;
|
||||||
import static com.android.server.wm.flicker.helpers.AutomationUtils.expandPipWindow;
|
import static com.android.server.wm.flicker.helpers.AutomationUtils.expandPipWindow;
|
||||||
import static com.android.server.wm.flicker.helpers.AutomationUtils.launchSplitScreen;
|
import static com.android.server.wm.flicker.helpers.AutomationUtils.launchSplitScreen;
|
||||||
@@ -285,41 +284,52 @@ class CommonTransitions {
|
|||||||
.repeat(ITERATIONS);
|
.repeat(ITERATIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static TransitionBuilder enterPipMode(PipAppHelper testApp, UiDevice device) {
|
static TransitionBuilder enterPipMode(PipAppHelper testApp, UiDevice device,
|
||||||
|
int beginRotation) {
|
||||||
return TransitionRunner.newBuilder()
|
return TransitionRunner.newBuilder()
|
||||||
.withTag("enterPipMode_" + testApp.getLauncherName())
|
.withTag("enterPipMode_" + testApp.getLauncherName()
|
||||||
|
+ rotationToString(beginRotation))
|
||||||
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
|
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
|
||||||
.runBefore(device::pressHome)
|
.runBefore(device::pressHome)
|
||||||
|
.runBefore(() -> setRotation(device, beginRotation))
|
||||||
.runBefore(testApp::open)
|
.runBefore(testApp::open)
|
||||||
.run(() -> testApp.clickEnterPipButton(device))
|
.run(() -> testApp.clickEnterPipButton(device))
|
||||||
.runAfter(() -> closePipWindow(device))
|
.runAfter(() -> testApp.closePipWindow(device))
|
||||||
.runAfterAll(testApp::exit)
|
.runAfterAll(testApp::exit)
|
||||||
.repeat(ITERATIONS);
|
.repeat(ITERATIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static TransitionBuilder exitPipModeToHome(PipAppHelper testApp, UiDevice device) {
|
static TransitionBuilder exitPipModeToHome(PipAppHelper testApp, UiDevice device,
|
||||||
|
int beginRotation) {
|
||||||
return TransitionRunner.newBuilder()
|
return TransitionRunner.newBuilder()
|
||||||
.withTag("exitPipModeToHome_" + testApp.getLauncherName())
|
.withTag("exitPipModeToHome_" + testApp.getLauncherName()
|
||||||
|
+ rotationToString(beginRotation))
|
||||||
|
.recordAllRuns()
|
||||||
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
|
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
|
||||||
.runBefore(device::pressHome)
|
.runBefore(device::pressHome)
|
||||||
|
.runBefore(() -> setRotation(device, beginRotation))
|
||||||
.runBefore(testApp::open)
|
.runBefore(testApp::open)
|
||||||
.runBefore(() -> testApp.clickEnterPipButton(device))
|
.run(() -> testApp.clickEnterPipButton(device))
|
||||||
.run(() -> closePipWindow(device))
|
.run(() -> testApp.closePipWindow(device))
|
||||||
.run(device::waitForIdle)
|
.run(device::waitForIdle)
|
||||||
.runAfterAll(testApp::exit)
|
.run(testApp::exit)
|
||||||
.repeat(ITERATIONS);
|
.repeat(ITERATIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static TransitionBuilder exitPipModeToApp(PipAppHelper testApp, UiDevice device) {
|
static TransitionBuilder exitPipModeToApp(PipAppHelper testApp, UiDevice device,
|
||||||
|
int beginRotation) {
|
||||||
return TransitionRunner.newBuilder()
|
return TransitionRunner.newBuilder()
|
||||||
.withTag("exitPipModeToApp_" + testApp.getLauncherName())
|
.withTag("exitPipModeToApp_" + testApp.getLauncherName()
|
||||||
|
+ rotationToString(beginRotation))
|
||||||
|
.recordAllRuns()
|
||||||
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
|
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
|
||||||
.runBefore(device::pressHome)
|
.run(device::pressHome)
|
||||||
.runBefore(testApp::open)
|
.run(() -> setRotation(device, beginRotation))
|
||||||
.runBefore(() -> testApp.clickEnterPipButton(device))
|
.run(testApp::open)
|
||||||
|
.run(() -> testApp.clickEnterPipButton(device))
|
||||||
.run(() -> expandPipWindow(device))
|
.run(() -> expandPipWindow(device))
|
||||||
.run(device::waitForIdle)
|
.run(device::waitForIdle)
|
||||||
.runAfterAll(testApp::exit)
|
.run(testApp::exit)
|
||||||
.repeat(ITERATIONS);
|
.repeat(ITERATIONS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public class DebugTest {
|
|||||||
ImeAppHelper bottomApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
|
ImeAppHelper bottomApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
|
||||||
CommonTransitions.resizeSplitScreen(testApp, bottomApp, uiDevice, Surface.ROTATION_0,
|
CommonTransitions.resizeSplitScreen(testApp, bottomApp, uiDevice, Surface.ROTATION_0,
|
||||||
new Rational(1, 3), new Rational(2, 3))
|
new Rational(1, 3), new Rational(2, 3))
|
||||||
.includeJankyRuns().recordEachRun().build().run();
|
.includeJankyRuns().build().run();
|
||||||
}
|
}
|
||||||
|
|
||||||
// IME tests
|
// IME tests
|
||||||
@@ -128,7 +128,7 @@ public class DebugTest {
|
|||||||
public void editTextSetFocus() {
|
public void editTextSetFocus() {
|
||||||
ImeAppHelper testApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
|
ImeAppHelper testApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
|
||||||
CommonTransitions.editTextSetFocus(testApp, uiDevice, Surface.ROTATION_0)
|
CommonTransitions.editTextSetFocus(testApp, uiDevice, Surface.ROTATION_0)
|
||||||
.includeJankyRuns().recordEachRun()
|
.includeJankyRuns()
|
||||||
.build().run();
|
.build().run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@ public class DebugTest {
|
|||||||
public void editTextLoseFocusToHome() {
|
public void editTextLoseFocusToHome() {
|
||||||
ImeAppHelper testApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
|
ImeAppHelper testApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
|
||||||
CommonTransitions.editTextLoseFocusToHome(testApp, uiDevice, Surface.ROTATION_0)
|
CommonTransitions.editTextLoseFocusToHome(testApp, uiDevice, Surface.ROTATION_0)
|
||||||
.includeJankyRuns().recordEachRun()
|
.includeJankyRuns()
|
||||||
.build().run();
|
.build().run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,7 +150,7 @@ public class DebugTest {
|
|||||||
public void editTextLoseFocusToApp() {
|
public void editTextLoseFocusToApp() {
|
||||||
ImeAppHelper testApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
|
ImeAppHelper testApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
|
||||||
CommonTransitions.editTextLoseFocusToHome(testApp, uiDevice, Surface.ROTATION_0)
|
CommonTransitions.editTextLoseFocusToHome(testApp, uiDevice, Surface.ROTATION_0)
|
||||||
.includeJankyRuns().recordEachRun()
|
.includeJankyRuns()
|
||||||
.build().run();
|
.build().run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ public class DebugTest {
|
|||||||
@Test
|
@Test
|
||||||
public void enterPipMode() {
|
public void enterPipMode() {
|
||||||
PipAppHelper testApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation());
|
PipAppHelper testApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation());
|
||||||
CommonTransitions.enterPipMode(testApp, uiDevice).includeJankyRuns().recordEachRun()
|
CommonTransitions.enterPipMode(testApp, uiDevice, Surface.ROTATION_0).includeJankyRuns()
|
||||||
.build().run();
|
.build().run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,7 +172,8 @@ public class DebugTest {
|
|||||||
@Test
|
@Test
|
||||||
public void exitPipModeToHome() {
|
public void exitPipModeToHome() {
|
||||||
PipAppHelper testApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation());
|
PipAppHelper testApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation());
|
||||||
CommonTransitions.exitPipModeToHome(testApp, uiDevice).includeJankyRuns().recordEachRun()
|
CommonTransitions.exitPipModeToHome(testApp, uiDevice, Surface.ROTATION_0)
|
||||||
|
.includeJankyRuns()
|
||||||
.build().run();
|
.build().run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,7 +183,7 @@ public class DebugTest {
|
|||||||
@Test
|
@Test
|
||||||
public void exitPipModeToApp() {
|
public void exitPipModeToApp() {
|
||||||
PipAppHelper testApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation());
|
PipAppHelper testApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation());
|
||||||
CommonTransitions.exitPipModeToApp(testApp, uiDevice).includeJankyRuns().recordEachRun()
|
CommonTransitions.exitPipModeToApp(testApp, uiDevice, Surface.ROTATION_0).includeJankyRuns()
|
||||||
.build().run();
|
.build().run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,4 +40,8 @@ public class PipAppHelper extends FlickerAppHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void closePipWindow(UiDevice device) {
|
||||||
|
AutomationUtils.closePipWindow(device);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user