| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <sstream> | 5 #include <sstream> |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 browser()->tab_strip_model()->GetActiveWebContents(); | 804 browser()->tab_strip_model()->GetActiveWebContents(); |
| 805 EXPECT_TRUE(instant_service->IsInstantProcess( | 805 EXPECT_TRUE(instant_service->IsInstantProcess( |
| 806 active_tab->GetRenderProcessHost()->GetID())); | 806 active_tab->GetRenderProcessHost()->GetID())); |
| 807 | 807 |
| 808 // Navigating elsewhere should not use the Instant render process. | 808 // Navigating elsewhere should not use the Instant render process. |
| 809 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIAboutURL)); | 809 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIAboutURL)); |
| 810 EXPECT_FALSE(instant_service->IsInstantProcess( | 810 EXPECT_FALSE(instant_service->IsInstantProcess( |
| 811 active_tab->GetRenderProcessHost()->GetID())); | 811 active_tab->GetRenderProcessHost()->GetID())); |
| 812 } | 812 } |
| 813 | 813 |
| 814 // Test that a search query will not be displayed for navsuggest queries. |
| 815 IN_PROC_BROWSER_TEST_F( |
| 816 InstantExtendedTest, SearchQueryNotDisplayedForNavsuggest) { |
| 817 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| 818 FocusOmniboxAndWaitForInstantExtendedSupport(); |
| 819 EXPECT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
| 820 |
| 821 // Typing in the omnibox should show the overlay. |
| 822 SetOmniboxTextAndWaitForOverlayToShow("cnn.com"); |
| 823 |
| 824 // Create an event listener that opens the top suggestion in a new tab. |
| 825 EXPECT_TRUE(ExecuteScript( |
| 826 "var suggestions = " |
| 827 "chrome.embeddedSearch.searchBox.nativeSuggestions;" |
| 828 "for (var i = 0, suggestion; suggestion = suggestions[i]; ++i) {" |
| 829 "if (suggestion.is_search && suggestion.type == 'navsuggest')" |
| 830 "return false;" |
| 831 "}" |
| 832 "return true;" |
| 833 )); |
| 834 } |
| 835 |
| 814 // Verification of fix for BUG=176365. Ensure that each Instant WebContents in | 836 // Verification of fix for BUG=176365. Ensure that each Instant WebContents in |
| 815 // a tab uses a new BrowsingInstance, to avoid conflicts in the | 837 // a tab uses a new BrowsingInstance, to avoid conflicts in the |
| 816 // NavigationController. | 838 // NavigationController. |
| 817 // Flaky: http://crbug.com/177516 | 839 // Flaky: http://crbug.com/177516 |
| 818 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, DISABLED_UnrelatedSiteInstance) { | 840 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, DISABLED_UnrelatedSiteInstance) { |
| 819 // Setup Instant. | 841 // Setup Instant. |
| 820 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); | 842 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| 821 FocusOmniboxAndWaitForInstantExtendedSupport(); | 843 FocusOmniboxAndWaitForInstantExtendedSupport(); |
| 822 | 844 |
| 823 // Check that the uncommited ntp page and uncommited overlay have unrelated | 845 // Check that the uncommited ntp page and uncommited overlay have unrelated |
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1660 EXPECT_EQ(ASCIIToUTF16(""), GetGrayText()); | 1682 EXPECT_EQ(ASCIIToUTF16(""), GetGrayText()); |
| 1661 | 1683 |
| 1662 // Make the page send an unexpected suggestion. | 1684 // Make the page send an unexpected suggestion. |
| 1663 EXPECT_TRUE(ExecuteScript("suggestion = 'chippies';" | 1685 EXPECT_TRUE(ExecuteScript("suggestion = 'chippies';" |
| 1664 "handleOnChange();")); | 1686 "handleOnChange();")); |
| 1665 | 1687 |
| 1666 // Verify that the suggestion is ignored. | 1688 // Verify that the suggestion is ignored. |
| 1667 EXPECT_EQ("result 1", GetOmniboxText()); | 1689 EXPECT_EQ("result 1", GetOmniboxText()); |
| 1668 EXPECT_EQ(ASCIIToUTF16(""), GetGrayText()); | 1690 EXPECT_EQ(ASCIIToUTF16(""), GetGrayText()); |
| 1669 } | 1691 } |
| OLD | NEW |