| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 virtual void TearDown() OVERRIDE { | 93 virtual void TearDown() OVERRIDE { |
| 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<user_prefs::PrefRegistrySyncable> registry( |
| 103 new user_prefs::PrefRegistrySyncable); |
| 103 PrefServiceSyncable* prefs = builder.CreateSyncable(registry); | 104 PrefServiceSyncable* prefs = builder.CreateSyncable(registry); |
| 104 chrome::RegisterUserPrefs(registry); | 105 chrome::RegisterUserPrefs(registry); |
| 105 return prefs; | 106 return prefs; |
| 106 } | 107 } |
| 107 | 108 |
| 108 CommandLine command_line_; | 109 CommandLine command_line_; |
| 109 MockConfigurationPolicyProvider provider_; | 110 MockConfigurationPolicyProvider provider_; |
| 110 scoped_ptr<PolicyServiceImpl> policy_service_; | 111 scoped_ptr<PolicyServiceImpl> policy_service_; |
| 111 }; | 112 }; |
| 112 | 113 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 213 |
| 213 // 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 |
| 214 // auto-detect should be overridden. The default pref store must be | 215 // auto-detect should be overridden. The default pref store must be |
| 215 // in place with the appropriate default value for this to work. | 216 // in place with the appropriate default value for this to work. |
| 216 prefs.reset(CreatePrefService(true)); | 217 prefs.reset(CreatePrefService(true)); |
| 217 ProxyConfigDictionary dict2(prefs->GetDictionary(prefs::kProxy)); | 218 ProxyConfigDictionary dict2(prefs->GetDictionary(prefs::kProxy)); |
| 218 assertProxyModeWithoutParams(dict2, ProxyPrefs::MODE_DIRECT); | 219 assertProxyModeWithoutParams(dict2, ProxyPrefs::MODE_DIRECT); |
| 219 } | 220 } |
| 220 | 221 |
| 221 } // namespace policy | 222 } // namespace policy |
| OLD | NEW |