| 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.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 virtual void SetUp() { | 335 virtual void SetUp() { |
| 336 for (size_t i = 0; i < arraysize(GetParam().switches); i++) { | 336 for (size_t i = 0; i < arraysize(GetParam().switches); i++) { |
| 337 const char* name = GetParam().switches[i].name; | 337 const char* name = GetParam().switches[i].name; |
| 338 const char* value = GetParam().switches[i].value; | 338 const char* value = GetParam().switches[i].value; |
| 339 if (name && value) | 339 if (name && value) |
| 340 command_line_.AppendSwitchASCII(name, value); | 340 command_line_.AppendSwitchASCII(name, value); |
| 341 else if (name) | 341 else if (name) |
| 342 command_line_.AppendSwitch(name); | 342 command_line_.AppendSwitch(name); |
| 343 } | 343 } |
| 344 scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple; | 344 scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple; |
| 345 pref_service_.reset( | 345 pref_service_.reset(PrefServiceMockBuilder().WithCommandLine(&command_line_) |
| 346 PrefServiceMockBuilder().WithCommandLine( | 346 .Create(registry.get())); |
| 347 &command_line_).Create(registry)); | 347 Init(pref_service_.get(), registry.get()); |
| 348 Init(pref_service_.get(), registry); | |
| 349 } | 348 } |
| 350 | 349 |
| 351 private: | 350 private: |
| 352 CommandLine command_line_; | 351 CommandLine command_line_; |
| 353 scoped_ptr<PrefService> pref_service_; | 352 scoped_ptr<PrefService> pref_service_; |
| 354 }; | 353 }; |
| 355 | 354 |
| 356 TEST_P(PrefProxyConfigTrackerImplCommandLineTest, CommandLine) { | 355 TEST_P(PrefProxyConfigTrackerImplCommandLineTest, CommandLine) { |
| 357 net::ProxyConfig config; | 356 net::ProxyConfig config; |
| 358 EXPECT_EQ(net::ProxyConfigService::CONFIG_VALID, | 357 EXPECT_EQ(net::ProxyConfigService::CONFIG_VALID, |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 net::ProxyRulesExpectation::Empty(), | 476 net::ProxyRulesExpectation::Empty(), |
| 478 }, | 477 }, |
| 479 }; | 478 }; |
| 480 | 479 |
| 481 INSTANTIATE_TEST_CASE_P( | 480 INSTANTIATE_TEST_CASE_P( |
| 482 PrefProxyConfigTrackerImplCommandLineTestInstance, | 481 PrefProxyConfigTrackerImplCommandLineTestInstance, |
| 483 PrefProxyConfigTrackerImplCommandLineTest, | 482 PrefProxyConfigTrackerImplCommandLineTest, |
| 484 testing::ValuesIn(kCommandLineTestParams)); | 483 testing::ValuesIn(kCommandLineTestParams)); |
| 485 | 484 |
| 486 } // namespace | 485 } // namespace |
| OLD | NEW |