| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 #include "components/history/core/browser/history_service.h" | 49 #include "components/history/core/browser/history_service.h" |
| 50 #include "components/history/core/browser/history_types.h" | 50 #include "components/history/core/browser/history_types.h" |
| 51 #include "components/history/core/browser/top_sites.h" | 51 #include "components/history/core/browser/top_sites.h" |
| 52 #include "components/history/core/common/thumbnail_score.h" | 52 #include "components/history/core/common/thumbnail_score.h" |
| 53 #include "components/omnibox/browser/autocomplete_controller.h" | 53 #include "components/omnibox/browser/autocomplete_controller.h" |
| 54 #include "components/omnibox/browser/autocomplete_match.h" | 54 #include "components/omnibox/browser/autocomplete_match.h" |
| 55 #include "components/omnibox/browser/autocomplete_provider.h" | 55 #include "components/omnibox/browser/autocomplete_provider.h" |
| 56 #include "components/omnibox/browser/autocomplete_result.h" | 56 #include "components/omnibox/browser/autocomplete_result.h" |
| 57 #include "components/omnibox/browser/omnibox_field_trial.h" | 57 #include "components/omnibox/browser/omnibox_field_trial.h" |
| 58 #include "components/omnibox/browser/search_provider.h" | 58 #include "components/omnibox/browser/search_provider.h" |
| 59 #include "components/search/search.h" |
| 59 #include "components/search_engines/template_url_service.h" | 60 #include "components/search_engines/template_url_service.h" |
| 60 #include "components/sessions/serialized_navigation_entry.h" | 61 #include "components/sessions/serialized_navigation_entry.h" |
| 61 #include "content/public/browser/navigation_controller.h" | 62 #include "content/public/browser/navigation_controller.h" |
| 62 #include "content/public/browser/navigation_entry.h" | 63 #include "content/public/browser/navigation_entry.h" |
| 63 #include "content/public/browser/notification_service.h" | 64 #include "content/public/browser/notification_service.h" |
| 64 #include "content/public/browser/render_process_host.h" | 65 #include "content/public/browser/render_process_host.h" |
| 65 #include "content/public/browser/render_view_host.h" | 66 #include "content/public/browser/render_view_host.h" |
| 66 #include "content/public/browser/site_instance.h" | 67 #include "content/public/browser/site_instance.h" |
| 67 #include "content/public/browser/url_data_source.h" | 68 #include "content/public/browser/url_data_source.h" |
| 68 #include "content/public/browser/web_contents.h" | 69 #include "content/public/browser/web_contents.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 on_native_suggestions_calls_(0), | 134 on_native_suggestions_calls_(0), |
| 134 on_change_calls_(0), | 135 on_change_calls_(0), |
| 135 submit_count_(0), | 136 submit_count_(0), |
| 136 on_esc_key_press_event_calls_(0), | 137 on_esc_key_press_event_calls_(0), |
| 137 on_focus_changed_calls_(0), | 138 on_focus_changed_calls_(0), |
| 138 is_focused_(false), | 139 is_focused_(false), |
| 139 on_toggle_voice_search_calls_(0) { | 140 on_toggle_voice_search_calls_(0) { |
| 140 } | 141 } |
| 141 protected: | 142 protected: |
| 142 void SetUpInProcessBrowserTestFixture() override { | 143 void SetUpInProcessBrowserTestFixture() override { |
| 143 chrome::EnableQueryExtractionForTesting(); | 144 search::EnableQueryExtractionForTesting(); |
| 144 ASSERT_TRUE(https_test_server().Start()); | 145 ASSERT_TRUE(https_test_server().Start()); |
| 145 GURL instant_url = https_test_server().GetURL( | 146 GURL instant_url = https_test_server().GetURL( |
| 146 "files/instant_extended.html?strk=1&"); | 147 "files/instant_extended.html?strk=1&"); |
| 147 GURL ntp_url = https_test_server().GetURL( | 148 GURL ntp_url = https_test_server().GetURL( |
| 148 "files/instant_extended_ntp.html?strk=1&"); | 149 "files/instant_extended_ntp.html?strk=1&"); |
| 149 InstantTestBase::Init(instant_url, ntp_url, false); | 150 InstantTestBase::Init(instant_url, ntp_url, false); |
| 150 } | 151 } |
| 151 | 152 |
| 152 int64 GetHistogramCount(const char* name) { | 153 int64 GetHistogramCount(const char* name) { |
| 153 base::HistogramBase* histogram = | 154 base::HistogramBase* histogram = |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 }; | 249 }; |
| 249 | 250 |
| 250 class InstantExtendedPrefetchTest : public InstantExtendedTest { | 251 class InstantExtendedPrefetchTest : public InstantExtendedTest { |
| 251 public: | 252 public: |
| 252 InstantExtendedPrefetchTest() | 253 InstantExtendedPrefetchTest() |
| 253 : factory_(new net::URLFetcherImplFactory()), | 254 : factory_(new net::URLFetcherImplFactory()), |
| 254 fake_factory_(new net::FakeURLFetcherFactory(factory_.get())) { | 255 fake_factory_(new net::FakeURLFetcherFactory(factory_.get())) { |
| 255 } | 256 } |
| 256 | 257 |
| 257 void SetUpInProcessBrowserTestFixture() override { | 258 void SetUpInProcessBrowserTestFixture() override { |
| 258 chrome::EnableQueryExtractionForTesting(); | 259 search::EnableQueryExtractionForTesting(); |
| 259 ASSERT_TRUE(https_test_server().Start()); | 260 ASSERT_TRUE(https_test_server().Start()); |
| 260 GURL instant_url = https_test_server().GetURL( | 261 GURL instant_url = https_test_server().GetURL( |
| 261 "files/instant_extended.html?strk=1&"); | 262 "files/instant_extended.html?strk=1&"); |
| 262 GURL ntp_url = https_test_server().GetURL( | 263 GURL ntp_url = https_test_server().GetURL( |
| 263 "files/instant_extended_ntp.html?strk=1&"); | 264 "files/instant_extended_ntp.html?strk=1&"); |
| 264 InstantTestBase::Init(instant_url, ntp_url, true); | 265 InstantTestBase::Init(instant_url, ntp_url, true); |
| 265 } | 266 } |
| 266 | 267 |
| 267 void SetUpCommandLine(base::CommandLine* command_line) override { | 268 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 268 command_line->AppendSwitchASCII( | 269 command_line->AppendSwitchASCII( |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 active_tab = browser()->tab_strip_model()->GetActiveWebContents(); | 744 active_tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 744 EXPECT_TRUE(active_tab->GetController().CanGoBack()); | 745 EXPECT_TRUE(active_tab->GetController().CanGoBack()); |
| 745 content::WindowedNotificationObserver load_stop_observer_2( | 746 content::WindowedNotificationObserver load_stop_observer_2( |
| 746 content::NOTIFICATION_LOAD_STOP, | 747 content::NOTIFICATION_LOAD_STOP, |
| 747 content::Source<content::NavigationController>( | 748 content::Source<content::NavigationController>( |
| 748 &active_tab->GetController())); | 749 &active_tab->GetController())); |
| 749 active_tab->GetController().GoBack(); | 750 active_tab->GetController().GoBack(); |
| 750 load_stop_observer_2.Wait(); | 751 load_stop_observer_2.Wait(); |
| 751 | 752 |
| 752 active_tab = browser()->tab_strip_model()->GetActiveWebContents(); | 753 active_tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 753 EXPECT_TRUE(chrome::IsInstantNTP(active_tab)); | 754 EXPECT_TRUE(search::IsInstantNTP(active_tab)); |
| 754 } | 755 } |
| 755 | 756 |
| 756 // Flaky: crbug.com/267119 | 757 // Flaky: crbug.com/267119 |
| 757 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, | 758 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, |
| 758 DISABLED_DispatchMVChangeEventWhileNavigatingBackToNTP) { | 759 DISABLED_DispatchMVChangeEventWhileNavigatingBackToNTP) { |
| 759 // Setup Instant. | 760 // Setup Instant. |
| 760 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); | 761 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| 761 FocusOmnibox(); | 762 FocusOmnibox(); |
| 762 | 763 |
| 763 // Open new tab. | 764 // Open new tab. |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 stream << "link.href = \"" << result_url.spec() << "\";"; | 974 stream << "link.href = \"" << result_url.spec() << "\";"; |
| 974 stream << "document.body.appendChild(link);"; | 975 stream << "document.body.appendChild(link);"; |
| 975 stream << "link.click();"; | 976 stream << "link.click();"; |
| 976 EXPECT_TRUE(content::ExecuteScript(contents, stream.str())); | 977 EXPECT_TRUE(content::ExecuteScript(contents, stream.str())); |
| 977 | 978 |
| 978 content::WaitForLoadStop(contents); | 979 content::WaitForLoadStop(contents); |
| 979 std::string expected_title = | 980 std::string expected_title = |
| 980 "Referrer is " + instant_url().GetWithEmptyPath().spec(); | 981 "Referrer is " + instant_url().GetWithEmptyPath().spec(); |
| 981 EXPECT_EQ(ASCIIToUTF16(expected_title), contents->GetTitle()); | 982 EXPECT_EQ(ASCIIToUTF16(expected_title), contents->GetTitle()); |
| 982 } | 983 } |
| OLD | NEW |