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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/UrlBarTest.java

Issue 1845033002: Ensure omnibox suggestions are regenerated when deleting the inline autocomplete. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address newt@ comments Created 4 years, 9 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
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/UrlBarTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/UrlBarTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/UrlBarTest.java
index 68f9ea04cd25ad74fe39915a61af30a7821c7def..393f6ff5c9ad0028bd3ab897f2c0f2dfb3b92727 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/UrlBarTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/UrlBarTest.java
@@ -11,6 +11,7 @@ import android.content.Intent;
import android.test.suitebuilder.annotation.SmallTest;
import android.text.Editable;
import android.text.TextUtils;
+import android.view.KeyEvent;
import android.view.inputmethod.BaseInputConnection;
import org.chromium.base.ThreadUtils;
@@ -24,6 +25,7 @@ import org.chromium.chrome.test.util.OmniboxTestUtils.StubAutocompleteController
import org.chromium.content.browser.test.util.CallbackHelper;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
+import org.chromium.content.browser.test.util.KeyUtils;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
@@ -342,6 +344,52 @@ public class UrlBarTest extends ChromeActivityTestCaseBase<ChromeActivity> {
didPreventInlineAutocomplete.get());
}
+ /**
+ * Ensure that if the user deletes just the inlined autocomplete text that the suggestions are
+ * regenerated.
+ */
+ @SmallTest
+ @Feature({"Omnibox"})
+ public void testSuggestionsUpdatedWhenDeletingInlineAutocomplete()
+ throws InterruptedException, TimeoutException {
+ startMainActivityOnBlankPage();
+
+ stubLocationBarAutocomplete();
+ final UrlBar urlBar = getUrlBar();
+ OmniboxTestUtils.toggleUrlBarFocus(urlBar, true);
+
+ setTextAndVerifyNoAutocomplete(urlBar, "test");
+ setAutocomplete(urlBar, "test", "ing");
+
+ final CallbackHelper autocompleteHelper = new CallbackHelper();
+ final AtomicBoolean didPreventInlineAutocomplete = new AtomicBoolean();
+ final StubAutocompleteController controller = new StubAutocompleteController() {
+ @Override
+ public void start(Profile profile, String url, String text, int cursorPosition,
+ boolean preventInlineAutocomplete) {
+ if (!TextUtils.equals("test", text)) return;
+ if (autocompleteHelper.getCallCount() != 0) return;
+
+ didPreventInlineAutocomplete.set(preventInlineAutocomplete);
+ autocompleteHelper.notifyCalled();
+ }
+ };
+ setAutocompleteController(controller);
+
+ KeyUtils.singleKeyEventView(getInstrumentation(), urlBar, KeyEvent.KEYCODE_DEL);
+
+ CriteriaHelper.pollUiThread(Criteria.equals("test", new Callable<String>() {
+ @Override
+ public String call() throws Exception {
+ return urlBar.getText().toString();
+ }
+ }));
+
+ autocompleteHelper.waitForCallback(0);
+ assertTrue("Inline autocomplete incorrectly allowed after delete.",
+ didPreventInlineAutocomplete.get());
+ }
+
@SmallTest
@Feature({"Omnibox"})
public void testSelectionChangesIgnoredInBatchMode() throws InterruptedException {
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698