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

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

Issue 13813006: Instant: Don't allow the page to set suggestions inappropriately. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 fbe3f0efe21271844312aa5cc1de117d418c00ed..7ddbfa59f8a3e10cee36e623f85d32954133d447 100644
--- a/chrome/browser/ui/search/instant_extended_browsertest.cc
+++ b/chrome/browser/ui/search/instant_extended_browsertest.cc
@@ -1429,3 +1429,22 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, LocalNTPIsNotLocalOverlay) {
EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl),
instant()->ntp_->contents()->GetURL());
}
+
+// Test that suggestions are not accepted when unexpected.
+IN_PROC_BROWSER_TEST_F(InstantExtendedTest, DeniesUnexpectedSuggestions) {
+ ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
+ FocusOmniboxAndWaitForInstantExtendedSupport();
+ SetOmniboxTextAndWaitForOverlayToShow("chip");
+ SendDownArrow();
+
+ EXPECT_EQ("result 1", GetOmniboxText());
+ EXPECT_EQ(ASCIIToUTF16(""), GetGrayText());
+
+ // Make the page send an unexpected suggestion.
+ EXPECT_TRUE(ExecuteScript("suggestion = 'chippies';"
+ "handleOnChange();"));
+
+ // Verify that the suggestion is ignored.
+ EXPECT_EQ("result 1", GetOmniboxText());
+ EXPECT_EQ(ASCIIToUTF16(""), GetGrayText());
+}

Powered by Google App Engine
This is Rietveld 408576698