summaryrefslogtreecommitdiffstats
path: root/content/public/test
diff options
context:
space:
mode:
authormckev <mckev@amazon.com>2015-08-04 13:13:40 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-04 20:15:34 +0000
commitdffac136a0f11b67435d5f1c0898c53e653aa525 (patch)
tree6ddbd07858be1cdc76e16ebd44f11f833383fcfa /content/public/test
parent9bacb78d7d0a453ff5d23df7fd30b7b75cded17d (diff)
downloadchromium_src-dffac136a0f11b67435d5f1c0898c53e653aa525.zip
chromium_src-dffac136a0f11b67435d5f1c0898c53e653aa525.tar.gz
chromium_src-dffac136a0f11b67435d5f1c0898c53e653aa525.tar.bz2
Deflake IME tests for low-res devices
On devices with very low screen real estate, the IME tests can fail if the DOM nodes needed by the test aren't visible on-screen. In https://codereview.chromium.org/69243002, the page scale factor was arbitrarily set 2.0 because it is a non 1 value, which causes the DOM elements to be very large and fall off the screen in some cases. This adds a parameter to DOMUtils.clickNode and DOMUtils.longPressNode which first scrolls the intended node into view, which allows the tests to succeed regardless of screen size. BUG=513048 Review URL: https://codereview.chromium.org/1249153002 Cr-Commit-Position: refs/heads/master@{#341777}
Diffstat (limited to 'content/public/test')
-rw-r--r--content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java6
1 files changed, 4 insertions, 2 deletions
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 bca8774..51e64c6 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
@@ -194,7 +194,7 @@ public class DOMUtils {
}
/**
- * Click a DOM node by its id.
+ * Click a DOM node by its id, scrolling it into view first.
* @param activityTestCase The ActivityInstrumentationTestCase2 to instrument.
* @param viewCore The ContentViewCore in which the node lives.
* @param nodeId The id of the node.
@@ -202,12 +202,13 @@ public class DOMUtils {
public static void clickNode(ActivityInstrumentationTestCase2 activityTestCase,
final ContentViewCore viewCore, String nodeId)
throws InterruptedException, TimeoutException {
+ scrollNodeIntoView(viewCore.getWebContents(), nodeId);
int[] clickTarget = getClickTargetForNode(viewCore, nodeId);
TouchCommon.singleClickView(viewCore.getContainerView(), clickTarget[0], clickTarget[1]);
}
/**
- * Long-press a DOM node by its id.
+ * Long-press a DOM node by its id, scrolling it into view first.
* @param activityTestCase The ActivityInstrumentationTestCase2 to instrument.
* @param viewCore The ContentViewCore in which the node lives.
* @param nodeId The id of the node.
@@ -215,6 +216,7 @@ public class DOMUtils {
public static void longPressNode(ActivityInstrumentationTestCase2 activityTestCase,
final ContentViewCore viewCore, String nodeId)
throws InterruptedException, TimeoutException {
+ scrollNodeIntoView(viewCore.getWebContents(), nodeId);
String jsCode = "document.getElementById('" + nodeId + "')";
longPressNodeByJs(activityTestCase, viewCore, jsCode);
}