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 "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
7 #include "chrome/browser/policy/mock_configuration_policy_provider.h" | 7 #include "chrome/browser/policy/mock_configuration_policy_provider.h" |
8 #include "chrome/browser/policy/policy_map.h" | 8 #include "chrome/browser/policy/policy_map.h" |
9 #include "chrome/browser/policy/policy_service_impl.h" | 9 #include "chrome/browser/policy/policy_service_impl.h" |
10 #include "chrome/browser/prefs/browser_prefs.h" | 10 #include "chrome/browser/prefs/browser_prefs.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 provider_.Shutdown(); | 94 provider_.Shutdown(); |
95 } | 95 } |
96 | 96 |
97 PrefService* CreatePrefService(bool with_managed_policies) { | 97 PrefService* CreatePrefService(bool with_managed_policies) { |
98 PrefServiceMockBuilder builder; | 98 PrefServiceMockBuilder builder; |
99 builder.WithCommandLine(&command_line_); | 99 builder.WithCommandLine(&command_line_); |
100 if (with_managed_policies) | 100 if (with_managed_policies) |
101 builder.WithManagedPolicies(policy_service_.get()); | 101 builder.WithManagedPolicies(policy_service_.get()); |
102 scoped_refptr<user_prefs::PrefRegistrySyncable> registry( | 102 scoped_refptr<user_prefs::PrefRegistrySyncable> registry( |
103 new user_prefs::PrefRegistrySyncable); | 103 new user_prefs::PrefRegistrySyncable); |
104 PrefServiceSyncable* prefs = builder.CreateSyncable(registry); | 104 PrefServiceSyncable* prefs = builder.CreateSyncable(registry.get()); |
105 chrome::RegisterUserPrefs(registry); | 105 chrome::RegisterUserPrefs(registry.get()); |
106 return prefs; | 106 return prefs; |
107 } | 107 } |
108 | 108 |
109 CommandLine command_line_; | 109 CommandLine command_line_; |
110 MockConfigurationPolicyProvider provider_; | 110 MockConfigurationPolicyProvider provider_; |
111 scoped_ptr<PolicyServiceImpl> policy_service_; | 111 scoped_ptr<PolicyServiceImpl> policy_service_; |
112 }; | 112 }; |
113 | 113 |
114 TEST_F(ProxyPolicyTest, OverridesCommandLineOptions) { | 114 TEST_F(ProxyPolicyTest, OverridesCommandLineOptions) { |
115 command_line_.AppendSwitchASCII(switches::kProxyBypassList, "123"); | 115 command_line_.AppendSwitchASCII(switches::kProxyBypassList, "123"); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 213 |
214 // Try a second time time with the managed PrefStore in place, the | 214 // Try a second time time with the managed PrefStore in place, the |
215 // auto-detect should be overridden. The default pref store must be | 215 // auto-detect should be overridden. The default pref store must be |
216 // in place with the appropriate default value for this to work. | 216 // in place with the appropriate default value for this to work. |
217 prefs.reset(CreatePrefService(true)); | 217 prefs.reset(CreatePrefService(true)); |
218 ProxyConfigDictionary dict2(prefs->GetDictionary(prefs::kProxy)); | 218 ProxyConfigDictionary dict2(prefs->GetDictionary(prefs::kProxy)); |
219 assertProxyModeWithoutParams(dict2, ProxyPrefs::MODE_DIRECT); | 219 assertProxyModeWithoutParams(dict2, ProxyPrefs::MODE_DIRECT); |
220 } | 220 } |
221 | 221 |
222 } // namespace policy | 222 } // namespace policy |
OLD | NEW |