Verifying events from TouchInteractionService

There is a guaranteed order in which TIS events will be registered
relative to other TIS events. However, relative to the touch events
arriving to the activity, TIS events can come in any order.

Now the event checker verifies 2 independent ordered event sequences:
from TIS, and “the rest” (Main).

Change-Id: I5872e0e3b0b498050a91c67105fbe4a29411375a
This commit is contained in:
vadimt
2020-02-07 11:46:03 -08:00
parent 70607cfe0a
commit d633c9c7da
19 changed files with 218 additions and 79 deletions
@@ -17,13 +17,30 @@
package com.android.launcher3.testing;
import android.util.Log;
import android.view.MotionEvent;
import com.android.launcher3.Utilities;
public final class TestLogging {
public static void recordEvent(String event) {
private static void recordEventSlow(String sequence, String event) {
Log.d(TestProtocol.TAPL_EVENTS_TAG, sequence + " / " + event);
}
public static void recordEvent(String sequence, String event) {
if (Utilities.IS_RUNNING_IN_TEST_HARNESS) {
Log.d(TestProtocol.TAPL_EVENTS_TAG, event);
recordEventSlow(sequence, event);
}
}
public static void recordEvent(String sequence, String message, Object parameter) {
if (Utilities.IS_RUNNING_IN_TEST_HARNESS) {
recordEventSlow(sequence, message + ": " + parameter);
}
}
public static void recordMotionEvent(String sequence, String message, MotionEvent event) {
if (Utilities.IS_RUNNING_IN_TEST_HARNESS && event.getAction() != MotionEvent.ACTION_MOVE) {
recordEventSlow(sequence, message + ": " + event);
}
}
}