summaryrefslogtreecommitdiffstats
path: root/tests/src/com/android
diff options
context:
space:
mode:
authorvadimt <vadimt@google.com>2019-05-03 11:42:43 -0700
committervadimt <vadimt@google.com>2019-05-03 11:42:43 -0700
commit0030834239abec5dbe2ba31fd467f816c87d431e (patch)
tree7e73f497882da957a789faca2859182d70837f85 /tests/src/com/android
parenta3c0a082f9fe84e007596646e544371fc4df277f (diff)
downloadandroid_packages_apps_Trebuchet-0030834239abec5dbe2ba31fd467f816c87d431e.tar.gz
android_packages_apps_Trebuchet-0030834239abec5dbe2ba31fd467f816c87d431e.tar.bz2
android_packages_apps_Trebuchet-0030834239abec5dbe2ba31fd467f816c87d431e.zip
Temporary hacks to make tests pass on Taimen
Change-Id: I66a81a0407be13c15596c63f21773f8e2dea5d2d
Diffstat (limited to 'tests/src/com/android')
-rw-r--r--tests/src/com/android/launcher3/ui/TestViewHelpers.java22
1 files changed, 14 insertions, 8 deletions
diff --git a/tests/src/com/android/launcher3/ui/TestViewHelpers.java b/tests/src/com/android/launcher3/ui/TestViewHelpers.java
index 6fa28f1c9..2116f5e2d 100644
--- a/tests/src/com/android/launcher3/ui/TestViewHelpers.java
+++ b/tests/src/com/android/launcher3/ui/TestViewHelpers.java
@@ -114,7 +114,8 @@ public class TestViewHelpers {
Point center = icon.getVisibleCenter();
// Action Down
- sendPointer(MotionEvent.ACTION_DOWN, center);
+ final long downTime = SystemClock.uptimeMillis();
+ sendPointer(downTime, MotionEvent.ACTION_DOWN, center);
UiObject2 dragLayer = findViewById(R.id.drag_layer);
@@ -131,7 +132,7 @@ public class TestViewHelpers {
} else {
moveLocation.y += distanceToMove;
}
- movePointer(center, moveLocation);
+ movePointer(downTime, center, moveLocation);
assertNull(findViewById(R.id.deep_shortcuts_container));
}
@@ -142,19 +143,24 @@ public class TestViewHelpers {
Point moveLocation = dragLayer.getVisibleCenter();
// Move to center
- movePointer(center, moveLocation);
- sendPointer(MotionEvent.ACTION_UP, center);
+ movePointer(downTime, center, moveLocation);
+ sendPointer(downTime, MotionEvent.ACTION_UP, moveLocation);
// Wait until remove target is gone.
getDevice().wait(Until.gone(getSelectorForId(R.id.delete_target_text)),
AbstractLauncherUiTest.DEFAULT_UI_TIMEOUT);
}
- private static void movePointer(Point from, Point to) {
+ private static void movePointer(long downTime, Point from, Point to) {
while (!from.equals(to)) {
+ try {
+ Thread.sleep(20);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
from.x = getNextMoveValue(to.x, from.x);
from.y = getNextMoveValue(to.y, from.y);
- sendPointer(MotionEvent.ACTION_MOVE, from);
+ sendPointer(downTime, MotionEvent.ACTION_MOVE, from);
}
}
@@ -168,8 +174,8 @@ public class TestViewHelpers {
}
}
- public static void sendPointer(int action, Point point) {
- MotionEvent event = MotionEvent.obtain(SystemClock.uptimeMillis(),
+ public static void sendPointer(long downTime, int action, Point point) {
+ MotionEvent event = MotionEvent.obtain(downTime,
SystemClock.uptimeMillis(), action, point.x, point.y, 0);
getInstrumentation().sendPointerSync(event);
event.recycle();