Loading tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +2 −2 Original line number Diff line number Diff line Loading @@ -428,7 +428,7 @@ public final class LauncherInstrumentation { if (sCheckingEvents) { sCheckingEvents = false; if (checkEvents) { final String eventMismatch = sEventChecker.verify(0); final String eventMismatch = sEventChecker.verify(0, false); if (eventMismatch != null) { message = message + ", having produced " + eventMismatch; } Loading Loading @@ -1311,7 +1311,7 @@ public final class LauncherInstrumentation { if (sCheckingEvents) { sCheckingEvents = false; if (mCheckEventsForSuccessfulGestures) { final String message = sEventChecker.verify(WAIT_TIME_MS); final String message = sEventChecker.verify(WAIT_TIME_MS, true); if (message != null) { checkForAnomaly(); Assert.fail(formatSystemHealthMessage( Loading tests/tapl/com/android/launcher3/tapl/LogEventChecker.java +10 −3 Original line number Diff line number Diff line Loading @@ -168,7 +168,7 @@ public class LogEventChecker { Log.d(TestProtocol.TAPL_EVENTS_TAG, mFinishCommand); } String verify(long waitForExpectedCountMs) { String verify(long waitForExpectedCountMs, boolean successfulGesture) { finishSync(waitForExpectedCountMs); final StringBuilder sb = new StringBuilder(); Loading @@ -179,7 +179,8 @@ public class LogEventChecker { List<String> actual = new ArrayList<>(mEvents.getNonNull(sequence)); Log.d(SKIP_EVENTS_TAG, "Verifying events"); final int mismatchPosition = getMismatchPosition(expectedEvents.getValue(), actual); hasMismatches = hasMismatches || mismatchPosition != -1; hasMismatches = hasMismatches || mismatchPosition != -1 && !ignoreMistatch(successfulGesture, sequence); formatSequenceWithMismatch( sb, sequence, Loading @@ -190,7 +191,8 @@ public class LogEventChecker { // Check for unexpected event sequences in the actual data. for (String actualNamedSequence : mEvents.keySet()) { if (!mExpectedEvents.containsKey(actualNamedSequence)) { hasMismatches = true; hasMismatches = hasMismatches || !ignoreMistatch(successfulGesture, actualNamedSequence); formatSequenceWithMismatch( sb, actualNamedSequence, Loading @@ -203,6 +205,11 @@ public class LogEventChecker { return hasMismatches ? "mismatching events: " + sb.toString() : null; } // Workaround for b/154157191 private static boolean ignoreMistatch(boolean successfulGesture, String sequence) { return TestProtocol.SEQUENCE_TIS.equals(sequence) && successfulGesture; } // If the list of actual events matches the list of expected events, returns -1, otherwise // the position of the mismatch. private static int getMismatchPosition(List<Pattern> expected, List<String> actual) { Loading Loading
tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +2 −2 Original line number Diff line number Diff line Loading @@ -428,7 +428,7 @@ public final class LauncherInstrumentation { if (sCheckingEvents) { sCheckingEvents = false; if (checkEvents) { final String eventMismatch = sEventChecker.verify(0); final String eventMismatch = sEventChecker.verify(0, false); if (eventMismatch != null) { message = message + ", having produced " + eventMismatch; } Loading Loading @@ -1311,7 +1311,7 @@ public final class LauncherInstrumentation { if (sCheckingEvents) { sCheckingEvents = false; if (mCheckEventsForSuccessfulGestures) { final String message = sEventChecker.verify(WAIT_TIME_MS); final String message = sEventChecker.verify(WAIT_TIME_MS, true); if (message != null) { checkForAnomaly(); Assert.fail(formatSystemHealthMessage( Loading
tests/tapl/com/android/launcher3/tapl/LogEventChecker.java +10 −3 Original line number Diff line number Diff line Loading @@ -168,7 +168,7 @@ public class LogEventChecker { Log.d(TestProtocol.TAPL_EVENTS_TAG, mFinishCommand); } String verify(long waitForExpectedCountMs) { String verify(long waitForExpectedCountMs, boolean successfulGesture) { finishSync(waitForExpectedCountMs); final StringBuilder sb = new StringBuilder(); Loading @@ -179,7 +179,8 @@ public class LogEventChecker { List<String> actual = new ArrayList<>(mEvents.getNonNull(sequence)); Log.d(SKIP_EVENTS_TAG, "Verifying events"); final int mismatchPosition = getMismatchPosition(expectedEvents.getValue(), actual); hasMismatches = hasMismatches || mismatchPosition != -1; hasMismatches = hasMismatches || mismatchPosition != -1 && !ignoreMistatch(successfulGesture, sequence); formatSequenceWithMismatch( sb, sequence, Loading @@ -190,7 +191,8 @@ public class LogEventChecker { // Check for unexpected event sequences in the actual data. for (String actualNamedSequence : mEvents.keySet()) { if (!mExpectedEvents.containsKey(actualNamedSequence)) { hasMismatches = true; hasMismatches = hasMismatches || !ignoreMistatch(successfulGesture, actualNamedSequence); formatSequenceWithMismatch( sb, actualNamedSequence, Loading @@ -203,6 +205,11 @@ public class LogEventChecker { return hasMismatches ? "mismatching events: " + sb.toString() : null; } // Workaround for b/154157191 private static boolean ignoreMistatch(boolean successfulGesture, String sequence) { return TestProtocol.SEQUENCE_TIS.equals(sequence) && successfulGesture; } // If the list of actual events matches the list of expected events, returns -1, otherwise // the position of the mismatch. private static int getMismatchPosition(List<Pattern> expected, List<String> actual) { Loading