Simplifying and removing unnecessary checks from app-drag tests
Change-Id: Iab6603f62b8e3c95b2c3351bfe41f35f15f59246
(cherry picked from commit 8dc1dbe814
)
This commit is contained in:
parent
6938276da1
commit
ab472e8c06
|
@ -321,7 +321,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest {
|
|||
final AppIconMenuItem menuItem = menu.getMenuItem(1);
|
||||
final String itemName = menuItem.getText();
|
||||
|
||||
menuItem.launch(getAppPackageName(), APP_NAME);
|
||||
menuItem.launch(getAppPackageName());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -337,7 +337,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest {
|
|||
getAppIcon(APP_NAME).
|
||||
dragToWorkspace().
|
||||
getWorkspaceAppIcon(APP_NAME).
|
||||
launch(getAppPackageName(), APP_NAME);
|
||||
launch(getAppPackageName());
|
||||
} finally {
|
||||
TestProtocol.sDebugTracing = false;
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest {
|
|||
menuItem.
|
||||
dragToWorkspace().
|
||||
getWorkspaceAppIcon(shortcutName).
|
||||
launch(getAppPackageName(), APP_NAME);
|
||||
launch(getAppPackageName());
|
||||
}
|
||||
|
||||
private static String getAppPackageName() {
|
||||
|
|
|
@ -45,24 +45,17 @@ abstract class Launchable {
|
|||
* Clicks the object to launch its app.
|
||||
*/
|
||||
public Background launch(String expectedPackageName) {
|
||||
return launch(expectedPackageName, By.pkg(expectedPackageName).depth(0));
|
||||
return launch(By.pkg(expectedPackageName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Clicks the object to launch its app.
|
||||
*/
|
||||
public Background launch(String expectedPackageName, String expectedAppText) {
|
||||
return launch(expectedPackageName, By.pkg(expectedPackageName).text(expectedAppText));
|
||||
}
|
||||
|
||||
private Background launch(String errorMessage, BySelector selector) {
|
||||
private Background launch(BySelector selector) {
|
||||
LauncherInstrumentation.log("Launchable.launch before click " +
|
||||
mObject.getVisibleCenter());
|
||||
mLauncher.assertTrue(
|
||||
"Launching an app didn't open a new window: " + mObject.getText(),
|
||||
mObject.clickAndWait(Until.newWindow(), LauncherInstrumentation.WAIT_TIME_MS));
|
||||
mLauncher.assertTrue(
|
||||
"App didn't start: " + errorMessage,
|
||||
"App didn't start: " + selector,
|
||||
mLauncher.getDevice().wait(Until.hasObject(selector),
|
||||
LauncherInstrumentation.WAIT_TIME_MS));
|
||||
return new Background(mLauncher);
|
||||
|
|
Loading…
Reference in New Issue