diff options
author | Vadim Tryshev <vadimt@google.com> | 2019-07-24 01:30:06 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-07-24 01:30:06 +0000 |
commit | 7b0520afe48b511ed910de1048405185712e5b03 (patch) | |
tree | 19a97bba15f9b129fd315b4949d94f50a8d67e13 /tests/tapl | |
parent | 064cba456090fe1b651f98e0e891b3b84e541b1f (diff) | |
parent | 0dd1c782f0cb1653f191a2ec9db72f8f26190dc8 (diff) | |
download | android_packages_apps_Trebuchet-7b0520afe48b511ed910de1048405185712e5b03.tar.gz android_packages_apps_Trebuchet-7b0520afe48b511ed910de1048405185712e5b03.tar.bz2 android_packages_apps_Trebuchet-7b0520afe48b511ed910de1048405185712e5b03.zip |
Merge "Checking Launcher internal integrity from tests" into ub-launcher3-qt-r1-dev
Diffstat (limited to 'tests/tapl')
-rw-r--r-- | tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index 1a22e53de..f91e2ada7 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -72,6 +72,7 @@ import java.util.Deque; import java.util.LinkedList; import java.util.List; import java.util.concurrent.TimeoutException; +import java.util.function.Consumer; import java.util.function.Supplier; /** @@ -86,7 +87,7 @@ public final class LauncherInstrumentation { // Types for launcher containers that the user is interacting with. "Background" is a // pseudo-container corresponding to inactive launcher covered by another app. - enum ContainerType { + public enum ContainerType { WORKSPACE, ALL_APPS, OVERVIEW, WIDGETS, BACKGROUND, FALLBACK_OVERVIEW } @@ -135,6 +136,8 @@ public final class LauncherInstrumentation { private final Deque<String> mDiagnosticContext = new LinkedList<>(); private Supplier<String> mSystemHealthSupplier; + private Consumer<ContainerType> mOnSettledStateAction; + /** * Constructs the root of TAPL hierarchy. You get all other objects from it. */ @@ -296,6 +299,10 @@ public final class LauncherInstrumentation { this.mSystemHealthSupplier = supplier; } + public void setOnSettledStateAction(Consumer<ContainerType> onSettledStateAction) { + mOnSettledStateAction = onSettledStateAction; + } + private String getSystemHealthMessage() { final String testPackage = getContext().getPackageName(); try { @@ -415,6 +422,14 @@ public final class LauncherInstrumentation { assertTrue(error, error == null); log("verifyContainerType: " + containerType); + final UiObject2 container = verifyVisibleObjects(containerType); + + if (mOnSettledStateAction != null) mOnSettledStateAction.accept(containerType); + + return container; + } + + private UiObject2 verifyVisibleObjects(ContainerType containerType) { try (Closable c = addContextLayer( "but the current state is not " + containerType.name())) { switch (containerType) { |