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()); |
+} |