diff options
author | Vadim Tryshev <vadimt@google.com> | 2018-08-14 19:53:43 -0700 |
---|---|---|
committer | Vadim Tryshev <vadimt@google.com> | 2018-08-14 19:53:43 -0700 |
commit | b6398a1eb8b69651e0f901a93d7b46347e5d6a83 (patch) | |
tree | d53a77ff6d7e3e93dc4c70ddfb38d83604dc9e84 /tests | |
parent | e1c4a90635f18548d3cadab5866dd1aba7bbfea4 (diff) | |
download | android_packages_apps_Trebuchet-b6398a1eb8b69651e0f901a93d7b46347e5d6a83.tar.gz android_packages_apps_Trebuchet-b6398a1eb8b69651e0f901a93d7b46347e5d6a83.tar.bz2 android_packages_apps_Trebuchet-b6398a1eb8b69651e0f901a93d7b46347e5d6a83.zip |
Sharing protocol constants between Launcher and TAPL
Bug: 110103162
Test: TaplTests
Change-Id: I5b2a2b8576a7a6ea4a156f00858711496d6b5bba
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Android.mk | 3 | ||||
-rw-r--r-- | tests/tapl/com/android/launcher3/tapl/AllApps.java | 6 | ||||
-rw-r--r-- | tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java | 5 |
3 files changed, 9 insertions, 5 deletions
diff --git a/tests/Android.mk b/tests/Android.mk index 1531c32df..03cb154a4 100644 --- a/tests/Android.mk +++ b/tests/Android.mk @@ -46,7 +46,8 @@ LOCAL_STATIC_JAVA_LIBRARIES := \ libSharedSystemUI LOCAL_SRC_FILES := $(call all-java-files-under, tapl) \ - ../quickstep/src/com/android/quickstep/SwipeUpSetting.java + ../quickstep/src/com/android/quickstep/SwipeUpSetting.java \ + ../src/com/android/launcher3/TestProtocol.java LOCAL_SDK_VERSION := current LOCAL_MODULE := ub-launcher-aosp-tapl diff --git a/tests/tapl/com/android/launcher3/tapl/AllApps.java b/tests/tapl/com/android/launcher3/tapl/AllApps.java index d64f86cbc..c3bc61bab 100644 --- a/tests/tapl/com/android/launcher3/tapl/AllApps.java +++ b/tests/tapl/com/android/launcher3/tapl/AllApps.java @@ -24,6 +24,8 @@ import android.support.test.uiautomator.UiObject2; import androidx.annotation.NonNull; +import com.android.launcher3.TestProtocol; + /** * Operations on AllApps opened from Home. Also a parent for All Apps opened from Overview. */ @@ -96,8 +98,8 @@ public class AllApps extends LauncherInstrumentation.VisibleContainer { } private int getScroll(UiObject2 allAppsContainer) { - return mLauncher.getAnswerFromLauncher(allAppsContainer, "TAPL_GET_SCROLL"). - getInt("scrollY", -1); + return mLauncher.getAnswerFromLauncher(allAppsContainer, TestProtocol.GET_SCROLL_MESSAGE). + getInt(TestProtocol.SCROLL_Y_FIELD, -1); } private void ensureIconVisible(UiObject2 appIcon, UiObject2 allAppsContainer) { diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index fa282c333..01e76f3f3 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -34,6 +34,7 @@ import android.support.test.uiautomator.UiObject2; import android.support.test.uiautomator.Until; import android.view.accessibility.AccessibilityEvent; +import com.android.launcher3.TestProtocol; import com.android.quickstep.SwipeUpSetting; import java.lang.ref.WeakReference; @@ -174,7 +175,7 @@ public final class LauncherInstrumentation { Bundle getAnswerFromLauncher(UiObject2 view, String requestTag) { // Send a fake set-text request to Launcher to initiate a response with requested data. - final String responseTag = requestTag + "_RESPONSE"; + final String responseTag = requestTag + TestProtocol.RESPONSE_MESSAGE_POSTFIX; return executeAndWaitForEvent( () -> view.setText(requestTag), event -> responseTag.equals(event.getClassName()), @@ -338,7 +339,7 @@ public final class LauncherInstrumentation { void swipe(int startX, int startY, int endX, int endY) { executeAndWaitForEvent( () -> mDevice.swipe(startX, startY, endX, endY, 60), - event -> "TAPL_WENT_TO_STATE".equals(event.getClassName()), + event -> TestProtocol.SWITCHED_TO_STATE_MESSAGE.equals(event.getClassName()), "Swipe failed to receive an event for the swipe end: " + startX + ", " + startY + ", " + endX + ", " + endY); } |