Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: chrome/browser/net/proxy_policy_handler_unittest.cc

Issue 113813003: Cleanup the policy code after the recent moves into the component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <string> 5 #include <string>
6 6
7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
9 #include "base/values.h" 8 #include "base/values.h"
10 #include "chrome/browser/net/proxy_policy_handler.h" 9 #include "chrome/browser/net/proxy_policy_handler.h"
11 #include "chrome/browser/policy/configuration_policy_pref_store_test.h" 10 #include "chrome/browser/policy/configuration_policy_pref_store_test.h"
12 #include "chrome/browser/policy/policy_transformations.h"
13 #include "chrome/browser/prefs/proxy_config_dictionary.h" 11 #include "chrome/browser/prefs/proxy_config_dictionary.h"
14 #include "chrome/browser/prefs/proxy_prefs.h" 12 #include "chrome/browser/prefs/proxy_prefs.h"
15 #include "chrome/common/pref_names.h" 13 #include "chrome/common/pref_names.h"
16 #include "components/policy/core/browser/configuration_policy_pref_store.h" 14 #include "components/policy/core/browser/configuration_policy_pref_store.h"
17 #include "components/policy/core/common/policy_service_impl.h" 15 #include "components/policy/core/common/policy_service_impl.h"
18 #include "policy/policy_constants.h" 16 #include "policy/policy_constants.h"
19 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
20 18
21 namespace policy { 19 namespace policy {
22 20
23 // Test cases for the proxy policy settings. 21 // Test cases for the proxy policy settings.
24 class ProxyPolicyHandlerTest 22 class ProxyPolicyHandlerTest
25 : public ConfigurationPolicyPrefStoreTest { 23 : public ConfigurationPolicyPrefStoreTest {
26 public: 24 public:
27 virtual void SetUp() OVERRIDE { 25 virtual void SetUp() OVERRIDE {
28 ConfigurationPolicyPrefStoreTest::SetUp(); 26 ConfigurationPolicyPrefStoreTest::SetUp();
29 handler_list_.AddHandler( 27 handler_list_.AddHandler(
30 make_scoped_ptr<ConfigurationPolicyHandler>(new ProxyPolicyHandler)); 28 make_scoped_ptr<ConfigurationPolicyHandler>(new ProxyPolicyHandler));
31 // Reset the PolicyServiceImpl to one that has the policy fixup 29 // Reset the PolicyServiceImpl to one that has the policy fixup
32 // preprocessor. The previous store must be nulled out first so that it 30 // preprocessor. The previous store must be nulled out first so that it
33 // removes itself from the service's observer list. 31 // removes itself from the service's observer list.
34 store_ = NULL; 32 store_ = NULL;
35 policy_service_.reset( 33 policy_service_.reset(new PolicyServiceImpl(providers_));
36 new PolicyServiceImpl(providers_, base::Bind(&FixDeprecatedPolicies)));
37 store_ = new ConfigurationPolicyPrefStore( 34 store_ = new ConfigurationPolicyPrefStore(
38 policy_service_.get(), &handler_list_, POLICY_LEVEL_MANDATORY); 35 policy_service_.get(), &handler_list_, POLICY_LEVEL_MANDATORY);
39 } 36 }
40 37
41 protected: 38 protected:
42 // Verify that all the proxy prefs are set to the specified expected values. 39 // Verify that all the proxy prefs are set to the specified expected values.
43 void VerifyProxyPrefs( 40 void VerifyProxyPrefs(
44 const std::string& expected_proxy_server, 41 const std::string& expected_proxy_server,
45 const std::string& expected_proxy_pac_url, 42 const std::string& expected_proxy_pac_url,
46 const std::string& expected_proxy_bypass_list, 43 const std::string& expected_proxy_bypass_list,
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 for (int i = 0; i < ProxyPolicyHandler::MODE_COUNT; ++i) { 278 for (int i = 0; i < ProxyPolicyHandler::MODE_COUNT; ++i) {
282 policy.Set(key::kProxyServerMode, POLICY_LEVEL_MANDATORY, 279 policy.Set(key::kProxyServerMode, POLICY_LEVEL_MANDATORY,
283 POLICY_SCOPE_USER, base::Value::CreateIntegerValue(i), NULL); 280 POLICY_SCOPE_USER, base::Value::CreateIntegerValue(i), NULL);
284 UpdateProviderPolicy(policy); 281 UpdateProviderPolicy(policy);
285 const base::Value* value = NULL; 282 const base::Value* value = NULL;
286 EXPECT_FALSE(store_->GetValue(prefs::kProxy, &value)); 283 EXPECT_FALSE(store_->GetValue(prefs::kProxy, &value));
287 } 284 }
288 } 285 }
289 286
290 } // namespace policy 287 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698