| 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/command_line.h" | 7 #include "base/command_line.h" | 
| 8 #include "base/metrics/histogram_base.h" | 8 #include "base/metrics/histogram_base.h" | 
| 9 #include "base/metrics/histogram_samples.h" | 9 #include "base/metrics/histogram_samples.h" | 
| 10 #include "base/metrics/statistics_recorder.h" | 10 #include "base/metrics/statistics_recorder.h" | 
| (...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1176   content::WebContents* active_tab = | 1176   content::WebContents* active_tab = | 
| 1177       browser()->tab_strip_model()->GetActiveWebContents(); | 1177       browser()->tab_strip_model()->GetActiveWebContents(); | 
| 1178   ASSERT_THAT(active_tab->GetURL().spec(), HasSubstr("q=flowers")); | 1178   ASSERT_THAT(active_tab->GetURL().spec(), HasSubstr("q=flowers")); | 
| 1179   ASSERT_TRUE(UpdateSearchState(active_tab)); | 1179   ASSERT_TRUE(UpdateSearchState(active_tab)); | 
| 1180   ASSERT_EQ(0, submit_count_); | 1180   ASSERT_EQ(0, submit_count_); | 
| 1181 | 1181 | 
| 1182   // Typed in a search URL "by hand". | 1182   // Typed in a search URL "by hand". | 
| 1183   content::WindowedNotificationObserver observer_2( | 1183   content::WindowedNotificationObserver observer_2( | 
| 1184       chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED, | 1184       chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED, | 
| 1185       content::NotificationService::AllSources()); | 1185       content::NotificationService::AllSources()); | 
| 1186   SetOmniboxText(instant_url().spec() + "#q=puppies"); | 1186   SetOmniboxText(instant_url().Resolve("#q=puppies").spec()); | 
| 1187   PressEnterAndWaitForNavigation(); | 1187   PressEnterAndWaitForNavigation(); | 
| 1188   observer_2.Wait(); | 1188   observer_2.Wait(); | 
| 1189 | 1189 | 
| 1190   // Should not have reused the tab. | 1190   // Should not have reused the tab. | 
| 1191   active_tab = browser()->tab_strip_model()->GetActiveWebContents(); | 1191   active_tab = browser()->tab_strip_model()->GetActiveWebContents(); | 
| 1192   ASSERT_THAT(active_tab->GetURL().spec(), HasSubstr("q=puppies")); | 1192   ASSERT_THAT(active_tab->GetURL().spec(), HasSubstr("q=puppies")); | 
| 1193 } | 1193 } | 
| 1194 | 1194 | 
| 1195 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, OmniboxMarginSetForSearchURLs) { | 1195 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, OmniboxMarginSetForSearchURLs) { | 
| 1196   ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); | 1196   ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); | 
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1699       CURRENT_TAB, | 1699       CURRENT_TAB, | 
| 1700       ui_test_utils::BROWSER_TEST_NONE); | 1700       ui_test_utils::BROWSER_TEST_NONE); | 
| 1701   new_tab_observer.Wait(); | 1701   new_tab_observer.Wait(); | 
| 1702 | 1702 | 
| 1703   omnibox()->model()->autocomplete_controller()->search_provider()-> | 1703   omnibox()->model()->autocomplete_controller()->search_provider()-> | 
| 1704       kMinimumTimeBetweenSuggestQueriesMs = 0; | 1704       kMinimumTimeBetweenSuggestQueriesMs = 0; | 
| 1705 | 1705 | 
| 1706   // Set the fake response for suggest request. Response has prefetch details. | 1706   // Set the fake response for suggest request. Response has prefetch details. | 
| 1707   // Ensure that the page received the prefetch query. | 1707   // Ensure that the page received the prefetch query. | 
| 1708   fake_factory()->SetFakeResponse( | 1708   fake_factory()->SetFakeResponse( | 
| 1709       instant_url().spec() + "#q=pupp", | 1709       instant_url().Resolve("#q=pupp"), | 
| 1710       "[\"pupp\",[\"puppy\", \"puppies\"],[],[]," | 1710       "[\"pupp\",[\"puppy\", \"puppies\"],[],[]," | 
| 1711       "{\"google:clientdata\":{\"phi\": 0}," | 1711       "{\"google:clientdata\":{\"phi\": 0}," | 
| 1712           "\"google:suggesttype\":[\"QUERY\", \"QUERY\"]," | 1712           "\"google:suggesttype\":[\"QUERY\", \"QUERY\"]," | 
| 1713           "\"google:suggestrelevance\":[1400, 9]}]", | 1713           "\"google:suggestrelevance\":[1400, 9]}]", | 
| 1714       true); | 1714       true); | 
| 1715 | 1715 | 
| 1716   SetOmniboxText("pupp"); | 1716   SetOmniboxText("pupp"); | 
| 1717   while (!omnibox()->model()->autocomplete_controller()->done()) { | 1717   while (!omnibox()->model()->autocomplete_controller()->done()) { | 
| 1718     content::WindowedNotificationObserver ready_observer( | 1718     content::WindowedNotificationObserver ready_observer( | 
| 1719         chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, | 1719         chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
| 1745       ui_test_utils::BROWSER_TEST_NONE); | 1745       ui_test_utils::BROWSER_TEST_NONE); | 
| 1746   new_tab_observer.Wait(); | 1746   new_tab_observer.Wait(); | 
| 1747 | 1747 | 
| 1748   omnibox()->model()->autocomplete_controller()->search_provider()-> | 1748   omnibox()->model()->autocomplete_controller()->search_provider()-> | 
| 1749       kMinimumTimeBetweenSuggestQueriesMs = 0; | 1749       kMinimumTimeBetweenSuggestQueriesMs = 0; | 
| 1750 | 1750 | 
| 1751   // Set the fake response for suggest request. Response has no prefetch | 1751   // Set the fake response for suggest request. Response has no prefetch | 
| 1752   // details. Ensure that the page received a blank query to clear the | 1752   // details. Ensure that the page received a blank query to clear the | 
| 1753   // prefetched results. | 1753   // prefetched results. | 
| 1754   fake_factory()->SetFakeResponse( | 1754   fake_factory()->SetFakeResponse( | 
| 1755       instant_url().spec() + "#q=dogs", | 1755       instant_url().Resolve("#q=dogs"), | 
| 1756       "[\"dogs\",[\"https://dogs.com\"],[],[]," | 1756       "[\"dogs\",[\"https://dogs.com\"],[],[]," | 
| 1757           "{\"google:suggesttype\":[\"NAVIGATION\"]," | 1757           "{\"google:suggesttype\":[\"NAVIGATION\"]," | 
| 1758           "\"google:suggestrelevance\":[2]}]", | 1758           "\"google:suggestrelevance\":[2]}]", | 
| 1759       true); | 1759       true); | 
| 1760 | 1760 | 
| 1761   SetOmniboxText("dogs"); | 1761   SetOmniboxText("dogs"); | 
| 1762   while (!omnibox()->model()->autocomplete_controller()->done()) { | 1762   while (!omnibox()->model()->autocomplete_controller()->done()) { | 
| 1763     content::WindowedNotificationObserver ready_observer( | 1763     content::WindowedNotificationObserver ready_observer( | 
| 1764         chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, | 1764         chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, | 
| 1765         content::Source<AutocompleteController>( | 1765         content::Source<AutocompleteController>( | 
| (...skipping 30 matching lines...) Expand all  Loading... | 
| 1796   EXPECT_EQ(ASCIIToUTF16("foo"), omnibox()->GetText()); | 1796   EXPECT_EQ(ASCIIToUTF16("foo"), omnibox()->GetText()); | 
| 1797 | 1797 | 
| 1798   // Calling ShowURL() should disable search term replacement and show the URL. | 1798   // Calling ShowURL() should disable search term replacement and show the URL. | 
| 1799   omnibox()->ShowURL(); | 1799   omnibox()->ShowURL(); | 
| 1800   EXPECT_FALSE(browser()->toolbar_model()->WouldPerformSearchTermReplacement( | 1800   EXPECT_FALSE(browser()->toolbar_model()->WouldPerformSearchTermReplacement( | 
| 1801       false)); | 1801       false)); | 
| 1802   // Don't bother looking for a specific URL; ensuring we're no longer showing | 1802   // Don't bother looking for a specific URL; ensuring we're no longer showing | 
| 1803   // the search terms is sufficient. | 1803   // the search terms is sufficient. | 
| 1804   EXPECT_NE(ASCIIToUTF16("foo"), omnibox()->GetText()); | 1804   EXPECT_NE(ASCIIToUTF16("foo"), omnibox()->GetText()); | 
| 1805 } | 1805 } | 
| OLD | NEW | 
|---|