New FlickerTests: Start IME alongside the app (0 and 90 degrees)
Test: atest FlickerTests:CloseImeAutoOpenWindowToAppTest Change-Id: I8ed60eb5e4653cdcf4d31402069be7da96c5d2bb
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();
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,8 @@ import static com.android.server.wm.flicker.CommonTransitions.editTextLoseFocusT
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
import androidx.test.filters.LargeTest;
|
||||
|
||||
import com.android.server.wm.flicker.helpers.ImeAppHelper;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.Test;
|
||||
@@ -42,14 +44,12 @@ public class CloseImeWindowToAppTest extends NonRotationTestBase {
|
||||
public CloseImeWindowToAppTest(String beginRotationName, int beginRotation) {
|
||||
super(beginRotationName, beginRotation);
|
||||
|
||||
mTestApp = new StandardAppHelper(
|
||||
InstrumentationRegistry.getInstrumentation(),
|
||||
"com.android.server.wm.flicker.testapp", "ImeApp");
|
||||
mTestApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
|
||||
}
|
||||
|
||||
@Before
|
||||
public void runTransition() {
|
||||
run(editTextLoseFocusToApp(mTestApp, mUiDevice, mBeginRotation, /* clickOnEditField */true)
|
||||
run(editTextLoseFocusToApp((ImeAppHelper) mTestApp, mUiDevice, mBeginRotation)
|
||||
.includeJankyRuns().build());
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ import static com.android.server.wm.flicker.CommonTransitions.editTextLoseFocusT
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
import androidx.test.filters.LargeTest;
|
||||
|
||||
import com.android.server.wm.flicker.helpers.ImeAppHelper;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.Test;
|
||||
@@ -42,15 +44,12 @@ public class CloseImeWindowToHomeTest extends NonRotationTestBase {
|
||||
public CloseImeWindowToHomeTest(String beginRotationName, int beginRotation) {
|
||||
super(beginRotationName, beginRotation);
|
||||
|
||||
mTestApp = new StandardAppHelper(
|
||||
InstrumentationRegistry.getInstrumentation(),
|
||||
"com.android.server.wm.flicker.testapp", "ImeApp");
|
||||
mTestApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
|
||||
}
|
||||
|
||||
@Before
|
||||
public void runTransition() {
|
||||
run(editTextLoseFocusToHome(mTestApp, mUiDevice, mBeginRotation,
|
||||
/* clickOnEditField */ true)
|
||||
run(editTextLoseFocusToHome((ImeAppHelper) mTestApp, mUiDevice, mBeginRotation)
|
||||
.includeJankyRuns().build());
|
||||
}
|
||||
|
||||
|
||||
@@ -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,18 +73,6 @@ 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) {
|
||||
return TransitionRunner.newBuilder()
|
||||
@@ -201,15 +189,16 @@ 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);
|
||||
}
|
||||
@@ -243,8 +232,8 @@ class CommonTransitions {
|
||||
.repeat(ITERATIONS);
|
||||
}
|
||||
|
||||
static TransitionBuilder editTextLoseFocusToHome(IAppHelper testApp, UiDevice device,
|
||||
int beginRotation, boolean clickOnEditText) {
|
||||
static TransitionBuilder editTextLoseFocusToHome(ImeAppHelper testApp, UiDevice device,
|
||||
int beginRotation) {
|
||||
return TransitionRunner.newBuilder()
|
||||
.withTag("editTextLoseFocusToHome_" + testApp.getLauncherName()
|
||||
+ rotationToString(beginRotation))
|
||||
@@ -252,19 +241,15 @@ class CommonTransitions {
|
||||
.runBefore(device::pressHome)
|
||||
.runBefore(() -> setRotation(device, beginRotation))
|
||||
.runBefore(testApp::open)
|
||||
.runBefore(() -> {
|
||||
if (clickOnEditText) {
|
||||
clickEditTextWidget(device, testApp);
|
||||
}
|
||||
})
|
||||
.runBefore(() -> testApp.clickEditTextWidget(device))
|
||||
.run(device::pressHome)
|
||||
.run(device::waitForIdle)
|
||||
.runAfterAll(testApp::exit)
|
||||
.repeat(ITERATIONS);
|
||||
}
|
||||
|
||||
static TransitionBuilder editTextLoseFocusToApp(IAppHelper testApp, UiDevice device,
|
||||
int beginRotation, boolean clickOnEditText) {
|
||||
static TransitionBuilder editTextLoseFocusToApp(ImeAppHelper testApp, UiDevice device,
|
||||
int beginRotation) {
|
||||
return TransitionRunner.newBuilder()
|
||||
.withTag("editTextLoseFocusToApp_" + testApp.getLauncherName()
|
||||
+ rotationToString(beginRotation))
|
||||
@@ -272,55 +257,45 @@ class CommonTransitions {
|
||||
.runBefore(device::pressHome)
|
||||
.runBefore(() -> setRotation(device, beginRotation))
|
||||
.runBefore(testApp::open)
|
||||
.runBefore(() -> {
|
||||
if (clickOnEditText) {
|
||||
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;
|
||||
@@ -121,7 +124,9 @@ public class DebugTest {
|
||||
*/
|
||||
@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();
|
||||
}
|
||||
|
||||
@@ -130,10 +135,9 @@ public class DebugTest {
|
||||
*/
|
||||
@Test
|
||||
public void editTextLoseFocusToHome() {
|
||||
IAppHelper testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
|
||||
"com.android.server.wm.flicker.testapp", "ImeApp");
|
||||
CommonTransitions.editTextLoseFocusToHome(testApp, uiDevice, Surface.ROTATION_0,
|
||||
/* clickOnEditField */true).includeJankyRuns().recordEachRun()
|
||||
ImeAppHelper testApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
|
||||
CommonTransitions.editTextLoseFocusToHome(testApp, uiDevice, Surface.ROTATION_0)
|
||||
.includeJankyRuns().recordEachRun()
|
||||
.build().run();
|
||||
}
|
||||
|
||||
@@ -142,8 +146,9 @@ public class DebugTest {
|
||||
*/
|
||||
@Test
|
||||
public void editTextLoseFocusToApp() {
|
||||
CommonTransitions.editTextLoseFocusToHome(testApp, uiDevice, Surface.ROTATION_0,
|
||||
/* clickOnEditField */true).includeJankyRuns().recordEachRun()
|
||||
ImeAppHelper testApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
|
||||
CommonTransitions.editTextLoseFocusToHome(testApp, uiDevice, Surface.ROTATION_0)
|
||||
.includeJankyRuns().recordEachRun()
|
||||
.build().run();
|
||||
}
|
||||
|
||||
@@ -154,7 +159,9 @@ public class DebugTest {
|
||||
*/
|
||||
@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();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -162,7 +169,8 @@ public class DebugTest {
|
||||
*/
|
||||
@Test
|
||||
public void exitPipModeToHome() {
|
||||
CommonTransitions.exitPipModeToHome(uiDevice).includeJankyRuns().recordEachRun()
|
||||
PipAppHelper testApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation());
|
||||
CommonTransitions.exitPipModeToHome(testApp, uiDevice).includeJankyRuns().recordEachRun()
|
||||
.build().run();
|
||||
}
|
||||
|
||||
@@ -171,7 +179,8 @@ public class DebugTest {
|
||||
*/
|
||||
@Test
|
||||
public void exitPipModeToApp() {
|
||||
CommonTransitions.exitPipModeToApp(uiDevice).includeJankyRuns().recordEachRun()
|
||||
PipAppHelper testApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation());
|
||||
CommonTransitions.exitPipModeToApp(testApp, uiDevice).includeJankyRuns().recordEachRun()
|
||||
.build().run();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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