Merge changes from topic "flicker-rotation" am: f2a739d5f0

am: 7b5f4f1261

Change-Id: I8684b0a2b1fbe2611acc02766903afa4086968da
This commit is contained in:
Nataniel Borges
2019-09-27 09:34:37 -07:00
committed by android-build-merger
3 changed files with 32 additions and 38 deletions

View File

@@ -209,15 +209,17 @@ class CommonTransitions {
.repeat(ITERATIONS);
}
static TransitionBuilder resizeSplitScreen(IAppHelper testAppTop, IAppHelper testAppBottom,
UiDevice device, Rational startRatio, Rational stopRatio) {
static TransitionBuilder resizeSplitScreen(IAppHelper testAppTop, ImeAppHelper testAppBottom,
UiDevice device, int beginRotation, Rational startRatio, Rational stopRatio) {
String testTag = "resizeSplitScreen_" + testAppTop.getLauncherName() + "_"
+ testAppBottom.getLauncherName() + "_"
+ startRatio.toString().replace("/", ":") + "_to_"
+ stopRatio.toString().replace("/", ":");
+ stopRatio.toString().replace("/", ":") + "_"
+ rotationToString(beginRotation);
return TransitionRunner.newBuilder()
.withTag(testTag)
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
.runBeforeAll(() -> setRotation(device, beginRotation))
.runBeforeAll(() -> clearRecents(device))
.runBefore(testAppBottom::open)
.runBefore(device::pressHome)
@@ -229,6 +231,7 @@ class CommonTransitions {
By.res(device.getLauncherPackageName(), "snapshot"));
snapshot.click();
})
.runBefore(() -> testAppBottom.clickEditTextWidget(device))
.runBefore(() -> AutomationUtils.resizeSplitScreen(device, startRatio))
.run(() -> AutomationUtils.resizeSplitScreen(device, stopRatio))
.runAfter(() -> exitSplitScreen(device))

View File

@@ -113,10 +113,10 @@ public class DebugTest {
*/
@Test
public void resizeSplitScreen() {
IAppHelper bottomApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
"com.android.server.wm.flicker.testapp", "ImeApp");
CommonTransitions.resizeSplitScreen(testApp, bottomApp, uiDevice, new Rational(1, 3),
new Rational(2, 3)).includeJankyRuns().recordEachRun().build().run();
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();
}
// IME tests

View File

@@ -24,13 +24,13 @@ import static com.android.server.wm.flicker.WindowUtils.getNavigationBarHeight;
import static com.google.common.truth.Truth.assertThat;
import android.graphics.Rect;
import android.platform.helpers.IAppHelper;
import android.util.Rational;
import androidx.test.InstrumentationRegistry;
import androidx.test.filters.FlakyTest;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import com.android.server.wm.flicker.helpers.ImeAppHelper;
import org.junit.Before;
import org.junit.FixMethodOrder;
@@ -38,57 +38,48 @@ import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.junit.runners.Parameterized;
/**
* Test split screen resizing window transitions.
* To run this test: {@code atest FlickerTests:ResizeSplitScreenTest}
*/
@LargeTest
@RunWith(AndroidJUnit4.class)
@RunWith(Parameterized.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@FlakyTest(bugId = 140856143)
@FlakyTest(bugId = 140854698)
@Ignore("Waiting bug feedback")
public class ResizeSplitScreenTest extends FlickerTestBase {
public class ResizeSplitScreenTest extends NonRotationTestBase {
private static String sSimpleActivity = "SimpleActivity";
private static String sImeActivity = "ImeActivity";
public ResizeSplitScreenTest(String beginRotationName, int beginRotation) {
super(beginRotationName, beginRotation);
public ResizeSplitScreenTest() {
this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
"com.android.server.wm.flicker.testapp", "SimpleApp");
}
@Before
public void runTransition() {
IAppHelper bottomApp = new StandardAppHelper(InstrumentationRegistry
.getInstrumentation(),
"com.android.server.wm.flicker.testapp", "ImeApp");
super.runTransition(resizeSplitScreen(mTestApp, bottomApp, mUiDevice, new Rational(1, 3),
new Rational(2, 3)).includeJankyRuns().build());
}
@Test
public void checkVisibility_navBarLayerIsAlwaysVisible() {
checkResults(result -> LayersTraceSubject.assertThat(result)
.showsLayer(NAVIGATION_BAR_WINDOW_TITLE)
.forAllEntries());
}
@Test
public void checkVisibility_statusBarLayerIsAlwaysVisible() {
checkResults(result -> LayersTraceSubject.assertThat(result)
.showsLayer(STATUS_BAR_WINDOW_TITLE)
.forAllEntries());
ImeAppHelper bottomApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
run(resizeSplitScreen(mTestApp, bottomApp, mUiDevice, mBeginRotation,
new Rational(1, 3), new Rational(2, 3))
.includeJankyRuns().build());
}
@Test
public void checkVisibility_topAppLayerIsAlwaysVisible() {
checkResults(result -> LayersTraceSubject.assertThat(result)
.showsLayer("SimpleActivity")
.showsLayer(sSimpleActivity)
.forAllEntries());
}
@Test
public void checkVisibility_bottomAppLayerIsAlwaysVisible() {
checkResults(result -> LayersTraceSubject.assertThat(result)
.showsLayer("ImeActivity")
.showsLayer(sImeActivity)
.forAllEntries());
}
@@ -149,11 +140,11 @@ public class ResizeSplitScreenTest extends FlickerTestBase {
displayBounds.bottom - getNavigationBarHeight());
LayersTraceSubject.assertThat(result)
.hasVisibleRegion("SimpleActivity", startingTopAppBounds)
.hasVisibleRegion(sSimpleActivity, startingTopAppBounds)
.atTheEnd();
LayersTraceSubject.assertThat(result)
.hasVisibleRegion("ImeActivity", startingBottomAppBounds)
.hasVisibleRegion(sImeActivity, startingBottomAppBounds)
.atTheEnd();
});
}
@@ -175,14 +166,14 @@ public class ResizeSplitScreenTest extends FlickerTestBase {
@Test
public void checkVisibility_topAppWindowIsAlwaysVisible() {
checkResults(result -> WmTraceSubject.assertThat(result)
.showsAppWindow("SimpleActivity")
.showsAppWindow(sSimpleActivity)
.forAllEntries());
}
@Test
public void checkVisibility_bottomAppWindowIsAlwaysVisible() {
checkResults(result -> WmTraceSubject.assertThat(result)
.showsAppWindow("ImeActivity")
.showsAppWindow(sImeActivity)
.forAllEntries());
}