Loading tests/tapl/com/android/launcher3/tapl/AppIcon.java +5 −0 Original line number Diff line number Diff line Loading @@ -75,4 +75,9 @@ public final class AppIcon extends Launchable { protected void expectActivityStartEvents() { mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_START); } @Override protected String launchableType() { return "app icon"; } } tests/tapl/com/android/launcher3/tapl/AppIconMenuItem.java +5 −2 Original line number Diff line number Diff line Loading @@ -20,8 +20,6 @@ import androidx.test.uiautomator.UiObject2; import com.android.launcher3.testing.TestProtocol; import java.util.regex.Pattern; /** * Menu item in an app icon menu. */ Loading Loading @@ -51,4 +49,9 @@ public class AppIconMenuItem extends Launchable { protected void expectActivityStartEvents() { mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_START); } @Override protected String launchableType() { return "app icon menu item"; } } tests/tapl/com/android/launcher3/tapl/Launchable.java +22 −16 Original line number Diff line number Diff line Loading @@ -53,9 +53,13 @@ abstract class Launchable { protected abstract void expectActivityStartEvents(); protected abstract String launchableType(); private Background launch(BySelector selector) { LauncherInstrumentation.log("Launchable.launch before click " + mObject.getVisibleCenter() + " in " + mLauncher.getVisibleBounds(mObject)); try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer( "clicking " + launchableType())) { LauncherInstrumentation.log("Launchable.launch before click " + mObject.getVisibleCenter() + " in " + mLauncher.getVisibleBounds(mObject)); final String label = mObject.getText(); mLauncher.executeAndWaitForEvent( Loading @@ -68,9 +72,11 @@ abstract class Launchable { mLauncher.assertTrue( "App didn't start: " + label + " (" + selector + ")", TestHelpers.wait(Until.hasObject(selector), LauncherInstrumentation.WAIT_TIME_MS)); TestHelpers.wait(Until.hasObject(selector), LauncherInstrumentation.WAIT_TIME_MS)); return new Background(mLauncher); } } /** * Drags an object to the center of homescreen. Loading tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +1 −1 Original line number Diff line number Diff line Loading @@ -499,7 +499,7 @@ public final class LauncherInstrumentation { void fail(String message) { checkForAnomaly(); Assert.fail(formatSystemHealthMessage(formatErrorWithEvents( "http://go/tapl test failure:\nSummary: " + getContextDescription() "http://go/tapl test failure:\nContext: " + getContextDescription() + " - visible state is " + getVisibleStateMessage() + ";\nDetails: " + message, true))); } Loading tests/tapl/com/android/launcher3/tapl/Widget.java +5 −0 Original line number Diff line number Diff line Loading @@ -46,4 +46,9 @@ public final class Widget extends Launchable { protected void addExpectedEventsForLongClick() { mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LONG_CLICK_EVENT); } @Override protected String launchableType() { return "widget"; } } Loading
tests/tapl/com/android/launcher3/tapl/AppIcon.java +5 −0 Original line number Diff line number Diff line Loading @@ -75,4 +75,9 @@ public final class AppIcon extends Launchable { protected void expectActivityStartEvents() { mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_START); } @Override protected String launchableType() { return "app icon"; } }
tests/tapl/com/android/launcher3/tapl/AppIconMenuItem.java +5 −2 Original line number Diff line number Diff line Loading @@ -20,8 +20,6 @@ import androidx.test.uiautomator.UiObject2; import com.android.launcher3.testing.TestProtocol; import java.util.regex.Pattern; /** * Menu item in an app icon menu. */ Loading Loading @@ -51,4 +49,9 @@ public class AppIconMenuItem extends Launchable { protected void expectActivityStartEvents() { mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_START); } @Override protected String launchableType() { return "app icon menu item"; } }
tests/tapl/com/android/launcher3/tapl/Launchable.java +22 −16 Original line number Diff line number Diff line Loading @@ -53,9 +53,13 @@ abstract class Launchable { protected abstract void expectActivityStartEvents(); protected abstract String launchableType(); private Background launch(BySelector selector) { LauncherInstrumentation.log("Launchable.launch before click " + mObject.getVisibleCenter() + " in " + mLauncher.getVisibleBounds(mObject)); try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer( "clicking " + launchableType())) { LauncherInstrumentation.log("Launchable.launch before click " + mObject.getVisibleCenter() + " in " + mLauncher.getVisibleBounds(mObject)); final String label = mObject.getText(); mLauncher.executeAndWaitForEvent( Loading @@ -68,9 +72,11 @@ abstract class Launchable { mLauncher.assertTrue( "App didn't start: " + label + " (" + selector + ")", TestHelpers.wait(Until.hasObject(selector), LauncherInstrumentation.WAIT_TIME_MS)); TestHelpers.wait(Until.hasObject(selector), LauncherInstrumentation.WAIT_TIME_MS)); return new Background(mLauncher); } } /** * Drags an object to the center of homescreen. Loading
tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +1 −1 Original line number Diff line number Diff line Loading @@ -499,7 +499,7 @@ public final class LauncherInstrumentation { void fail(String message) { checkForAnomaly(); Assert.fail(formatSystemHealthMessage(formatErrorWithEvents( "http://go/tapl test failure:\nSummary: " + getContextDescription() "http://go/tapl test failure:\nContext: " + getContextDescription() + " - visible state is " + getVisibleStateMessage() + ";\nDetails: " + message, true))); } Loading
tests/tapl/com/android/launcher3/tapl/Widget.java +5 −0 Original line number Diff line number Diff line Loading @@ -46,4 +46,9 @@ public final class Widget extends Launchable { protected void addExpectedEventsForLongClick() { mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LONG_CLICK_EVENT); } @Override protected String launchableType() { return "widget"; } }