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 "components/proxy_config/pref_proxy_config_tracker_impl.h" | 5 #include "components/proxy_config/pref_proxy_config_tracker_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
12 #include "base/prefs/pref_registry_simple.h" | 12 #include "base/prefs/pref_registry_simple.h" |
13 #include "base/prefs/testing_pref_service.h" | 13 #include "base/prefs/testing_pref_service.h" |
14 #include "base/test/histogram_tester.h" | 14 #include "base/test/histogram_tester.h" |
15 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
| 16 #include "chrome/browser/prefs/command_line_pref_store.h" |
16 #include "chrome/browser/prefs/pref_service_mock_factory.h" | 17 #include "chrome/browser/prefs/pref_service_mock_factory.h" |
17 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
18 #include "components/proxy_config/proxy_config_dictionary.h" | 19 #include "components/proxy_config/proxy_config_dictionary.h" |
19 #include "components/proxy_config/proxy_config_pref_names.h" | 20 #include "components/proxy_config/proxy_config_pref_names.h" |
20 #include "net/proxy/proxy_config_service_common_unittest.h" | 21 #include "net/proxy/proxy_config_service_common_unittest.h" |
21 #include "net/proxy/proxy_info.h" | 22 #include "net/proxy/proxy_info.h" |
22 #include "net/proxy/proxy_list.h" | 23 #include "net/proxy/proxy_list.h" |
23 #include "testing/gmock/include/gmock/gmock.h" | 24 #include "testing/gmock/include/gmock/gmock.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
25 | 26 |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 for (size_t i = 0; i < arraysize(GetParam().switches); i++) { | 423 for (size_t i = 0; i < arraysize(GetParam().switches); i++) { |
423 const char* name = GetParam().switches[i].name; | 424 const char* name = GetParam().switches[i].name; |
424 const char* value = GetParam().switches[i].value; | 425 const char* value = GetParam().switches[i].value; |
425 if (name && value) | 426 if (name && value) |
426 command_line_.AppendSwitchASCII(name, value); | 427 command_line_.AppendSwitchASCII(name, value); |
427 else if (name) | 428 else if (name) |
428 command_line_.AppendSwitch(name); | 429 command_line_.AppendSwitch(name); |
429 } | 430 } |
430 scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple; | 431 scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple; |
431 PrefServiceMockFactory factory; | 432 PrefServiceMockFactory factory; |
432 factory.SetCommandLine(&command_line_); | 433 factory.set_command_line_prefs(new CommandLinePrefStore(&command_line_)); |
433 pref_service_ = factory.Create(registry.get()).Pass(); | 434 pref_service_ = factory.Create(registry.get()).Pass(); |
434 Init(pref_service_.get(), registry.get()); | 435 Init(pref_service_.get(), registry.get()); |
435 } | 436 } |
436 | 437 |
437 private: | 438 private: |
438 base::CommandLine command_line_; | 439 base::CommandLine command_line_; |
439 scoped_ptr<PrefService> pref_service_; | 440 scoped_ptr<PrefService> pref_service_; |
440 }; | 441 }; |
441 | 442 |
442 TEST_P(PrefProxyConfigTrackerImplCommandLineTest, CommandLine) { | 443 TEST_P(PrefProxyConfigTrackerImplCommandLineTest, CommandLine) { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 net::ProxyRulesExpectation::Empty(), | 564 net::ProxyRulesExpectation::Empty(), |
564 }, | 565 }, |
565 }; | 566 }; |
566 | 567 |
567 INSTANTIATE_TEST_CASE_P( | 568 INSTANTIATE_TEST_CASE_P( |
568 PrefProxyConfigTrackerImplCommandLineTestInstance, | 569 PrefProxyConfigTrackerImplCommandLineTestInstance, |
569 PrefProxyConfigTrackerImplCommandLineTest, | 570 PrefProxyConfigTrackerImplCommandLineTest, |
570 testing::ValuesIn(kCommandLineTestParams)); | 571 testing::ValuesIn(kCommandLineTestParams)); |
571 | 572 |
572 } // namespace | 573 } // namespace |
OLD | NEW |