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

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

Issue 1170363003: Do not update the url text while in batch edit mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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_staging/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 e9a413312d7c838faf8752705656e8315314c7af..a8f23125efa1e2997bd54a330855d784b7c2558f 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
@@ -264,6 +264,43 @@ public class UrlBarTest extends ChromeActivityTestCaseBase<ChromeActivity> {
@SmallTest
@Feature({"Omnibox"})
+ public void testSelectionChangesIgnoredInBatchMode() throws InterruptedException {
+ startMainActivityOnBlankPage();
+ stubLocationBarAutocomplete();
+ final UrlBar urlBar = getUrlBar();
+ OmniboxTestUtils.toggleUrlBarFocus(urlBar, true);
+
+ setTextAndVerifyNoAutocomplete(urlBar, "test");
+ setAutocomplete(urlBar, "test", "ing is fun");
+
+ ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+ @Override
+ public void run() {
+ urlBar.beginBatchEdit();
+ }
+ });
+ // Ensure the autocomplete is not modified if in batch mode.
+ AutocompleteState state = setSelection(urlBar, 1, 1);
+ assertTrue(state.hasAutocomplete);
+ assertEquals("test", state.textWithoutAutocomplete);
+ assertEquals("testing is fun", state.textWithAutocomplete);
+ ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+ @Override
+ public void run() {
+ urlBar.endBatchEdit();
+ }
+ });
+
+ // Ensure that after batch mode has ended that the autocomplete is cleared due to the
+ // invalid selection range.
+ state = getAutocompleteState(urlBar, null);
+ assertFalse(state.hasAutocomplete);
+ assertEquals("test", state.textWithoutAutocomplete);
+ assertEquals("test", state.textWithAutocomplete);
+ }
+
+ @SmallTest
+ @Feature({"Omnibox"})
public void testAutocompleteUpdatedOnDefocus() throws InterruptedException {
startMainActivityOnBlankPage();
stubLocationBarAutocomplete();
« no previous file with comments | « chrome/android/java_staging/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