Add testing facilities for traversing Gmail
message bodies to derive links.

BUG: 28719645
Change-Id: I8643d2c4dbbbb8df39e0ba2990d387e8d39ca4ec
diff --git a/libraries/base-app-helpers/src/android/platform/test/helpers/AbstractGmailHelper.java b/libraries/base-app-helpers/src/android/platform/test/helpers/AbstractGmailHelper.java
index ce36818..5f4b52f 100644
--- a/libraries/base-app-helpers/src/android/platform/test/helpers/AbstractGmailHelper.java
+++ b/libraries/base-app-helpers/src/android/platform/test/helpers/AbstractGmailHelper.java
@@ -19,6 +19,8 @@
 import android.app.Instrumentation;
 import android.support.test.uiautomator.Direction;
 
+import java.util.List;
+
 public abstract class AbstractGmailHelper extends AbstractStandardAppHelper {
 
     public AbstractGmailHelper(Instrumentation instr) {
@@ -193,4 +195,23 @@
      * @param index The index of the attachment to download
      */
     public abstract void downloadAttachment(int index);
+
+    /**
+     * Setup expectations: Gmail is open and an email is open.
+     *
+     * This method gets every link target in an open email by traversing the UI tree of the body
+     * of the open message.
+     *
+     * @return an iterator over the links in the message
+     */
+    public abstract List<String> getEmailLinks();
+
+    /**
+     * Setup expectations: Gmail is open and an email is open.
+     *
+     * This method clicks the link in the open email with the given target.
+     *
+     * @param target the target of the link to click
+     */
+    public abstract void openEmailLink(String target);
 }