Chromium Code Reviews| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 259 void SetUpInProcessBrowserTestFixture() override { | 259 void SetUpInProcessBrowserTestFixture() override { |
| 260 search::EnableQueryExtractionForTesting(); | 260 search::EnableQueryExtractionForTesting(); |
| 261 ASSERT_TRUE(https_test_server().Start()); | 261 ASSERT_TRUE(https_test_server().Start()); |
| 262 GURL instant_url = | 262 GURL instant_url = |
| 263 https_test_server().GetURL("/instant_extended.html?strk=1&"); | 263 https_test_server().GetURL("/instant_extended.html?strk=1&"); |
| 264 GURL ntp_url = | 264 GURL ntp_url = |
| 265 https_test_server().GetURL("/instant_extended_ntp.html?strk=1&"); | 265 https_test_server().GetURL("/instant_extended_ntp.html?strk=1&"); |
| 266 InstantTestBase::Init(instant_url, ntp_url, true); | 266 InstantTestBase::Init(instant_url, ntp_url, true); |
| 267 } | 267 } |
| 268 | 268 |
| 269 void SetUpCommandLine(base::CommandLine* command_line) override { | |
| 270 command_line->AppendSwitchASCII( | |
| 271 switches::kForceFieldTrials, | |
| 272 "EmbeddedSearch/Group11 prefetch_results_srp:1/"); | |
| 273 } | |
| 274 | |
| 275 net::FakeURLFetcherFactory* fake_factory() { return fake_factory_.get(); } | 269 net::FakeURLFetcherFactory* fake_factory() { return fake_factory_.get(); } |
| 276 | 270 |
| 277 private: | 271 private: |
| 278 // Used to instantiate FakeURLFetcherFactory. | 272 // Used to instantiate FakeURLFetcherFactory. |
| 279 std::unique_ptr<net::URLFetcherImplFactory> factory_; | 273 std::unique_ptr<net::URLFetcherImplFactory> factory_; |
| 280 | 274 |
| 281 // Used to mock default search provider suggest response. | 275 // Used to mock default search provider suggest response. |
| 282 std::unique_ptr<net::FakeURLFetcherFactory> fake_factory_; | 276 std::unique_ptr<net::FakeURLFetcherFactory> fake_factory_; |
| 283 | 277 |
| 284 DISALLOW_COPY_AND_ASSIGN(InstantExtendedPrefetchTest); | 278 DISALLOW_COPY_AND_ASSIGN(InstantExtendedPrefetchTest); |
| 285 }; | 279 }; |
| 286 | 280 |
| 287 class InstantExtendedNetworkTest : public InstantExtendedTest { | |
|
Marc Treib
2016/07/13 12:27:38
Unrelated, but this class isn't used anywhere.
| |
| 288 protected: | |
| 289 void SetUpOnMainThread() override { | |
| 290 disable_for_test_.reset(new net::NetworkChangeNotifier::DisableForTest); | |
| 291 fake_network_change_notifier_.reset(new FakeNetworkChangeNotifier); | |
| 292 InstantExtendedTest::SetUpOnMainThread(); | |
| 293 } | |
| 294 | |
| 295 void TearDownOnMainThread() override { | |
| 296 InstantExtendedTest::TearDownOnMainThread(); | |
| 297 fake_network_change_notifier_.reset(); | |
| 298 disable_for_test_.reset(); | |
| 299 } | |
| 300 | |
| 301 void SetConnectionType(net::NetworkChangeNotifier::ConnectionType type) { | |
| 302 fake_network_change_notifier_->SetConnectionType(type); | |
| 303 } | |
| 304 | |
| 305 private: | |
| 306 std::unique_ptr<net::NetworkChangeNotifier::DisableForTest> disable_for_test_; | |
| 307 std::unique_ptr<FakeNetworkChangeNotifier> fake_network_change_notifier_; | |
| 308 }; | |
| 309 | |
| 310 // Test class used to verify chrome-search: scheme and access policy from the | 281 // Test class used to verify chrome-search: scheme and access policy from the |
| 311 // Instant overlay. This is a subclass of |ExtensionBrowserTest| because it | 282 // Instant overlay. This is a subclass of |ExtensionBrowserTest| because it |
| 312 // loads a theme that provides a background image. | 283 // loads a theme that provides a background image. |
| 313 class InstantPolicyTest : public ExtensionBrowserTest, public InstantTestBase { | 284 class InstantPolicyTest : public ExtensionBrowserTest, public InstantTestBase { |
| 314 public: | 285 public: |
| 315 InstantPolicyTest() {} | 286 InstantPolicyTest() {} |
| 316 | 287 |
| 317 protected: | 288 protected: |
| 318 void SetUpInProcessBrowserTestFixture() override { | 289 void SetUpInProcessBrowserTestFixture() override { |
| 319 ASSERT_TRUE(https_test_server().Start()); | 290 ASSERT_TRUE(https_test_server().Start()); |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 970 stream << "link.href = \"" << result_url.spec() << "\";"; | 941 stream << "link.href = \"" << result_url.spec() << "\";"; |
| 971 stream << "document.body.appendChild(link);"; | 942 stream << "document.body.appendChild(link);"; |
| 972 stream << "link.click();"; | 943 stream << "link.click();"; |
| 973 EXPECT_TRUE(content::ExecuteScript(contents, stream.str())); | 944 EXPECT_TRUE(content::ExecuteScript(contents, stream.str())); |
| 974 | 945 |
| 975 content::WaitForLoadStop(contents); | 946 content::WaitForLoadStop(contents); |
| 976 std::string expected_title = | 947 std::string expected_title = |
| 977 "Referrer is " + instant_url().GetWithEmptyPath().spec(); | 948 "Referrer is " + instant_url().GetWithEmptyPath().spec(); |
| 978 EXPECT_EQ(ASCIIToUTF16(expected_title), contents->GetTitle()); | 949 EXPECT_EQ(ASCIIToUTF16(expected_title), contents->GetTitle()); |
| 979 } | 950 } |
| OLD | NEW |