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/callback.h" | 5 #include "base/callback.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "chrome/browser/policy/external_data_fetcher.h" | 9 #include "chrome/browser/policy/external_data_fetcher.h" |
10 #include "chrome/browser/policy/mock_configuration_policy_provider.h" | 10 #include "chrome/browser/policy/mock_configuration_policy_provider.h" |
(...skipping 81 matching lines...) Loading... |
92 policy_service_.reset(new PolicyServiceImpl(providers)); | 92 policy_service_.reset(new PolicyServiceImpl(providers)); |
93 provider_.Init(); | 93 provider_.Init(); |
94 } | 94 } |
95 | 95 |
96 virtual void TearDown() OVERRIDE { | 96 virtual void TearDown() OVERRIDE { |
97 provider_.Shutdown(); | 97 provider_.Shutdown(); |
98 } | 98 } |
99 | 99 |
100 PrefService* CreatePrefService(bool with_managed_policies) { | 100 PrefService* CreatePrefService(bool with_managed_policies) { |
101 PrefServiceMockBuilder builder; | 101 PrefServiceMockBuilder builder; |
102 builder.WithCommandLine(&command_line_); | 102 builder.SetCommandLine(&command_line_); |
103 if (with_managed_policies) | 103 if (with_managed_policies) |
104 builder.WithManagedPolicies(policy_service_.get()); | 104 builder.SetManagedPolicies(policy_service_.get()); |
105 scoped_refptr<user_prefs::PrefRegistrySyncable> registry( | 105 scoped_refptr<user_prefs::PrefRegistrySyncable> registry( |
106 new user_prefs::PrefRegistrySyncable); | 106 new user_prefs::PrefRegistrySyncable); |
107 PrefServiceSyncable* prefs = builder.CreateSyncable(registry.get()); | 107 PrefServiceSyncable* prefs = builder.CreateSyncable(registry.get()).get(); |
108 chrome::RegisterUserProfilePrefs(registry.get()); | 108 chrome::RegisterUserProfilePrefs(registry.get()); |
109 return prefs; | 109 return prefs; |
110 } | 110 } |
111 | 111 |
112 base::MessageLoop loop_; | 112 base::MessageLoop loop_; |
113 CommandLine command_line_; | 113 CommandLine command_line_; |
114 MockConfigurationPolicyProvider provider_; | 114 MockConfigurationPolicyProvider provider_; |
115 scoped_ptr<PolicyServiceImpl> policy_service_; | 115 scoped_ptr<PolicyServiceImpl> policy_service_; |
116 }; | 116 }; |
117 | 117 |
(...skipping 99 matching lines...) Loading... |
217 | 217 |
218 // Try a second time time with the managed PrefStore in place, the | 218 // Try a second time time with the managed PrefStore in place, the |
219 // auto-detect should be overridden. The default pref store must be | 219 // auto-detect should be overridden. The default pref store must be |
220 // in place with the appropriate default value for this to work. | 220 // in place with the appropriate default value for this to work. |
221 prefs.reset(CreatePrefService(true)); | 221 prefs.reset(CreatePrefService(true)); |
222 ProxyConfigDictionary dict2(prefs->GetDictionary(prefs::kProxy)); | 222 ProxyConfigDictionary dict2(prefs->GetDictionary(prefs::kProxy)); |
223 assertProxyModeWithoutParams(dict2, ProxyPrefs::MODE_DIRECT); | 223 assertProxyModeWithoutParams(dict2, ProxyPrefs::MODE_DIRECT); |
224 } | 224 } |
225 | 225 |
226 } // namespace policy | 226 } // namespace policy |
OLD | NEW |