| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 on_native_suggestions_calls_(0), | 148 on_native_suggestions_calls_(0), |
| 149 on_change_calls_(0), | 149 on_change_calls_(0), |
| 150 submit_count_(0), | 150 submit_count_(0), |
| 151 on_esc_key_press_event_calls_(0), | 151 on_esc_key_press_event_calls_(0), |
| 152 on_focus_changed_calls_(0), | 152 on_focus_changed_calls_(0), |
| 153 is_focused_(false), | 153 is_focused_(false), |
| 154 on_toggle_voice_search_calls_(0) { | 154 on_toggle_voice_search_calls_(0) { |
| 155 } | 155 } |
| 156 protected: | 156 protected: |
| 157 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 157 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 158 chrome::EnableInstantExtendedAPIForTesting(); | 158 chrome::EnableQueryExtractionForTesting(); |
| 159 ASSERT_TRUE(https_test_server().Start()); | 159 ASSERT_TRUE(https_test_server().Start()); |
| 160 GURL instant_url = https_test_server().GetURL( | 160 GURL instant_url = https_test_server().GetURL( |
| 161 "files/instant_extended.html?strk=1&"); | 161 "files/instant_extended.html?strk=1&"); |
| 162 InstantTestBase::Init(instant_url, false); | 162 InstantTestBase::Init(instant_url, false); |
| 163 } | 163 } |
| 164 | 164 |
| 165 int64 GetHistogramCount(const char* name) { | 165 int64 GetHistogramCount(const char* name) { |
| 166 base::HistogramBase* histogram = | 166 base::HistogramBase* histogram = |
| 167 base::StatisticsRecorder::FindHistogram(name); | 167 base::StatisticsRecorder::FindHistogram(name); |
| 168 if (!histogram) { | 168 if (!histogram) { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 }; | 274 }; |
| 275 | 275 |
| 276 class InstantExtendedPrefetchTest : public InstantExtendedTest { | 276 class InstantExtendedPrefetchTest : public InstantExtendedTest { |
| 277 public: | 277 public: |
| 278 InstantExtendedPrefetchTest() | 278 InstantExtendedPrefetchTest() |
| 279 : factory_(new net::URLFetcherImplFactory()), | 279 : factory_(new net::URLFetcherImplFactory()), |
| 280 fake_factory_(new net::FakeURLFetcherFactory(factory_.get())) { | 280 fake_factory_(new net::FakeURLFetcherFactory(factory_.get())) { |
| 281 } | 281 } |
| 282 | 282 |
| 283 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 283 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 284 chrome::EnableInstantExtendedAPIForTesting(); | 284 chrome::EnableQueryExtractionForTesting(); |
| 285 ASSERT_TRUE(https_test_server().Start()); | 285 ASSERT_TRUE(https_test_server().Start()); |
| 286 GURL instant_url = https_test_server().GetURL( | 286 GURL instant_url = https_test_server().GetURL( |
| 287 "files/instant_extended.html?strk=1&"); | 287 "files/instant_extended.html?strk=1&"); |
| 288 InstantTestBase::Init(instant_url, true); | 288 InstantTestBase::Init(instant_url, true); |
| 289 } | 289 } |
| 290 | 290 |
| 291 net::FakeURLFetcherFactory* fake_factory() { return fake_factory_.get(); } | 291 net::FakeURLFetcherFactory* fake_factory() { return fake_factory_.get(); } |
| 292 | 292 |
| 293 private: | 293 private: |
| 294 // Used to instantiate FakeURLFetcherFactory. | 294 // Used to instantiate FakeURLFetcherFactory. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 325 | 325 |
| 326 // Test class used to verify chrome-search: scheme and access policy from the | 326 // Test class used to verify chrome-search: scheme and access policy from the |
| 327 // Instant overlay. This is a subclass of |ExtensionBrowserTest| because it | 327 // Instant overlay. This is a subclass of |ExtensionBrowserTest| because it |
| 328 // loads a theme that provides a background image. | 328 // loads a theme that provides a background image. |
| 329 class InstantPolicyTest : public ExtensionBrowserTest, public InstantTestBase { | 329 class InstantPolicyTest : public ExtensionBrowserTest, public InstantTestBase { |
| 330 public: | 330 public: |
| 331 InstantPolicyTest() {} | 331 InstantPolicyTest() {} |
| 332 | 332 |
| 333 protected: | 333 protected: |
| 334 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 334 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 335 chrome::EnableInstantExtendedAPIForTesting(); | |
| 336 ASSERT_TRUE(https_test_server().Start()); | 335 ASSERT_TRUE(https_test_server().Start()); |
| 337 GURL instant_url = https_test_server().GetURL( | 336 GURL instant_url = https_test_server().GetURL( |
| 338 "files/instant_extended.html?strk=1&"); | 337 "files/instant_extended.html?strk=1&"); |
| 339 InstantTestBase::Init(instant_url, false); | 338 InstantTestBase::Init(instant_url, false); |
| 340 } | 339 } |
| 341 | 340 |
| 342 void InstallThemeSource() { | 341 void InstallThemeSource() { |
| 343 ThemeSource* theme = new ThemeSource(profile()); | 342 ThemeSource* theme = new ThemeSource(profile()); |
| 344 content::URLDataSource::Add(profile(), theme); | 343 content::URLDataSource::Add(profile(), theme); |
| 345 } | 344 } |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1036 stream << "link.href = \"" << result_url.spec() << "\";"; | 1035 stream << "link.href = \"" << result_url.spec() << "\";"; |
| 1037 stream << "document.body.appendChild(link);"; | 1036 stream << "document.body.appendChild(link);"; |
| 1038 stream << "link.click();"; | 1037 stream << "link.click();"; |
| 1039 EXPECT_TRUE(content::ExecuteScript(contents, stream.str())); | 1038 EXPECT_TRUE(content::ExecuteScript(contents, stream.str())); |
| 1040 | 1039 |
| 1041 content::WaitForLoadStop(contents); | 1040 content::WaitForLoadStop(contents); |
| 1042 std::string expected_title = | 1041 std::string expected_title = |
| 1043 "Referrer is " + instant_url().GetWithEmptyPath().spec(); | 1042 "Referrer is " + instant_url().GetWithEmptyPath().spec(); |
| 1044 EXPECT_EQ(ASCIIToUTF16(expected_title), contents->GetTitle()); | 1043 EXPECT_EQ(ASCIIToUTF16(expected_title), contents->GetTitle()); |
| 1045 } | 1044 } |
| OLD | NEW |