summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/simulator/Simulator.java
diff options
context:
space:
mode:
authorsail <sail@google.com>2017-08-31 16:48:09 -0700
committerEric Erfanian <erfanian@google.com>2017-09-07 04:37:37 +0000
commit53e1ce35f713139629cb24df6ea1245e11464a42 (patch)
treebf94bb3fcbf38857e65c4637aa0dde6bd637868b /java/com/android/dialer/simulator/Simulator.java
parent273fd7bc5840a71cf8445455bc0bb1945e2cfc8d (diff)
Use simulator to add in-call UI integration tests
This CL uses the simulator connection service to perform integration tests for incallui. The main pieces of this CL are: - DialerCallEvent - this is how we track changes to the incallui calls - Simulator.Event - this is how we track changes to a simulator connection With the above two we can do things like: - block until a DialerCall switches from ACTIVE TO ONHOLD: - DialerCallEspresso.waitForNextEvent(tracker, call, new DialerCallEvent(STATE_CHANGE, "ACTIVE", "ONHOLD") - block for a connection to recive a particular DTMF code: - SimulatorConnectionEspresso.waitForNextEvent(call, Event.DTMF) Future CLs will include things like: - fling to answer / reject - conference calls - screenshot diffing - video calling Test: InCallActivityTest PiperOrigin-RevId: 167211015 Change-Id: Ib013b10fe963092fad0816b07b1659efd69d9468
Diffstat (limited to 'java/com/android/dialer/simulator/Simulator.java')
-rw-r--r--java/com/android/dialer/simulator/Simulator.java48
1 files changed, 48 insertions, 0 deletions
diff --git a/java/com/android/dialer/simulator/Simulator.java b/java/com/android/dialer/simulator/Simulator.java
index 78058a48f..f4164158e 100644
--- a/java/com/android/dialer/simulator/Simulator.java
+++ b/java/com/android/dialer/simulator/Simulator.java
@@ -17,11 +17,59 @@
package com.android.dialer.simulator;
import android.content.Context;
+import android.support.annotation.IntDef;
+import android.support.annotation.Nullable;
import android.view.ActionProvider;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
/** Used to add menu items to the Dialer menu to test the app using simulated calls and data. */
public interface Simulator {
boolean shouldShow();
ActionProvider getActionProvider(Context context);
+
+ /** Information about a connection event. */
+ public static class Event {
+ /** The type of connection event. */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef({
+ NONE,
+ ANSWER,
+ REJECT,
+ HOLD,
+ UNHOLD,
+ DISCONNECT,
+ STATE_CHANGE,
+ DTMF,
+ })
+ public @interface Type {}
+
+ public static final int NONE = -1;
+ public static final int ANSWER = 1;
+ public static final int REJECT = 2;
+ public static final int HOLD = 3;
+ public static final int UNHOLD = 4;
+ public static final int DISCONNECT = 5;
+ public static final int STATE_CHANGE = 6;
+ public static final int DTMF = 7;
+
+ @Type public final int type;
+ /** Holds event specific information. For example, for DTMF this could be the keycode. */
+ @Nullable public final String data1;
+ /**
+ * Holds event specific information. For example, for STATE_CHANGE this could be the new state.
+ */
+ @Nullable public final String data2;
+
+ public Event(@Type int type) {
+ this(type, null, null);
+ }
+
+ public Event(@Type int type, String data1, String data2) {
+ this.type = type;
+ this.data1 = data1;
+ this.data2 = data2;
+ }
+ }
}