| 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" |
| 11 #include "base/prefs/testing_pref_service.h" | 11 #include "base/prefs/testing_pref_service.h" |
| 12 #include "chrome/browser/net/chrome_url_request_context.h" | 12 #include "chrome/browser/net/chrome_url_request_context.h" |
| 13 #include "chrome/browser/prefs/pref_service_mock_builder.h" | 13 #include "chrome/browser/prefs/pref_service_mock_factory.h" |
| 14 #include "chrome/browser/prefs/proxy_config_dictionary.h" | 14 #include "chrome/browser/prefs/proxy_config_dictionary.h" |
| 15 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
| 16 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
| 17 #include "content/public/test/test_browser_thread.h" | 17 #include "content/public/test/test_browser_thread.h" |
| 18 #include "net/proxy/proxy_config_service_common_unittest.h" | 18 #include "net/proxy/proxy_config_service_common_unittest.h" |
| 19 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 21 | 21 |
| 22 using content::BrowserThread; | 22 using content::BrowserThread; |
| 23 using testing::_; | 23 using testing::_; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 virtual void SetUp() { | 334 virtual void SetUp() { |
| 335 for (size_t i = 0; i < arraysize(GetParam().switches); i++) { | 335 for (size_t i = 0; i < arraysize(GetParam().switches); i++) { |
| 336 const char* name = GetParam().switches[i].name; | 336 const char* name = GetParam().switches[i].name; |
| 337 const char* value = GetParam().switches[i].value; | 337 const char* value = GetParam().switches[i].value; |
| 338 if (name && value) | 338 if (name && value) |
| 339 command_line_.AppendSwitchASCII(name, value); | 339 command_line_.AppendSwitchASCII(name, value); |
| 340 else if (name) | 340 else if (name) |
| 341 command_line_.AppendSwitch(name); | 341 command_line_.AppendSwitch(name); |
| 342 } | 342 } |
| 343 scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple; | 343 scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple; |
| 344 pref_service_.reset(PrefServiceMockBuilder().WithCommandLine(&command_line_) | 344 PrefServiceMockFactory factory; |
| 345 .Create(registry.get())); | 345 factory.SetCommandLine(&command_line_); |
| 346 pref_service_ = factory.Create(registry.get()).Pass(); |
| 346 Init(pref_service_.get(), registry.get()); | 347 Init(pref_service_.get(), registry.get()); |
| 347 } | 348 } |
| 348 | 349 |
| 349 private: | 350 private: |
| 350 CommandLine command_line_; | 351 CommandLine command_line_; |
| 351 scoped_ptr<PrefService> pref_service_; | 352 scoped_ptr<PrefService> pref_service_; |
| 352 }; | 353 }; |
| 353 | 354 |
| 354 TEST_P(PrefProxyConfigTrackerImplCommandLineTest, CommandLine) { | 355 TEST_P(PrefProxyConfigTrackerImplCommandLineTest, CommandLine) { |
| 355 net::ProxyConfig config; | 356 net::ProxyConfig config; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 net::ProxyRulesExpectation::Empty(), | 476 net::ProxyRulesExpectation::Empty(), |
| 476 }, | 477 }, |
| 477 }; | 478 }; |
| 478 | 479 |
| 479 INSTANTIATE_TEST_CASE_P( | 480 INSTANTIATE_TEST_CASE_P( |
| 480 PrefProxyConfigTrackerImplCommandLineTestInstance, | 481 PrefProxyConfigTrackerImplCommandLineTestInstance, |
| 481 PrefProxyConfigTrackerImplCommandLineTest, | 482 PrefProxyConfigTrackerImplCommandLineTest, |
| 482 testing::ValuesIn(kCommandLineTestParams)); | 483 testing::ValuesIn(kCommandLineTestParams)); |
| 483 | 484 |
| 484 } // namespace | 485 } // namespace |
| OLD | NEW |