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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 on_native_suggestions_calls_(0), | 141 on_native_suggestions_calls_(0), |
142 on_change_calls_(0), | 142 on_change_calls_(0), |
143 submit_count_(0), | 143 submit_count_(0), |
144 on_esc_key_press_event_calls_(0), | 144 on_esc_key_press_event_calls_(0), |
145 on_focus_changed_calls_(0), | 145 on_focus_changed_calls_(0), |
146 is_focused_(false), | 146 is_focused_(false), |
147 on_toggle_voice_search_calls_(0) { | 147 on_toggle_voice_search_calls_(0) { |
148 } | 148 } |
149 protected: | 149 protected: |
150 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 150 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
151 chrome::EnableInstantExtendedAPIForTesting(); | 151 chrome::EnableQueryExtractionForTesting(); |
152 ASSERT_TRUE(https_test_server().Start()); | 152 ASSERT_TRUE(https_test_server().Start()); |
153 GURL instant_url = https_test_server().GetURL( | 153 GURL instant_url = https_test_server().GetURL( |
154 "files/instant_extended.html?strk=1&"); | 154 "files/instant_extended.html?strk=1&"); |
155 InstantTestBase::Init(instant_url, false); | 155 InstantTestBase::Init(instant_url, false); |
156 } | 156 } |
157 | 157 |
158 int64 GetHistogramCount(const char* name) { | 158 int64 GetHistogramCount(const char* name) { |
159 base::HistogramBase* histogram = | 159 base::HistogramBase* histogram = |
160 base::StatisticsRecorder::FindHistogram(name); | 160 base::StatisticsRecorder::FindHistogram(name); |
161 if (!histogram) { | 161 if (!histogram) { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 }; | 267 }; |
268 | 268 |
269 class InstantExtendedPrefetchTest : public InstantExtendedTest { | 269 class InstantExtendedPrefetchTest : public InstantExtendedTest { |
270 public: | 270 public: |
271 InstantExtendedPrefetchTest() | 271 InstantExtendedPrefetchTest() |
272 : factory_(new net::URLFetcherImplFactory()), | 272 : factory_(new net::URLFetcherImplFactory()), |
273 fake_factory_(new net::FakeURLFetcherFactory(factory_.get())) { | 273 fake_factory_(new net::FakeURLFetcherFactory(factory_.get())) { |
274 } | 274 } |
275 | 275 |
276 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 276 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
277 chrome::EnableInstantExtendedAPIForTesting(); | 277 chrome::EnableQueryExtractionForTesting(); |
278 ASSERT_TRUE(https_test_server().Start()); | 278 ASSERT_TRUE(https_test_server().Start()); |
279 GURL instant_url = https_test_server().GetURL( | 279 GURL instant_url = https_test_server().GetURL( |
280 "files/instant_extended.html?strk=1&"); | 280 "files/instant_extended.html?strk=1&"); |
281 InstantTestBase::Init(instant_url, true); | 281 InstantTestBase::Init(instant_url, true); |
282 } | 282 } |
283 | 283 |
284 net::FakeURLFetcherFactory* fake_factory() { return fake_factory_.get(); } | 284 net::FakeURLFetcherFactory* fake_factory() { return fake_factory_.get(); } |
285 | 285 |
286 private: | 286 private: |
287 // Used to instantiate FakeURLFetcherFactory. | 287 // Used to instantiate FakeURLFetcherFactory. |
(...skipping 30 matching lines...) Expand all Loading... |
318 | 318 |
319 // Test class used to verify chrome-search: scheme and access policy from the | 319 // Test class used to verify chrome-search: scheme and access policy from the |
320 // Instant overlay. This is a subclass of |ExtensionBrowserTest| because it | 320 // Instant overlay. This is a subclass of |ExtensionBrowserTest| because it |
321 // loads a theme that provides a background image. | 321 // loads a theme that provides a background image. |
322 class InstantPolicyTest : public ExtensionBrowserTest, public InstantTestBase { | 322 class InstantPolicyTest : public ExtensionBrowserTest, public InstantTestBase { |
323 public: | 323 public: |
324 InstantPolicyTest() {} | 324 InstantPolicyTest() {} |
325 | 325 |
326 protected: | 326 protected: |
327 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 327 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
328 chrome::EnableInstantExtendedAPIForTesting(); | |
329 ASSERT_TRUE(https_test_server().Start()); | 328 ASSERT_TRUE(https_test_server().Start()); |
330 GURL instant_url = https_test_server().GetURL( | 329 GURL instant_url = https_test_server().GetURL( |
331 "files/instant_extended.html?strk=1&"); | 330 "files/instant_extended.html?strk=1&"); |
332 InstantTestBase::Init(instant_url, false); | 331 InstantTestBase::Init(instant_url, false); |
333 } | 332 } |
334 | 333 |
335 void InstallThemeSource() { | 334 void InstallThemeSource() { |
336 ThemeSource* theme = new ThemeSource(profile()); | 335 ThemeSource* theme = new ThemeSource(profile()); |
337 content::URLDataSource::Add(profile(), theme); | 336 content::URLDataSource::Add(profile(), theme); |
338 } | 337 } |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1031 stream << "link.href = \"" << result_url.spec() << "\";"; | 1030 stream << "link.href = \"" << result_url.spec() << "\";"; |
1032 stream << "document.body.appendChild(link);"; | 1031 stream << "document.body.appendChild(link);"; |
1033 stream << "link.click();"; | 1032 stream << "link.click();"; |
1034 EXPECT_TRUE(content::ExecuteScript(contents, stream.str())); | 1033 EXPECT_TRUE(content::ExecuteScript(contents, stream.str())); |
1035 | 1034 |
1036 content::WaitForLoadStop(contents); | 1035 content::WaitForLoadStop(contents); |
1037 std::string expected_title = | 1036 std::string expected_title = |
1038 "Referrer is " + instant_url().GetWithEmptyPath().spec(); | 1037 "Referrer is " + instant_url().GetWithEmptyPath().spec(); |
1039 EXPECT_EQ(ASCIIToUTF16(expected_title), contents->GetTitle()); | 1038 EXPECT_EQ(ASCIIToUTF16(expected_title), contents->GetTitle()); |
1040 } | 1039 } |
OLD | NEW |