| Index: content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java
|
| diff --git a/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java b/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java
|
| index 235e4a3f391c88a56fafd732effbc803cce4794c..418cb952cb00c946b4d02f7980e36bfd41cb4145 100644
|
| --- a/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java
|
| +++ b/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java
|
| @@ -153,6 +153,27 @@ public class DOMUtils {
|
| }
|
|
|
| /**
|
| + * Get the id of the currently focused node.
|
| + */
|
| + public static String getFocusedNode(WebContents webContents)
|
| + throws InterruptedException, TimeoutException {
|
| + StringBuilder sb = new StringBuilder();
|
| + sb.append("(function() {");
|
| + sb.append(" var node = document.activeElement;");
|
| + sb.append(" if (!node) return null;");
|
| + sb.append(" return node.id;");
|
| + sb.append("})();");
|
| +
|
| + String id = JavaScriptUtils.executeJavaScriptAndWaitForResult(webContents, sb.toString());
|
| +
|
| + // String results from JavaScript includes surrounding quotes. Remove them.
|
| + if (id != null && id.length() >= 2 && id.charAt(0) == '"') {
|
| + id = id.substring(1, id.length() - 1);
|
| + }
|
| + return id;
|
| + }
|
| +
|
| + /**
|
| * Click a DOM node by its id.
|
| */
|
| public static void clickNode(ActivityInstrumentationTestCase2 activityTestCase,
|
|
|