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

Unified Diff: chrome/browser/ui/search/instant_extended_browsertest.cc

Issue 13141002: Use Instant suggested match type for Instant temporary text. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
Index: chrome/browser/ui/search/instant_extended_browsertest.cc
diff --git a/chrome/browser/ui/search/instant_extended_browsertest.cc b/chrome/browser/ui/search/instant_extended_browsertest.cc
index 3bfeb77f672bc69d825a0f9a724e7d26d86aef8e..8b486e037c64d89f5f4a7107efaef2593c698d0e 100644
--- a/chrome/browser/ui/search/instant_extended_browsertest.cc
+++ b/chrome/browser/ui/search/instant_extended_browsertest.cc
@@ -1355,3 +1355,45 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, AutocompleteProvidersDone) {
EXPECT_TRUE(UpdateSearchState(overlay));
EXPECT_EQ(1, on_native_suggestions_calls_);
}
+
+// Test that if Instant alters the input from URL to search, it's respected.
+IN_PROC_BROWSER_TEST_F(InstantExtendedTest, InputChangedFromURLToSearch) {
+ ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
+ FocusOmniboxAndWaitForInstantExtendedSupport();
+
+ content::WebContents* overlay = instant()->GetOverlayContents();
+ EXPECT_TRUE(ExecuteScript("suggestions = ['mcqueen.com'];"));
+
+ SetOmniboxTextAndWaitForOverlayToShow("lightning");
+ EXPECT_EQ("lightning", GetOmniboxText());
+
+ SendDownArrow();
+ EXPECT_EQ("mcqueen.com", GetOmniboxText());
+
+ // Press Enter.
+ browser()->window()->GetLocationBar()->AcceptInput();
+
+ // Confirm that the Instant overlay was committed.
+ EXPECT_EQ(overlay, browser()->tab_strip_model()->GetActiveWebContents());
+}
+
+// Test that if Instant alters the input from search to URL, it's respected.
+IN_PROC_BROWSER_TEST_F(InstantExtendedTest, InputChangedFromSearchToURL) {
+ ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
+ FocusOmniboxAndWaitForInstantExtendedSupport();
+
+ content::WebContents* overlay = instant()->GetOverlayContents();
+ EXPECT_TRUE(ExecuteScript("suggestionType = 1;")); // INSTANT_SUGGESTION_URL
+
+ SetOmniboxTextAndWaitForOverlayToShow("mack.com");
+ EXPECT_EQ("mack.com", GetOmniboxText());
+
+ SendDownArrow();
+ EXPECT_EQ("result 1", GetOmniboxText());
+
+ // Press Enter.
+ browser()->window()->GetLocationBar()->AcceptInput();
+
+ // Confirm that the Instant overlay was NOT committed.
+ EXPECT_NE(overlay, browser()->tab_strip_model()->GetActiveWebContents());
+}

Powered by Google App Engine
This is Rietveld 408576698