Merge "Improving diags for launching an app." into sc-v2-dev am: 8a4a99ed95 am: 1814e61c01
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15366102 Change-Id: Ia03f832669c039e480e9f0ce14272e78e7db56e1
This commit is contained in:
@@ -56,24 +56,29 @@ abstract class Launchable {
|
||||
protected abstract String launchableType();
|
||||
|
||||
private Background launch(BySelector selector) {
|
||||
LauncherInstrumentation.log("Launchable.launch before click "
|
||||
+ mObject.getVisibleCenter() + " in " + mLauncher.getVisibleBounds(mObject));
|
||||
final String label = mObject.getText();
|
||||
try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
|
||||
"want to launch an app from " + launchableType())) {
|
||||
LauncherInstrumentation.log("Launchable.launch before click "
|
||||
+ mObject.getVisibleCenter() + " in " + mLauncher.getVisibleBounds(mObject));
|
||||
final String label = mObject.getText();
|
||||
|
||||
mLauncher.executeAndWaitForEvent(
|
||||
() -> {
|
||||
mLauncher.clickLauncherObject(mObject);
|
||||
expectActivityStartEvents();
|
||||
},
|
||||
event -> event.getEventType() == TYPE_WINDOW_STATE_CHANGED,
|
||||
() -> "Launching an app didn't open a new window: " + label,
|
||||
"clicking " + launchableType());
|
||||
mLauncher.executeAndWaitForEvent(
|
||||
() -> {
|
||||
mLauncher.clickLauncherObject(mObject);
|
||||
expectActivityStartEvents();
|
||||
},
|
||||
event -> event.getEventType() == TYPE_WINDOW_STATE_CHANGED,
|
||||
() -> "Launching an app didn't open a new window: " + label,
|
||||
"clicking " + launchableType());
|
||||
|
||||
mLauncher.assertTrue(
|
||||
"App didn't start: " + label + " (" + selector + ")",
|
||||
TestHelpers.wait(Until.hasObject(selector),
|
||||
LauncherInstrumentation.WAIT_TIME_MS));
|
||||
return new Background(mLauncher);
|
||||
try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer("clicked")) {
|
||||
mLauncher.assertTrue(
|
||||
"App didn't start: " + label + " (" + selector + ")",
|
||||
TestHelpers.wait(Until.hasObject(selector),
|
||||
LauncherInstrumentation.WAIT_TIME_MS));
|
||||
return new Background(mLauncher);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user