OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/net/pref_proxy_config_tracker_impl.h" | 5 #include "chrome/browser/net/pref_proxy_config_tracker_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 | 319 |
320 void PrintTo(const CommandLineTestParams& params, std::ostream* os) { | 320 void PrintTo(const CommandLineTestParams& params, std::ostream* os) { |
321 *os << params.description; | 321 *os << params.description; |
322 } | 322 } |
323 | 323 |
324 class PrefProxyConfigTrackerImplCommandLineTest | 324 class PrefProxyConfigTrackerImplCommandLineTest |
325 : public PrefProxyConfigTrackerImplTestBase< | 325 : public PrefProxyConfigTrackerImplTestBase< |
326 testing::TestWithParam<CommandLineTestParams> > { | 326 testing::TestWithParam<CommandLineTestParams> > { |
327 protected: | 327 protected: |
328 PrefProxyConfigTrackerImplCommandLineTest() | 328 PrefProxyConfigTrackerImplCommandLineTest() |
329 : command_line_(CommandLine::NO_PROGRAM) {} | 329 : command_line_(base::CommandLine::NO_PROGRAM) {} |
330 | 330 |
331 void SetUp() override { | 331 void SetUp() override { |
332 for (size_t i = 0; i < arraysize(GetParam().switches); i++) { | 332 for (size_t i = 0; i < arraysize(GetParam().switches); i++) { |
333 const char* name = GetParam().switches[i].name; | 333 const char* name = GetParam().switches[i].name; |
334 const char* value = GetParam().switches[i].value; | 334 const char* value = GetParam().switches[i].value; |
335 if (name && value) | 335 if (name && value) |
336 command_line_.AppendSwitchASCII(name, value); | 336 command_line_.AppendSwitchASCII(name, value); |
337 else if (name) | 337 else if (name) |
338 command_line_.AppendSwitch(name); | 338 command_line_.AppendSwitch(name); |
339 } | 339 } |
340 scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple; | 340 scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple; |
341 PrefServiceMockFactory factory; | 341 PrefServiceMockFactory factory; |
342 factory.SetCommandLine(&command_line_); | 342 factory.SetCommandLine(&command_line_); |
343 pref_service_ = factory.Create(registry.get()).Pass(); | 343 pref_service_ = factory.Create(registry.get()).Pass(); |
344 Init(pref_service_.get(), registry.get()); | 344 Init(pref_service_.get(), registry.get()); |
345 } | 345 } |
346 | 346 |
347 private: | 347 private: |
348 CommandLine command_line_; | 348 base::CommandLine command_line_; |
349 scoped_ptr<PrefService> pref_service_; | 349 scoped_ptr<PrefService> pref_service_; |
350 }; | 350 }; |
351 | 351 |
352 TEST_P(PrefProxyConfigTrackerImplCommandLineTest, CommandLine) { | 352 TEST_P(PrefProxyConfigTrackerImplCommandLineTest, CommandLine) { |
353 net::ProxyConfig config; | 353 net::ProxyConfig config; |
354 EXPECT_EQ(net::ProxyConfigService::CONFIG_VALID, | 354 EXPECT_EQ(net::ProxyConfigService::CONFIG_VALID, |
355 proxy_config_service_->GetLatestProxyConfig(&config)); | 355 proxy_config_service_->GetLatestProxyConfig(&config)); |
356 | 356 |
357 if (GetParam().is_null) { | 357 if (GetParam().is_null) { |
358 EXPECT_EQ(GURL(kFixedPacUrl), config.pac_url()); | 358 EXPECT_EQ(GURL(kFixedPacUrl), config.pac_url()); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 net::ProxyRulesExpectation::Empty(), | 473 net::ProxyRulesExpectation::Empty(), |
474 }, | 474 }, |
475 }; | 475 }; |
476 | 476 |
477 INSTANTIATE_TEST_CASE_P( | 477 INSTANTIATE_TEST_CASE_P( |
478 PrefProxyConfigTrackerImplCommandLineTestInstance, | 478 PrefProxyConfigTrackerImplCommandLineTestInstance, |
479 PrefProxyConfigTrackerImplCommandLineTest, | 479 PrefProxyConfigTrackerImplCommandLineTest, |
480 testing::ValuesIn(kCommandLineTestParams)); | 480 testing::ValuesIn(kCommandLineTestParams)); |
481 | 481 |
482 } // namespace | 482 } // namespace |
OLD | NEW |