Chromium Code Reviews| 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 aebd5781a011eea21ac53c382e3438f9a6de9966..959ce82b83aa6dc2e900304aee4fe75b86bda4c7 100644 |
| --- a/chrome/browser/ui/search/instant_extended_browsertest.cc |
| +++ b/chrome/browser/ui/search/instant_extended_browsertest.cc |
| @@ -7,6 +7,7 @@ |
| #include "base/prefs/pref_service.h" |
| #include "base/string_util.h" |
| #include "base/stringprintf.h" |
| +#include "base/strings/string_number_conversions.h" |
| #include "base/utf_string_conversions.h" |
| #include "chrome/browser/autocomplete/autocomplete_controller.h" |
| #include "chrome/browser/autocomplete/autocomplete_match.h" |
| @@ -811,6 +812,43 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, ProcessIsolation) { |
| active_tab->GetRenderProcessHost()->GetID())); |
| } |
| +// Test that a search query will not be displayed for navsuggest queries. |
| +IN_PROC_BROWSER_TEST_F( |
| + InstantExtendedTest, SearchQueryNotDisplayedForNavsuggest) { |
| + ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| + FocusOmniboxAndWaitForInstantExtendedSupport(); |
| + EXPECT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
| + |
| + // Typing in the omnibox should show the overlay. |
| + SetOmniboxTextAndWaitForOverlayToShow("cnn.com"); |
| + |
| + // Create an event listener that opens the top suggestion in a new tab. |
| + content::WebContents* overlay = instant()->GetOverlayContents(); |
| + int i = 0; |
| + while (true) { |
| + std::string nativeSuggestionsAtIndex = |
| + "chrome.embeddedSearch.searchBox.nativeSuggestions[" + |
| + base::IntToString(i) + "]"; |
| + |
| + if (!ExecuteScript(nativeSuggestionsAtIndex)) |
| + break; |
| + |
| + if (ExecuteScript(nativeSuggestionsAtIndex+".is_search")) { |
| + bool is_search; |
| + EXPECT_TRUE(GetBoolFromJS( |
| + overlay, nativeSuggestionsAtIndex+".is_search", &is_search)); |
| + |
| + std::string type; |
| + EXPECT_TRUE( |
| + GetStringFromJS(overlay, nativeSuggestionsAtIndex+".type", &type)); |
| + |
| + EXPECT_FALSE(is_search && type == "navsuggest"); |
| + } |
| + |
| + ++i; |
| + } |
| +} |
|
sreeram
2013/04/18 17:51:40
This test uses the server overlay. We don't send a
dougw
2013/04/19 01:11:09
Done.
|
| + |
| // Verification of fix for BUG=176365. Ensure that each Instant WebContents in |
| // a tab uses a new BrowsingInstance, to avoid conflicts in the |
| // NavigationController. |