| 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<PrefRegistrySyncable> registry(new PrefRegistrySyncable); | 102 scoped_refptr<PrefRegistrySyncable> registry(new PrefRegistrySyncable); |
| 103 PrefServiceSyncable* prefs = builder.CreateSyncable(registry); | 103 PrefServiceSyncable* prefs = builder.CreateSyncable(registry); |
| 104 chrome::RegisterUserPrefs(prefs, registry); | 104 chrome::RegisterUserPrefs(registry); |
| 105 return prefs; | 105 return prefs; |
| 106 } | 106 } |
| 107 | 107 |
| 108 CommandLine command_line_; | 108 CommandLine command_line_; |
| 109 MockConfigurationPolicyProvider provider_; | 109 MockConfigurationPolicyProvider provider_; |
| 110 scoped_ptr<PolicyServiceImpl> policy_service_; | 110 scoped_ptr<PolicyServiceImpl> policy_service_; |
| 111 }; | 111 }; |
| 112 | 112 |
| 113 TEST_F(ProxyPolicyTest, OverridesCommandLineOptions) { | 113 TEST_F(ProxyPolicyTest, OverridesCommandLineOptions) { |
| 114 command_line_.AppendSwitchASCII(switches::kProxyBypassList, "123"); | 114 command_line_.AppendSwitchASCII(switches::kProxyBypassList, "123"); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 212 |
| 213 // Try a second time time with the managed PrefStore in place, the | 213 // Try a second time time with the managed PrefStore in place, the |
| 214 // auto-detect should be overridden. The default pref store must be | 214 // auto-detect should be overridden. The default pref store must be |
| 215 // in place with the appropriate default value for this to work. | 215 // in place with the appropriate default value for this to work. |
| 216 prefs.reset(CreatePrefService(true)); | 216 prefs.reset(CreatePrefService(true)); |
| 217 ProxyConfigDictionary dict2(prefs->GetDictionary(prefs::kProxy)); | 217 ProxyConfigDictionary dict2(prefs->GetDictionary(prefs::kProxy)); |
| 218 assertProxyModeWithoutParams(dict2, ProxyPrefs::MODE_DIRECT); | 218 assertProxyModeWithoutParams(dict2, ProxyPrefs::MODE_DIRECT); |
| 219 } | 219 } |
| 220 | 220 |
| 221 } // namespace policy | 221 } // namespace policy |
| OLD | NEW |