Merge changes from topic "flicker-rotation"
* changes: New FlickerTests: Run split screen tests at 0 and 90 degrees New FlickerTests: Start app warm and cold at both 0 and 90 degrees New FlickerTests: Start IME alongside the app (0 and 90 degrees) New FlickerTests: Start IME tests with app rotated by 90 degrees
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* 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.editTextLoseFocusToApp;
|
||||
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
import androidx.test.filters.FlakyTest;
|
||||
import androidx.test.filters.LargeTest;
|
||||
|
||||
import com.android.server.wm.flicker.helpers.ImeAppAutoFocusHelper;
|
||||
|
||||
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;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
/**
|
||||
* Test IME window closing back to app window transitions.
|
||||
* To run this test: {@code atest FlickerTests:CloseImeWindowToAppTest}
|
||||
*/
|
||||
@LargeTest
|
||||
@RunWith(Parameterized.class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class CloseImeAutoOpenWindowToAppTest extends CloseImeWindowToAppTest {
|
||||
|
||||
public CloseImeAutoOpenWindowToAppTest(String beginRotationName, int beginRotation) {
|
||||
super(beginRotationName, beginRotation);
|
||||
|
||||
mTestApp = new ImeAppAutoFocusHelper(InstrumentationRegistry.getInstrumentation());
|
||||
}
|
||||
|
||||
@Before
|
||||
public void runTransition() {
|
||||
run(editTextLoseFocusToApp((ImeAppAutoFocusHelper) mTestApp, mUiDevice, mBeginRotation)
|
||||
.includeJankyRuns().build());
|
||||
}
|
||||
|
||||
@FlakyTest(bugId = 141458352)
|
||||
@Ignore("Waiting bug feedback")
|
||||
@Test
|
||||
public void checkVisibility_imeLayerBecomesInvisible() {
|
||||
super.checkVisibility_imeLayerBecomesInvisible();
|
||||
}
|
||||
|
||||
@FlakyTest(bugId = 141458352)
|
||||
@Ignore("Waiting bug feedback")
|
||||
@Test
|
||||
public void checkVisibility_imeAppLayerIsAlwaysVisible() {
|
||||
super.checkVisibility_imeAppLayerIsAlwaysVisible();
|
||||
}
|
||||
|
||||
@FlakyTest(bugId = 141458352)
|
||||
@Ignore("Waiting bug feedback")
|
||||
@Test
|
||||
public void checkVisibility_imeAppWindowIsAlwaysVisible() {
|
||||
super.checkVisibility_imeAppWindowIsAlwaysVisible();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* 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.editTextLoseFocusToHome;
|
||||
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
import androidx.test.filters.FlakyTest;
|
||||
import androidx.test.filters.LargeTest;
|
||||
|
||||
import com.android.server.wm.flicker.helpers.ImeAppAutoFocusHelper;
|
||||
|
||||
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;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
/**
|
||||
* Test IME window closing back to app window transitions.
|
||||
* To run this test: {@code atest FlickerTests:CloseImeWindowToAppTest}
|
||||
*/
|
||||
@LargeTest
|
||||
@RunWith(Parameterized.class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class CloseImeAutoOpenWindowToHomeTest extends CloseImeWindowToHomeTest {
|
||||
|
||||
public CloseImeAutoOpenWindowToHomeTest(String beginRotationName, int beginRotation) {
|
||||
super(beginRotationName, beginRotation);
|
||||
|
||||
mTestApp = new ImeAppAutoFocusHelper(InstrumentationRegistry.getInstrumentation());
|
||||
}
|
||||
|
||||
@Before
|
||||
public void runTransition() {
|
||||
run(editTextLoseFocusToHome((ImeAppAutoFocusHelper) mTestApp, mUiDevice, mBeginRotation)
|
||||
.includeJankyRuns().build());
|
||||
}
|
||||
|
||||
@FlakyTest(bugId = 141458352)
|
||||
@Ignore("Waiting bug feedback")
|
||||
@Test
|
||||
public void checkVisibility_imeWindowBecomesInvisible() {
|
||||
super.checkVisibility_imeWindowBecomesInvisible();
|
||||
}
|
||||
|
||||
@FlakyTest(bugId = 141458352)
|
||||
@Ignore("Waiting bug feedback")
|
||||
@Test
|
||||
public void checkVisibility_imeLayerBecomesInvisible() {
|
||||
super.checkVisibility_imeLayerBecomesInvisible();
|
||||
}
|
||||
}
|
||||
@@ -17,37 +17,39 @@
|
||||
package com.android.server.wm.flicker;
|
||||
|
||||
import static com.android.server.wm.flicker.CommonTransitions.editTextLoseFocusToApp;
|
||||
import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds;
|
||||
|
||||
import android.platform.helpers.IAppHelper;
|
||||
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
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;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.MethodSorters;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
/**
|
||||
* Test IME window closing back to app window transitions.
|
||||
* To run this test: {@code atest FlickerTests:CloseImeWindowToAppTest}
|
||||
*/
|
||||
@LargeTest
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(Parameterized.class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class CloseImeWindowToAppTest extends FlickerTestBase {
|
||||
public class CloseImeWindowToAppTest extends NonRotationTestBase {
|
||||
|
||||
private static final String IME_WINDOW_TITLE = "InputMethod";
|
||||
private IAppHelper mImeTestApp = new StandardAppHelper(
|
||||
InstrumentationRegistry.getInstrumentation(),
|
||||
"com.android.server.wm.flicker.testapp", "ImeApp");
|
||||
static final String IME_WINDOW_TITLE = "InputMethod";
|
||||
|
||||
public CloseImeWindowToAppTest(String beginRotationName, int beginRotation) {
|
||||
super(beginRotationName, beginRotation);
|
||||
|
||||
mTestApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
|
||||
}
|
||||
|
||||
@Before
|
||||
public void runTransition() {
|
||||
super.runTransition(editTextLoseFocusToApp(mUiDevice)
|
||||
run(editTextLoseFocusToApp((ImeAppHelper) mTestApp, mUiDevice, mBeginRotation)
|
||||
.includeJankyRuns().build());
|
||||
}
|
||||
|
||||
@@ -63,20 +65,14 @@ public class CloseImeWindowToAppTest extends FlickerTestBase {
|
||||
@Test
|
||||
public void checkVisibility_imeAppLayerIsAlwaysVisible() {
|
||||
checkResults(result -> LayersTraceSubject.assertThat(result)
|
||||
.showsLayer(mImeTestApp.getPackage())
|
||||
.showsLayer(mTestApp.getPackage())
|
||||
.forAllEntries());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkVisibility_imeAppWindowIsAlwaysVisible() {
|
||||
checkResults(result -> WmTraceSubject.assertThat(result)
|
||||
.showsAppWindowOnTop(mImeTestApp.getPackage())
|
||||
.showsAppWindowOnTop(mTestApp.getPackage())
|
||||
.forAllEntries());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkCoveredRegion_noUncoveredRegions() {
|
||||
checkResults(result -> LayersTraceSubject.assertThat(result).coversRegion(
|
||||
getDisplayBounds()).forAllEntries());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,37 +17,39 @@
|
||||
package com.android.server.wm.flicker;
|
||||
|
||||
import static com.android.server.wm.flicker.CommonTransitions.editTextLoseFocusToHome;
|
||||
import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds;
|
||||
|
||||
import android.platform.helpers.IAppHelper;
|
||||
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
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;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.MethodSorters;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
/**
|
||||
* Test IME window closing to home transitions.
|
||||
* To run this test: {@code atest FlickerTests:CloseImeWindowToHomeTest}
|
||||
*/
|
||||
@LargeTest
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(Parameterized.class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class CloseImeWindowToHomeTest extends FlickerTestBase {
|
||||
public class CloseImeWindowToHomeTest extends NonRotationTestBase {
|
||||
|
||||
private static final String IME_WINDOW_TITLE = "InputMethod";
|
||||
private IAppHelper mImeTestApp = new StandardAppHelper(
|
||||
InstrumentationRegistry.getInstrumentation(),
|
||||
"com.android.server.wm.flicker.testapp", "ImeApp");
|
||||
static final String IME_WINDOW_TITLE = "InputMethod";
|
||||
|
||||
public CloseImeWindowToHomeTest(String beginRotationName, int beginRotation) {
|
||||
super(beginRotationName, beginRotation);
|
||||
|
||||
mTestApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
|
||||
}
|
||||
|
||||
@Before
|
||||
public void runTransition() {
|
||||
super.runTransition(editTextLoseFocusToHome(mUiDevice)
|
||||
run(editTextLoseFocusToHome((ImeAppHelper) mTestApp, mUiDevice, mBeginRotation)
|
||||
.includeJankyRuns().build());
|
||||
}
|
||||
|
||||
@@ -72,24 +74,18 @@ public class CloseImeWindowToHomeTest extends FlickerTestBase {
|
||||
@Test
|
||||
public void checkVisibility_imeAppLayerBecomesInvisible() {
|
||||
checkResults(result -> LayersTraceSubject.assertThat(result)
|
||||
.showsLayer(mImeTestApp.getPackage())
|
||||
.showsLayer(mTestApp.getPackage())
|
||||
.then()
|
||||
.hidesLayer(mImeTestApp.getPackage())
|
||||
.hidesLayer(mTestApp.getPackage())
|
||||
.forAllEntries());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkVisibility_imeAppWindowBecomesInvisible() {
|
||||
checkResults(result -> WmTraceSubject.assertThat(result)
|
||||
.showsAppWindowOnTop(mImeTestApp.getPackage())
|
||||
.showsAppWindowOnTop(mTestApp.getPackage())
|
||||
.then()
|
||||
.hidesAppWindowOnTop(mImeTestApp.getPackage())
|
||||
.hidesAppWindowOnTop(mTestApp.getPackage())
|
||||
.forAllEntries());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkCoveredRegion_noUncoveredRegions() {
|
||||
checkResults(result -> LayersTraceSubject.assertThat(result).coversRegion(
|
||||
getDisplayBounds()).forAllEntries());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,10 +37,10 @@ import android.support.test.uiautomator.Until;
|
||||
import android.util.Rational;
|
||||
import android.view.Surface;
|
||||
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
|
||||
import com.android.server.wm.flicker.TransitionRunner.TransitionBuilder;
|
||||
import com.android.server.wm.flicker.helpers.AutomationUtils;
|
||||
import com.android.server.wm.flicker.helpers.ImeAppHelper;
|
||||
import com.android.server.wm.flicker.helpers.PipAppHelper;
|
||||
|
||||
/**
|
||||
* Collection of common transitions which can be used to test different apps or scenarios.
|
||||
@@ -73,26 +73,17 @@ class CommonTransitions {
|
||||
}
|
||||
}
|
||||
|
||||
private static void clickEditTextWidget(UiDevice device, IAppHelper testApp) {
|
||||
UiObject2 editText = device.findObject(By.res(testApp.getPackage(), "plain_text_input"));
|
||||
editText.click();
|
||||
sleep(500);
|
||||
}
|
||||
|
||||
private static void clickEnterPipButton(UiDevice device, IAppHelper testApp) {
|
||||
UiObject2 enterPipButton = device.findObject(By.res(testApp.getPackage(), "enter_pip"));
|
||||
enterPipButton.click();
|
||||
sleep(500);
|
||||
}
|
||||
|
||||
static TransitionBuilder openAppWarm(IAppHelper testApp, UiDevice
|
||||
device) {
|
||||
device, int beginRotation) {
|
||||
return TransitionRunner.newBuilder()
|
||||
.withTag("OpenAppWarm_" + testApp.getLauncherName())
|
||||
.withTag("OpenAppWarm_" + testApp.getLauncherName()
|
||||
+ rotationToString(beginRotation))
|
||||
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
|
||||
.runBeforeAll(() -> setRotation(device, beginRotation))
|
||||
.runBeforeAll(testApp::open)
|
||||
.runBefore(device::pressHome)
|
||||
.runBefore(device::waitForIdle)
|
||||
.runBefore(() -> setRotation(device, beginRotation))
|
||||
.run(testApp::open)
|
||||
.runAfterAll(testApp::exit)
|
||||
.runAfterAll(AutomationUtils::setDefaultWait)
|
||||
@@ -127,16 +118,19 @@ class CommonTransitions {
|
||||
.repeat(ITERATIONS);
|
||||
}
|
||||
|
||||
static TransitionBuilder getOpenAppCold(IAppHelper testApp,
|
||||
UiDevice device) {
|
||||
static TransitionBuilder openAppCold(IAppHelper testApp,
|
||||
UiDevice device, int beginRotation) {
|
||||
return TransitionRunner.newBuilder()
|
||||
.withTag("OpenAppCold_" + testApp.getLauncherName())
|
||||
.withTag("OpenAppCold_" + testApp.getLauncherName()
|
||||
+ rotationToString(beginRotation))
|
||||
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
|
||||
.runBefore(device::pressHome)
|
||||
.runBeforeAll(() -> setRotation(device, beginRotation))
|
||||
.runBefore(testApp::exit)
|
||||
.runBefore(device::waitForIdle)
|
||||
.run(testApp::open)
|
||||
.runAfterAll(testApp::exit)
|
||||
.runAfterAll(() -> setRotation(device, Surface.ROTATION_0))
|
||||
.repeat(ITERATIONS);
|
||||
}
|
||||
|
||||
@@ -201,28 +195,31 @@ class CommonTransitions {
|
||||
.repeat(ITERATIONS);
|
||||
}
|
||||
|
||||
static TransitionBuilder editTextSetFocus(UiDevice device) {
|
||||
IAppHelper testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
|
||||
"com.android.server.wm.flicker.testapp", "ImeApp");
|
||||
static TransitionBuilder editTextSetFocus(ImeAppHelper testApp, UiDevice device,
|
||||
int beginRotation) {
|
||||
return TransitionRunner.newBuilder()
|
||||
.withTag("editTextSetFocus_" + testApp.getLauncherName())
|
||||
.withTag("editTextSetFocus_" + testApp.getLauncherName()
|
||||
+ rotationToString(beginRotation))
|
||||
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
|
||||
.runBefore(device::pressHome)
|
||||
.runBefore(() -> setRotation(device, beginRotation))
|
||||
.runBefore(testApp::open)
|
||||
.run(() -> clickEditTextWidget(device, testApp))
|
||||
.run(() -> testApp.clickEditTextWidget(device))
|
||||
.runAfterAll(testApp::exit)
|
||||
.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)
|
||||
@@ -234,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))
|
||||
@@ -243,74 +241,70 @@ class CommonTransitions {
|
||||
.repeat(ITERATIONS);
|
||||
}
|
||||
|
||||
static TransitionBuilder editTextLoseFocusToHome(UiDevice device) {
|
||||
IAppHelper testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
|
||||
"com.android.server.wm.flicker.testapp", "ImeApp");
|
||||
static TransitionBuilder editTextLoseFocusToHome(ImeAppHelper testApp, UiDevice device,
|
||||
int beginRotation) {
|
||||
return TransitionRunner.newBuilder()
|
||||
.withTag("editTextLoseFocusToHome_" + testApp.getLauncherName())
|
||||
.withTag("editTextLoseFocusToHome_" + testApp.getLauncherName()
|
||||
+ rotationToString(beginRotation))
|
||||
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
|
||||
.runBefore(device::pressHome)
|
||||
.runBefore(() -> setRotation(device, beginRotation))
|
||||
.runBefore(testApp::open)
|
||||
.runBefore(() -> clickEditTextWidget(device, testApp))
|
||||
.runBefore(() -> testApp.clickEditTextWidget(device))
|
||||
.run(device::pressHome)
|
||||
.run(device::waitForIdle)
|
||||
.runAfterAll(testApp::exit)
|
||||
.repeat(ITERATIONS);
|
||||
}
|
||||
|
||||
static TransitionBuilder editTextLoseFocusToApp(UiDevice device) {
|
||||
IAppHelper testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
|
||||
"com.android.server.wm.flicker.testapp", "ImeApp");
|
||||
static TransitionBuilder editTextLoseFocusToApp(ImeAppHelper testApp, UiDevice device,
|
||||
int beginRotation) {
|
||||
return TransitionRunner.newBuilder()
|
||||
.withTag("editTextLoseFocusToApp_" + testApp.getLauncherName())
|
||||
.withTag("editTextLoseFocusToApp_" + testApp.getLauncherName()
|
||||
+ rotationToString(beginRotation))
|
||||
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
|
||||
.runBefore(device::pressHome)
|
||||
.runBefore(() -> setRotation(device, beginRotation))
|
||||
.runBefore(testApp::open)
|
||||
.runBefore(() -> clickEditTextWidget(device, testApp))
|
||||
.runBefore(() -> testApp.clickEditTextWidget(device))
|
||||
.run(device::pressBack)
|
||||
.run(device::waitForIdle)
|
||||
.runAfterAll(testApp::exit)
|
||||
.repeat(ITERATIONS);
|
||||
}
|
||||
|
||||
static TransitionBuilder enterPipMode(UiDevice device) {
|
||||
IAppHelper testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
|
||||
"com.android.server.wm.flicker.testapp", "PipApp");
|
||||
static TransitionBuilder enterPipMode(PipAppHelper testApp, UiDevice device) {
|
||||
return TransitionRunner.newBuilder()
|
||||
.withTag("enterPipMode_" + testApp.getLauncherName())
|
||||
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
|
||||
.runBefore(device::pressHome)
|
||||
.runBefore(testApp::open)
|
||||
.run(() -> clickEnterPipButton(device, testApp))
|
||||
.run(() -> testApp.clickEnterPipButton(device))
|
||||
.runAfter(() -> closePipWindow(device))
|
||||
.runAfterAll(testApp::exit)
|
||||
.repeat(ITERATIONS);
|
||||
}
|
||||
|
||||
static TransitionBuilder exitPipModeToHome(UiDevice device) {
|
||||
IAppHelper testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
|
||||
"com.android.server.wm.flicker.testapp", "PipApp");
|
||||
static TransitionBuilder exitPipModeToHome(PipAppHelper testApp, UiDevice device) {
|
||||
return TransitionRunner.newBuilder()
|
||||
.withTag("exitPipModeToHome_" + testApp.getLauncherName())
|
||||
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
|
||||
.runBefore(device::pressHome)
|
||||
.runBefore(testApp::open)
|
||||
.runBefore(() -> clickEnterPipButton(device, testApp))
|
||||
.runBefore(() -> testApp.clickEnterPipButton(device))
|
||||
.run(() -> closePipWindow(device))
|
||||
.run(device::waitForIdle)
|
||||
.runAfterAll(testApp::exit)
|
||||
.repeat(ITERATIONS);
|
||||
}
|
||||
|
||||
static TransitionBuilder exitPipModeToApp(UiDevice device) {
|
||||
IAppHelper testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
|
||||
"com.android.server.wm.flicker.testapp", "PipApp");
|
||||
static TransitionBuilder exitPipModeToApp(PipAppHelper testApp, UiDevice device) {
|
||||
return TransitionRunner.newBuilder()
|
||||
.withTag("exitPipModeToApp_" + testApp.getLauncherName())
|
||||
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
|
||||
.runBefore(device::pressHome)
|
||||
.runBefore(testApp::open)
|
||||
.runBefore(() -> clickEnterPipButton(device, testApp))
|
||||
.runBefore(() -> testApp.clickEnterPipButton(device))
|
||||
.run(() -> expandPipWindow(device))
|
||||
.run(device::waitForIdle)
|
||||
.runAfterAll(testApp::exit)
|
||||
|
||||
@@ -25,6 +25,9 @@ import androidx.test.InstrumentationRegistry;
|
||||
import androidx.test.filters.LargeTest;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import com.android.server.wm.flicker.helpers.ImeAppHelper;
|
||||
import com.android.server.wm.flicker.helpers.PipAppHelper;
|
||||
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
@@ -44,23 +47,25 @@ public class DebugTest {
|
||||
private UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
|
||||
|
||||
/**
|
||||
* atest FlickerTest:DebugTests#openAppCold
|
||||
* atest FlickerTests:DebugTest#openAppCold
|
||||
*/
|
||||
@Test
|
||||
public void openAppCold() {
|
||||
CommonTransitions.getOpenAppCold(testApp, uiDevice).recordAllRuns().build().run();
|
||||
CommonTransitions.openAppCold(testApp, uiDevice, Surface.ROTATION_0)
|
||||
.recordAllRuns().build().run();
|
||||
}
|
||||
|
||||
/**
|
||||
* atest FlickerTest:DebugTests#openAppWarm
|
||||
* atest FlickerTests:DebugTest#openAppWarm
|
||||
*/
|
||||
@Test
|
||||
public void openAppWarm() {
|
||||
CommonTransitions.openAppWarm(testApp, uiDevice).recordAllRuns().build().run();
|
||||
CommonTransitions.openAppWarm(testApp, uiDevice, Surface.ROTATION_0)
|
||||
.recordAllRuns().build().run();
|
||||
}
|
||||
|
||||
/**
|
||||
* atest FlickerTest:DebugTests#changeOrientationFromNaturalToLeft
|
||||
* atest FlickerTests:DebugTest#changeOrientationFromNaturalToLeft
|
||||
*/
|
||||
@Test
|
||||
public void changeOrientationFromNaturalToLeft() {
|
||||
@@ -69,7 +74,7 @@ public class DebugTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* atest FlickerTest:DebugTests#closeAppWithBackKey
|
||||
* atest FlickerTests:DebugTest#closeAppWithBackKey
|
||||
*/
|
||||
@Test
|
||||
public void closeAppWithBackKey() {
|
||||
@@ -77,7 +82,7 @@ public class DebugTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* atest FlickerTest:DebugTests#closeAppWithHomeKey
|
||||
* atest FlickerTests:DebugTest#closeAppWithHomeKey
|
||||
*/
|
||||
@Test
|
||||
public void closeAppWithHomeKey() {
|
||||
@@ -85,7 +90,7 @@ public class DebugTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* atest FlickerTest:DebugTests#openAppToSplitScreen
|
||||
* atest FlickerTests:DebugTest#openAppToSplitScreen
|
||||
*/
|
||||
@Test
|
||||
public void openAppToSplitScreen() {
|
||||
@@ -94,7 +99,7 @@ public class DebugTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* atest FlickerTest:DebugTests#splitScreenToLauncher
|
||||
* atest FlickerTests:DebugTest#splitScreenToLauncher
|
||||
*/
|
||||
@Test
|
||||
public void splitScreenToLauncher() {
|
||||
@@ -104,70 +109,80 @@ public class DebugTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* atest FlickerTest:DebugTests#resizeSplitScreen
|
||||
* atest FlickerTests:DebugTest#resizeSplitScreen
|
||||
*/
|
||||
@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
|
||||
|
||||
/**
|
||||
* atest FlickerTest:DebugTests#editTextSetFocus
|
||||
* atest FlickerTests:DebugTest#editTextSetFocus
|
||||
*/
|
||||
@Test
|
||||
public void editTextSetFocus() {
|
||||
CommonTransitions.editTextSetFocus(uiDevice).includeJankyRuns().recordEachRun()
|
||||
ImeAppHelper testApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
|
||||
CommonTransitions.editTextSetFocus(testApp, uiDevice, Surface.ROTATION_0)
|
||||
.includeJankyRuns().recordEachRun()
|
||||
.build().run();
|
||||
}
|
||||
|
||||
/**
|
||||
* atest FlickerTest:DebugTests#editTextLoseFocusToHome
|
||||
* atest FlickerTests:DebugTest#editTextLoseFocusToHome
|
||||
*/
|
||||
@Test
|
||||
public void editTextLoseFocusToHome() {
|
||||
CommonTransitions.editTextLoseFocusToHome(uiDevice).includeJankyRuns().recordEachRun()
|
||||
ImeAppHelper testApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
|
||||
CommonTransitions.editTextLoseFocusToHome(testApp, uiDevice, Surface.ROTATION_0)
|
||||
.includeJankyRuns().recordEachRun()
|
||||
.build().run();
|
||||
}
|
||||
|
||||
/**
|
||||
* atest FlickerTest:DebugTests#editTextLoseFocusToApp
|
||||
* atest FlickerTests:DebugTest#editTextLoseFocusToApp
|
||||
*/
|
||||
@Test
|
||||
public void editTextLoseFocusToApp() {
|
||||
CommonTransitions.editTextLoseFocusToHome(uiDevice).includeJankyRuns().recordEachRun()
|
||||
ImeAppHelper testApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
|
||||
CommonTransitions.editTextLoseFocusToHome(testApp, uiDevice, Surface.ROTATION_0)
|
||||
.includeJankyRuns().recordEachRun()
|
||||
.build().run();
|
||||
}
|
||||
|
||||
// PIP tests
|
||||
|
||||
/**
|
||||
* atest FlickerTest:DebugTests#enterPipMode
|
||||
* atest FlickerTests:DebugTest#enterPipMode
|
||||
*/
|
||||
@Test
|
||||
public void enterPipMode() {
|
||||
CommonTransitions.enterPipMode(uiDevice).includeJankyRuns().recordEachRun().build().run();
|
||||
PipAppHelper testApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation());
|
||||
CommonTransitions.enterPipMode(testApp, uiDevice).includeJankyRuns().recordEachRun()
|
||||
.build().run();
|
||||
}
|
||||
|
||||
/**
|
||||
* atest FlickerTest:DebugTests#exitPipModeToHome
|
||||
* atest FlickerTests:DebugTest#exitPipModeToHome
|
||||
*/
|
||||
@Test
|
||||
public void exitPipModeToHome() {
|
||||
CommonTransitions.exitPipModeToHome(uiDevice).includeJankyRuns().recordEachRun()
|
||||
PipAppHelper testApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation());
|
||||
CommonTransitions.exitPipModeToHome(testApp, uiDevice).includeJankyRuns().recordEachRun()
|
||||
.build().run();
|
||||
}
|
||||
|
||||
/**
|
||||
* atest FlickerTest:DebugTests#exitPipModeToApp
|
||||
* atest FlickerTests:DebugTest#exitPipModeToApp
|
||||
*/
|
||||
@Test
|
||||
public void exitPipModeToApp() {
|
||||
CommonTransitions.exitPipModeToApp(uiDevice).includeJankyRuns().recordEachRun()
|
||||
PipAppHelper testApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation());
|
||||
CommonTransitions.exitPipModeToApp(testApp, uiDevice).includeJankyRuns().recordEachRun()
|
||||
.build().run();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public class FlickerTestBase {
|
||||
/**
|
||||
* Runs a transition, returns a cached result if the transition has run before.
|
||||
*/
|
||||
void runTransition(TransitionRunner transition) {
|
||||
void run(TransitionRunner transition) {
|
||||
if (transitionResults.containsKey(transition.getTestTag())) {
|
||||
mResults = transitionResults.get(transition.getTestTag());
|
||||
return;
|
||||
@@ -110,6 +110,13 @@ public class FlickerTestBase {
|
||||
transitionResults.put(transition.getTestTag(), mResults);
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs a transition, returns a cached result if the transition has run before.
|
||||
*/
|
||||
void runTransition(TransitionRunner transition) {
|
||||
run(transition);
|
||||
}
|
||||
|
||||
/**
|
||||
* Goes through a list of transition results and checks assertions on each result.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* 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 android.view.Surface.rotationToString;
|
||||
|
||||
import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.view.Surface;
|
||||
|
||||
import androidx.test.filters.FlakyTest;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runners.Parameterized.Parameters;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
public abstract class NonRotationTestBase extends FlickerTestBase {
|
||||
|
||||
int mBeginRotation;
|
||||
|
||||
public NonRotationTestBase(String beginRotationName, int beginRotation) {
|
||||
this.mBeginRotation = beginRotation;
|
||||
}
|
||||
|
||||
@Parameters(name = "{0}")
|
||||
public static Collection<Object[]> getParams() {
|
||||
int[] supportedRotations =
|
||||
{Surface.ROTATION_0, Surface.ROTATION_90};
|
||||
Collection<Object[]> params = new ArrayList<>();
|
||||
|
||||
for (int begin : supportedRotations) {
|
||||
params.add(new Object[]{rotationToString(begin), begin});
|
||||
}
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
@FlakyTest(bugId = 141361128)
|
||||
@Ignore("Waiting bug feedback")
|
||||
@Test
|
||||
public void checkCoveredRegion_noUncoveredRegions() {
|
||||
Rect displayBounds = getDisplayBounds(mBeginRotation);
|
||||
checkResults(result -> LayersTraceSubject.assertThat(result).coversRegion(
|
||||
displayBounds).forAllEntries());
|
||||
}
|
||||
|
||||
@FlakyTest(bugId = 141361128)
|
||||
@Ignore("Waiting bug feedback")
|
||||
@Test
|
||||
public void checkVisibility_navBarLayerIsAlwaysVisible() {
|
||||
checkResults(result -> LayersTraceSubject.assertThat(result)
|
||||
.showsLayer(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries());
|
||||
}
|
||||
|
||||
@FlakyTest(bugId = 141361128)
|
||||
@Ignore("Waiting bug feedback")
|
||||
@Test
|
||||
public void checkVisibility_statusBarLayerIsAlwaysVisible() {
|
||||
checkResults(result -> LayersTraceSubject.assertThat(result)
|
||||
.showsLayer(STATUS_BAR_WINDOW_TITLE).forAllEntries());
|
||||
}
|
||||
}
|
||||
@@ -16,14 +16,12 @@
|
||||
|
||||
package com.android.server.wm.flicker;
|
||||
|
||||
import static com.android.server.wm.flicker.CommonTransitions.getOpenAppCold;
|
||||
import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds;
|
||||
import static com.android.server.wm.flicker.CommonTransitions.openAppCold;
|
||||
import static com.android.server.wm.flicker.WmTraceSubject.assertThat;
|
||||
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
import androidx.test.filters.FlakyTest;
|
||||
import androidx.test.filters.LargeTest;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.FixMethodOrder;
|
||||
@@ -31,36 +29,28 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.MethodSorters;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
/**
|
||||
* Test cold launch app from launcher.
|
||||
* To run this test: {@code atest FlickerTests:OpenAppColdTest}
|
||||
*/
|
||||
@LargeTest
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(Parameterized.class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class OpenAppColdTest extends FlickerTestBase {
|
||||
public class OpenAppColdTest extends NonRotationTestBase {
|
||||
|
||||
public OpenAppColdTest(String beginRotationName, int beginRotation) {
|
||||
super(beginRotationName, beginRotation);
|
||||
|
||||
public OpenAppColdTest() {
|
||||
this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
|
||||
"com.android.server.wm.flicker.testapp", "SimpleApp");
|
||||
}
|
||||
|
||||
@Before
|
||||
public void runTransition() {
|
||||
super.runTransition(getOpenAppCold(mTestApp, mUiDevice).build());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkVisibility_navBarWindowIsAlwaysVisible() {
|
||||
checkResults(result -> assertThat(result)
|
||||
.showsAboveAppWindow(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkVisibility_statusBarWindowIsAlwaysVisible() {
|
||||
checkResults(result -> assertThat(result)
|
||||
.showsAboveAppWindow(STATUS_BAR_WINDOW_TITLE).forAllEntries());
|
||||
run(openAppCold(mTestApp, mUiDevice, mBeginRotation)
|
||||
.includeJankyRuns().build());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -72,6 +62,8 @@ public class OpenAppColdTest extends FlickerTestBase {
|
||||
.forAllEntries());
|
||||
}
|
||||
|
||||
@FlakyTest(bugId = 140855415)
|
||||
@Ignore("Waiting bug feedback")
|
||||
@Test
|
||||
public void checkZOrder_appWindowReplacesLauncherAsTopWindow() {
|
||||
checkResults(result -> assertThat(result)
|
||||
@@ -82,26 +74,6 @@ public class OpenAppColdTest extends FlickerTestBase {
|
||||
.forAllEntries());
|
||||
}
|
||||
|
||||
@Test
|
||||
@FlakyTest(bugId = 141235985)
|
||||
@Ignore("Waiting bug feedback")
|
||||
public void checkCoveredRegion_noUncoveredRegions() {
|
||||
checkResults(result -> LayersTraceSubject.assertThat(result).coversRegion(
|
||||
getDisplayBounds()).forAllEntries());
|
||||
}
|
||||
|
||||
@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());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkVisibility_wallpaperLayerBecomesInvisible() {
|
||||
checkResults(result -> LayersTraceSubject.assertThat(result)
|
||||
|
||||
@@ -17,13 +17,11 @@
|
||||
package com.android.server.wm.flicker;
|
||||
|
||||
import static com.android.server.wm.flicker.CommonTransitions.openAppWarm;
|
||||
import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds;
|
||||
import static com.android.server.wm.flicker.WmTraceSubject.assertThat;
|
||||
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
import androidx.test.filters.FlakyTest;
|
||||
import androidx.test.filters.LargeTest;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.FixMethodOrder;
|
||||
@@ -31,36 +29,28 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.MethodSorters;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
/**
|
||||
* Test warm launch app.
|
||||
* To run this test: {@code atest FlickerTests:OpenAppWarmTest}
|
||||
*/
|
||||
@LargeTest
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(Parameterized.class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class OpenAppWarmTest extends FlickerTestBase {
|
||||
public class OpenAppWarmTest extends NonRotationTestBase {
|
||||
|
||||
public OpenAppWarmTest(String beginRotationName, int beginRotation) {
|
||||
super(beginRotationName, beginRotation);
|
||||
|
||||
public OpenAppWarmTest() {
|
||||
this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
|
||||
"com.android.server.wm.flicker.testapp", "SimpleApp");
|
||||
}
|
||||
|
||||
@Before
|
||||
public void runTransition() {
|
||||
super.runTransition(openAppWarm(mTestApp, mUiDevice).includeJankyRuns().build());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkVisibility_navBarIsAlwaysVisible() {
|
||||
checkResults(result -> assertThat(result)
|
||||
.showsAboveAppWindow(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkVisibility_statusBarIsAlwaysVisible() {
|
||||
checkResults(result -> assertThat(result)
|
||||
.showsAboveAppWindow(STATUS_BAR_WINDOW_TITLE).forAllEntries());
|
||||
super.runTransition(openAppWarm(mTestApp, mUiDevice, mBeginRotation)
|
||||
.includeJankyRuns().build());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -72,6 +62,8 @@ public class OpenAppWarmTest extends FlickerTestBase {
|
||||
.forAllEntries());
|
||||
}
|
||||
|
||||
@FlakyTest(bugId = 140855415)
|
||||
@Ignore("Waiting bug feedback")
|
||||
@Test
|
||||
public void checkZOrder_appWindowReplacesLauncherAsTopWindow() {
|
||||
checkResults(result -> assertThat(result)
|
||||
@@ -82,26 +74,6 @@ public class OpenAppWarmTest extends FlickerTestBase {
|
||||
.forAllEntries());
|
||||
}
|
||||
|
||||
@FlakyTest(bugId = 141235985)
|
||||
@Ignore("Waiting bug feedback")
|
||||
@Test
|
||||
public void checkCoveredRegion_noUncoveredRegions() {
|
||||
checkResults(result -> LayersTraceSubject.assertThat(result).coversRegion(
|
||||
getDisplayBounds()).forAllEntries());
|
||||
}
|
||||
|
||||
@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());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkVisibility_wallpaperLayerBecomesInvisible() {
|
||||
checkResults(result -> LayersTraceSubject.assertThat(result)
|
||||
|
||||
@@ -17,31 +17,39 @@
|
||||
package com.android.server.wm.flicker;
|
||||
|
||||
import static com.android.server.wm.flicker.CommonTransitions.editTextSetFocus;
|
||||
import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds;
|
||||
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
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;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.MethodSorters;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
/**
|
||||
* Test IME window opening transitions.
|
||||
* To run this test: {@code atest FlickerTests:OpenImeWindowTest}
|
||||
*/
|
||||
@LargeTest
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@RunWith(Parameterized.class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class OpenImeWindowTest extends FlickerTestBase {
|
||||
public class OpenImeWindowTest extends NonRotationTestBase {
|
||||
|
||||
private static final String IME_WINDOW_TITLE = "InputMethod";
|
||||
|
||||
public OpenImeWindowTest(String beginRotationName, int beginRotation) {
|
||||
super(beginRotationName, beginRotation);
|
||||
|
||||
mTestApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
|
||||
}
|
||||
|
||||
@Before
|
||||
public void runTransition() {
|
||||
super.runTransition(editTextSetFocus(mUiDevice)
|
||||
run(editTextSetFocus((ImeAppHelper) mTestApp, mUiDevice, mBeginRotation)
|
||||
.includeJankyRuns().build());
|
||||
}
|
||||
|
||||
@@ -62,10 +70,4 @@ public class OpenImeWindowTest extends FlickerTestBase {
|
||||
.showsLayer(IME_WINDOW_TITLE)
|
||||
.forAllEntries());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkCoveredRegion_noUncoveredRegions() {
|
||||
checkResults(result -> LayersTraceSubject.assertThat(result).coversRegion(
|
||||
getDisplayBounds()).forAllEntries());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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.helpers;
|
||||
|
||||
import android.app.Instrumentation;
|
||||
|
||||
import com.android.server.wm.flicker.StandardAppHelper;
|
||||
|
||||
public abstract class FlickerAppHelper extends StandardAppHelper {
|
||||
|
||||
static int sFindTimeout = 10000;
|
||||
static String sFlickerPackage = "com.android.server.wm.flicker.testapp";
|
||||
|
||||
public FlickerAppHelper(Instrumentation instr, String launcherName) {
|
||||
super(instr, sFlickerPackage, launcherName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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.helpers;
|
||||
|
||||
import android.app.Instrumentation;
|
||||
import android.support.test.uiautomator.UiDevice;
|
||||
|
||||
public class ImeAppAutoFocusHelper extends ImeAppHelper {
|
||||
|
||||
public ImeAppAutoFocusHelper(Instrumentation instr) {
|
||||
super(instr, "ImeAppAutoFocus");
|
||||
}
|
||||
|
||||
public void clickEditTextWidget(UiDevice device) {
|
||||
// do nothing (the app is focused automatically)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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.helpers;
|
||||
|
||||
import static android.os.SystemClock.sleep;
|
||||
|
||||
import android.app.Instrumentation;
|
||||
import android.support.test.uiautomator.By;
|
||||
import android.support.test.uiautomator.UiDevice;
|
||||
import android.support.test.uiautomator.UiObject2;
|
||||
|
||||
public class ImeAppHelper extends FlickerAppHelper {
|
||||
|
||||
ImeAppHelper(Instrumentation instr, String launcherName) {
|
||||
super(instr, launcherName);
|
||||
}
|
||||
|
||||
public ImeAppHelper(Instrumentation instr) {
|
||||
this(instr, "ImeApp");
|
||||
}
|
||||
|
||||
public void clickEditTextWidget(UiDevice device) {
|
||||
UiObject2 editText = device.findObject(By.res(getPackage(), "plain_text_input"));
|
||||
editText.click();
|
||||
sleep(500);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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.helpers;
|
||||
|
||||
import static com.android.server.wm.flicker.helpers.AutomationUtils.getPipWindowSelector;
|
||||
|
||||
import android.app.Instrumentation;
|
||||
import android.support.test.uiautomator.By;
|
||||
import android.support.test.uiautomator.UiDevice;
|
||||
import android.support.test.uiautomator.UiObject2;
|
||||
import android.support.test.uiautomator.Until;
|
||||
|
||||
public class PipAppHelper extends FlickerAppHelper {
|
||||
|
||||
public PipAppHelper(Instrumentation instr) {
|
||||
super(instr, "PipApp");
|
||||
}
|
||||
|
||||
public void clickEnterPipButton(UiDevice device) {
|
||||
UiObject2 enterPipButton = device.findObject(By.res(getPackage(), "enter_pip"));
|
||||
enterPipButton.click();
|
||||
UiObject2 pipWindow = device.wait(Until.findObject(getPipWindowSelector()), sFindTimeout);
|
||||
|
||||
if (pipWindow == null) {
|
||||
throw new RuntimeException("Unable to find PIP window");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -38,6 +38,15 @@
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".ImeActivityAutoFocus"
|
||||
android:taskAffinity="com.android.server.wm.flicker.testapp.ImeActivityAutoFocus"
|
||||
android:windowSoftInputMode="stateVisible"
|
||||
android:label="ImeAppAutoFocus">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".PipActivity"
|
||||
android:resizeableActivity="true"
|
||||
android:supportsPictureInPicture="true"
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:focusableInTouchMode="true"
|
||||
android:background="@android:color/holo_green_light">
|
||||
<EditText android:id="@+id/plain_text_input"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* 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.testapp;
|
||||
|
||||
import android.widget.EditText;
|
||||
|
||||
public class ImeActivityAutoFocus extends ImeActivity {
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
||||
EditText editTextField = findViewById(R.id.plain_text_input);
|
||||
editTextField.requestFocus();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user