Loading src/com/android/launcher3/TestProtocol.java +21 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,27 @@ public final class TestProtocol { public static final int ALL_APPS_STATE_ORDINAL = 5; public static final int BACKGROUND_APP_STATE_ORDINAL = 6; public static String stateOrdinalToString(int ordinal) { switch (ordinal) { case NORMAL_STATE_ORDINAL: return "Normal"; case SPRING_LOADED_STATE_ORDINAL: return "SpringLoaded"; case OVERVIEW_STATE_ORDINAL: return "Overview"; case OVERVIEW_PEEK_STATE_ORDINAL: return "OverviewPeek"; case QUICK_SWITCH_STATE_ORDINAL: return "QuickSwitch"; case ALL_APPS_STATE_ORDINAL: return "AllApps"; case BACKGROUND_APP_STATE_ORDINAL: return "Background"; default: return null; } } public static final String TEST_INFO_RESPONSE_FIELD = "response"; public static final String REQUEST_HOME_TO_OVERVIEW_SWIPE_HEIGHT = "home-to-overview-swipe-height"; Loading tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +10 −2 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.os.Build; import android.os.Bundle; import android.os.Parcelable; import android.os.SystemClock; import android.text.TextUtils; import android.util.Log; import android.view.InputDevice; import android.view.MotionEvent; Loading Loading @@ -225,6 +226,12 @@ public final class LauncherInstrumentation { } } private void assertEquals(String message, String expected, String actual) { if (!TextUtils.equals(expected, actual)) { fail(message + " expected: '" + expected + "' but was: '" + actual + "'"); } } void assertNotEquals(String message, int unexpected, int actual) { if (unexpected == actual) { failEquals(message, actual); Loading Loading @@ -539,8 +546,9 @@ public final class LauncherInstrumentation { 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", expectedState, parcel.getInt(TestProtocol.STATE_FIELD)); assertEquals("Swipe switched launcher to a wrong state;", TestProtocol.stateOrdinalToString(expectedState), TestProtocol.stateOrdinalToString(parcel.getInt(TestProtocol.STATE_FIELD))); } void waitForIdle() { Loading Loading
src/com/android/launcher3/TestProtocol.java +21 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,27 @@ public final class TestProtocol { public static final int ALL_APPS_STATE_ORDINAL = 5; public static final int BACKGROUND_APP_STATE_ORDINAL = 6; public static String stateOrdinalToString(int ordinal) { switch (ordinal) { case NORMAL_STATE_ORDINAL: return "Normal"; case SPRING_LOADED_STATE_ORDINAL: return "SpringLoaded"; case OVERVIEW_STATE_ORDINAL: return "Overview"; case OVERVIEW_PEEK_STATE_ORDINAL: return "OverviewPeek"; case QUICK_SWITCH_STATE_ORDINAL: return "QuickSwitch"; case ALL_APPS_STATE_ORDINAL: return "AllApps"; case BACKGROUND_APP_STATE_ORDINAL: return "Background"; default: return null; } } public static final String TEST_INFO_RESPONSE_FIELD = "response"; public static final String REQUEST_HOME_TO_OVERVIEW_SWIPE_HEIGHT = "home-to-overview-swipe-height"; Loading
tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +10 −2 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.os.Build; import android.os.Bundle; import android.os.Parcelable; import android.os.SystemClock; import android.text.TextUtils; import android.util.Log; import android.view.InputDevice; import android.view.MotionEvent; Loading Loading @@ -225,6 +226,12 @@ public final class LauncherInstrumentation { } } private void assertEquals(String message, String expected, String actual) { if (!TextUtils.equals(expected, actual)) { fail(message + " expected: '" + expected + "' but was: '" + actual + "'"); } } void assertNotEquals(String message, int unexpected, int actual) { if (unexpected == actual) { failEquals(message, actual); Loading Loading @@ -539,8 +546,9 @@ public final class LauncherInstrumentation { 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", expectedState, parcel.getInt(TestProtocol.STATE_FIELD)); assertEquals("Swipe switched launcher to a wrong state;", TestProtocol.stateOrdinalToString(expectedState), TestProtocol.stateOrdinalToString(parcel.getInt(TestProtocol.STATE_FIELD))); } void waitForIdle() { Loading