| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "chrome/browser/policy/mock_configuration_policy_provider.h" | 6 #include "chrome/browser/policy/mock_configuration_policy_provider.h" |
| 7 #include "chrome/browser/policy/policy_map.h" | 7 #include "chrome/browser/policy/policy_map.h" |
| 8 #include "chrome/browser/policy/policy_service_impl.h" | 8 #include "chrome/browser/policy/policy_service_impl.h" |
| 9 #include "chrome/browser/prefs/browser_prefs.h" | 9 #include "chrome/browser/prefs/browser_prefs.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 providers.push_back(&provider_); | 86 providers.push_back(&provider_); |
| 87 policy_service_.reset(new PolicyServiceImpl(providers)); | 87 policy_service_.reset(new PolicyServiceImpl(providers)); |
| 88 } | 88 } |
| 89 | 89 |
| 90 PrefService* CreatePrefService(bool with_managed_policies) { | 90 PrefService* CreatePrefService(bool with_managed_policies) { |
| 91 PrefServiceMockBuilder builder; | 91 PrefServiceMockBuilder builder; |
| 92 builder.WithCommandLine(&command_line_); | 92 builder.WithCommandLine(&command_line_); |
| 93 if (with_managed_policies) | 93 if (with_managed_policies) |
| 94 builder.WithManagedPolicies(policy_service_.get()); | 94 builder.WithManagedPolicies(policy_service_.get()); |
| 95 PrefService* prefs = builder.Create(); | 95 PrefService* prefs = builder.Create(); |
| 96 browser::RegisterUserPrefs(prefs); | 96 chrome::RegisterUserPrefs(prefs); |
| 97 return prefs; | 97 return prefs; |
| 98 } | 98 } |
| 99 | 99 |
| 100 CommandLine command_line_; | 100 CommandLine command_line_; |
| 101 MockConfigurationPolicyProvider provider_; | 101 MockConfigurationPolicyProvider provider_; |
| 102 scoped_ptr<PolicyServiceImpl> policy_service_; | 102 scoped_ptr<PolicyServiceImpl> policy_service_; |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 TEST_F(ProxyPolicyTest, OverridesCommandLineOptions) { | 105 TEST_F(ProxyPolicyTest, OverridesCommandLineOptions) { |
| 106 command_line_.AppendSwitchASCII(switches::kProxyBypassList, "123"); | 106 command_line_.AppendSwitchASCII(switches::kProxyBypassList, "123"); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 // Try a second time time with the managed PrefStore in place, the | 205 // Try a second time time with the managed PrefStore in place, the |
| 206 // auto-detect should be overridden. The default pref store must be | 206 // auto-detect should be overridden. The default pref store must be |
| 207 // in place with the appropriate default value for this to work. | 207 // in place with the appropriate default value for this to work. |
| 208 prefs.reset(CreatePrefService(true)); | 208 prefs.reset(CreatePrefService(true)); |
| 209 ProxyConfigDictionary dict2(prefs->GetDictionary(prefs::kProxy)); | 209 ProxyConfigDictionary dict2(prefs->GetDictionary(prefs::kProxy)); |
| 210 assertProxyModeWithoutParams(dict2, ProxyPrefs::MODE_DIRECT); | 210 assertProxyModeWithoutParams(dict2, ProxyPrefs::MODE_DIRECT); |
| 211 } | 211 } |
| 212 | 212 |
| 213 } // namespace policy | 213 } // namespace policy |
| OLD | NEW |