summaryrefslogtreecommitdiffstats
path: root/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java')
-rw-r--r--tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java31
1 files changed, 8 insertions, 23 deletions
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 57fd4b921..a4711f5f1 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -584,18 +584,15 @@ public final class LauncherInstrumentation {
return mDevice;
}
- void swipe(int startX, int startY, int endX, int endY, int expectedState) {
- swipe(startX, startY, endX, endY, expectedState, 60);
- }
-
- void swipe(int startX, int startY, int endX, int endY, int expectedState, int steps) {
- changeStateViaGesture(startX, startY, endX, endY, expectedState,
- () -> mDevice.swipe(startX, startY, endX, endY, steps));
- }
-
void swipeToState(int startX, int startY, int endX, int endY, int steps, int expectedState) {
- changeStateViaGesture(startX, startY, endX, endY, expectedState,
- () -> linearGesture(startX, startY, endX, endY, steps));
+ final Bundle parcel = (Bundle) executeAndWaitForEvent(
+ () -> linearGesture(startX, startY, endX, endY, steps),
+ event -> TestProtocol.SWITCHED_TO_STATE_MESSAGE.equals(event.getClassName()),
+ "Swipe failed to receive an event for the swipe end: " + startX + ", " + startY
+ + ", " + endX + ", " + endY);
+ assertEquals("Swipe switched launcher to a wrong state;",
+ TestProtocol.stateOrdinalToString(expectedState),
+ TestProtocol.stateOrdinalToString(parcel.getInt(TestProtocol.STATE_FIELD)));
}
void scroll(UiObject2 container, Direction direction, float percent, Rect margins, int steps) {
@@ -652,18 +649,6 @@ public final class LauncherInstrumentation {
sendPointer(downTime, endTime, MotionEvent.ACTION_UP, end);
}
- private void changeStateViaGesture(int startX, int startY, int endX, int endY,
- int expectedState, Runnable gesture) {
- final Bundle parcel = (Bundle) executeAndWaitForEvent(
- gesture,
- event -> TestProtocol.SWITCHED_TO_STATE_MESSAGE.equals(event.getClassName()),
- "Swipe failed to receive an event for the swipe end: " + startX + ", " + startY
- + ", " + endX + ", " + endY);
- assertEquals("Swipe switched launcher to a wrong state;",
- TestProtocol.stateOrdinalToString(expectedState),
- TestProtocol.stateOrdinalToString(parcel.getInt(TestProtocol.STATE_FIELD)));
- }
-
void waitForIdle() {
mDevice.waitForIdle();
}