Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1316)

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java

Issue 1239583003: Update touch selection notification names, add ESTABLISHED. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add new SelectionEventTypes for bounds changing instead of reusing an insertion event. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java
index 4c9bd963185374f319246dffdad67c4effab5969..f8381713bd35dbc7c7b83ea977d7b80aba13fa88 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java
@@ -391,6 +391,21 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
}
/**
+ * Waits for the selection bounds to resolve.
+ * This is needed because the renderer's notification of a selection going away is async,
+ * and a subsequent tap may think there's a current selection until the bounds have dissolved.
+ */
+ private void waitForSelectionBoundsDissolved() throws InterruptedException {
+ assertTrue("Selection never cleared.",
+ CriteriaHelper.pollForCriteria(new Criteria() {
+ @Override
+ public boolean isSatisfied() {
+ return mSelectionController.isSelectionBoundsDissolved();
+ }
+ }, TEST_TIMEOUT, DEFAULT_POLLING_INTERVAL));
+ }
+
+ /**
* A ContentViewCore that has some methods stubbed out for testing.
*/
private static final class StubbedContentViewCore extends ContentViewCore {
@@ -1791,4 +1806,23 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
longPressNode("states-far");
waitForPanelToPeekAndAssert();
}
+
+ /**
+ * Tests a bunch of taps in a row.
+ * We've had reliability problems with simple taps due to async clearing
+ * of selection bounds, so this helps prevent a regression with that.
+ */
+ @Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
+ @CommandLineFlags.Add({
+ ContextualSearchFieldTrial.TAP_RESOLVE_LIMIT_FOR_DECIDED + "=200",
+ ContextualSearchFieldTrial.TAP_RESOLVE_LIMIT_FOR_UNDECIDED + "=200",
+ ContextualSearchFieldTrial.TAP_PREFETCH_LIMIT_FOR_DECIDED + "=200",
+ ContextualSearchFieldTrial.TAP_PREFETCH_LIMIT_FOR_UNDECIDED + "=200"})
+ public void testTapALot() throws InterruptedException, TimeoutException {
+ for (int i = 0; i < 50; i++) {
+ clickToTriggerSearchTermResolution();
+ waitForSelectionBoundsDissolved();
+ assertSearchTermRequested();
+ }
+ }
}

Powered by Google App Engine
This is Rietveld 408576698