| 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/callback.h" | 6 #include "base/callback.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "chrome/browser/policy/policy_transformations.h" | |
| 11 #include "chrome/browser/prefs/browser_prefs.h" | 10 #include "chrome/browser/prefs/browser_prefs.h" |
| 12 #include "chrome/browser/prefs/pref_service_mock_factory.h" | 11 #include "chrome/browser/prefs/pref_service_mock_factory.h" |
| 13 #include "chrome/browser/prefs/pref_service_syncable.h" | 12 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 14 #include "chrome/browser/prefs/proxy_config_dictionary.h" | 13 #include "chrome/browser/prefs/proxy_config_dictionary.h" |
| 15 #include "chrome/browser/prefs/proxy_prefs.h" | 14 #include "chrome/browser/prefs/proxy_prefs.h" |
| 16 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
| 17 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
| 18 #include "components/policy/core/common/external_data_fetcher.h" | 17 #include "components/policy/core/common/external_data_fetcher.h" |
| 19 #include "components/policy/core/common/mock_configuration_policy_provider.h" | 18 #include "components/policy/core/common/mock_configuration_policy_provider.h" |
| 20 #include "components/policy/core/common/policy_map.h" | 19 #include "components/policy/core/common/policy_map.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 protected: | 83 protected: |
| 85 ProxyPolicyTest() | 84 ProxyPolicyTest() |
| 86 : command_line_(CommandLine::NO_PROGRAM) {} | 85 : command_line_(CommandLine::NO_PROGRAM) {} |
| 87 | 86 |
| 88 virtual void SetUp() OVERRIDE { | 87 virtual void SetUp() OVERRIDE { |
| 89 EXPECT_CALL(provider_, IsInitializationComplete(_)) | 88 EXPECT_CALL(provider_, IsInitializationComplete(_)) |
| 90 .WillRepeatedly(Return(true)); | 89 .WillRepeatedly(Return(true)); |
| 91 | 90 |
| 92 PolicyServiceImpl::Providers providers; | 91 PolicyServiceImpl::Providers providers; |
| 93 providers.push_back(&provider_); | 92 providers.push_back(&provider_); |
| 94 policy_service_.reset( | 93 policy_service_.reset(new PolicyServiceImpl(providers)); |
| 95 new PolicyServiceImpl(providers, base::Bind(&FixDeprecatedPolicies))); | |
| 96 provider_.Init(); | 94 provider_.Init(); |
| 97 } | 95 } |
| 98 | 96 |
| 99 virtual void TearDown() OVERRIDE { | 97 virtual void TearDown() OVERRIDE { |
| 100 provider_.Shutdown(); | 98 provider_.Shutdown(); |
| 101 } | 99 } |
| 102 | 100 |
| 103 scoped_ptr<PrefService> CreatePrefService(bool with_managed_policies) { | 101 scoped_ptr<PrefService> CreatePrefService(bool with_managed_policies) { |
| 104 PrefServiceMockFactory factory; | 102 PrefServiceMockFactory factory; |
| 105 factory.SetCommandLine(&command_line_); | 103 factory.SetCommandLine(&command_line_); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 219 |
| 222 // Try a second time time with the managed PrefStore in place, the | 220 // Try a second time time with the managed PrefStore in place, the |
| 223 // auto-detect should be overridden. The default pref store must be | 221 // auto-detect should be overridden. The default pref store must be |
| 224 // in place with the appropriate default value for this to work. | 222 // in place with the appropriate default value for this to work. |
| 225 prefs = CreatePrefService(true); | 223 prefs = CreatePrefService(true); |
| 226 ProxyConfigDictionary dict2(prefs->GetDictionary(prefs::kProxy)); | 224 ProxyConfigDictionary dict2(prefs->GetDictionary(prefs::kProxy)); |
| 227 assertProxyModeWithoutParams(dict2, ProxyPrefs::MODE_DIRECT); | 225 assertProxyModeWithoutParams(dict2, ProxyPrefs::MODE_DIRECT); |
| 228 } | 226 } |
| 229 | 227 |
| 230 } // namespace policy | 228 } // namespace policy |
| OLD | NEW |