OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/policy/cloud_policy_provider.h" | 5 #include "chrome/browser/policy/cloud_policy_provider.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/policy/cloud_policy_cache_base.h" | 9 #include "chrome/browser/policy/cloud_policy_cache_base.h" |
10 #include "chrome/browser/policy/cloud_policy_provider_impl.h" | 10 #include "chrome/browser/policy/cloud_policy_provider_impl.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 TEST_F(CloudPolicyProviderTest, | 121 TEST_F(CloudPolicyProviderTest, |
122 ProxySettingDistributedOverMultipleCaches) { | 122 ProxySettingDistributedOverMultipleCaches) { |
123 // There are proxy_policy_count()+1 = 6 caches and they are mixed together by | 123 // There are proxy_policy_count()+1 = 6 caches and they are mixed together by |
124 // one instance of CloudPolicyProvider. The first cache has some policies but | 124 // one instance of CloudPolicyProvider. The first cache has some policies but |
125 // no proxy-related ones. The following caches have each one proxy-policy set. | 125 // no proxy-related ones. The following caches have each one proxy-policy set. |
126 const int n = 6; | 126 const int n = 6; |
127 MockCloudPolicyCache caches[n]; | 127 MockCloudPolicyCache caches[n]; |
128 | 128 |
129 // Prepare |cache[0]| to serve some non-proxy policies. | 129 // Prepare |cache[0]| to serve some non-proxy policies. |
130 caches[0].raw_mandatory_policy()->Set(kPolicyShowHomeButton, | 130 caches[0].raw_mandatory_policy()->Set(kPolicyShowHomeButton, |
131 Value::CreateBooleanValue(true)); | 131 base::TrueValue()); |
132 caches[0].raw_mandatory_policy()->Set(kPolicyIncognitoEnabled, | 132 caches[0].raw_mandatory_policy()->Set(kPolicyIncognitoEnabled, |
133 Value::CreateBooleanValue(true)); | 133 base::TrueValue()); |
134 caches[0].raw_mandatory_policy()->Set(kPolicyTranslateEnabled, | 134 caches[0].raw_mandatory_policy()->Set(kPolicyTranslateEnabled, |
135 Value::CreateBooleanValue(true)); | 135 base::TrueValue()); |
136 caches[0].set_initialized(true); | 136 caches[0].set_initialized(true); |
137 | 137 |
138 // Prepare the other caches to serve one proxy-policy each. | 138 // Prepare the other caches to serve one proxy-policy each. |
139 caches[1].raw_mandatory_policy()->Set(kPolicyProxyMode, | 139 caches[1].raw_mandatory_policy()->Set(kPolicyProxyMode, |
140 Value::CreateStringValue("cache 1")); | 140 Value::CreateStringValue("cache 1")); |
141 caches[1].set_initialized(true); | 141 caches[1].set_initialized(true); |
142 caches[2].raw_mandatory_policy()->Set(kPolicyProxyServerMode, | 142 caches[2].raw_mandatory_policy()->Set(kPolicyProxyServerMode, |
143 Value::CreateIntegerValue(2)); | 143 Value::CreateIntegerValue(2)); |
144 caches[2].set_initialized(true); | 144 caches[2].set_initialized(true); |
145 caches[3].raw_mandatory_policy()->Set(kPolicyProxyServer, | 145 caches[3].raw_mandatory_policy()->Set(kPolicyProxyServer, |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 B.Set(policy::kPolicyProxyPacUrl, Value::CreateIntegerValue(b_value)); | 231 B.Set(policy::kPolicyProxyPacUrl, Value::CreateIntegerValue(b_value)); |
232 B.Set(policy::kPolicyProxyBypassList, Value::CreateIntegerValue(b_value)); | 232 B.Set(policy::kPolicyProxyBypassList, Value::CreateIntegerValue(b_value)); |
233 | 233 |
234 CombineTwoPolicyMaps(A, B, &C); | 234 CombineTwoPolicyMaps(A, B, &C); |
235 | 235 |
236 EXPECT_TRUE(A.Equals(C)); | 236 EXPECT_TRUE(A.Equals(C)); |
237 EXPECT_FALSE(B.Equals(C)); | 237 EXPECT_FALSE(B.Equals(C)); |
238 } | 238 } |
239 | 239 |
240 } // namespace policy | 240 } // namespace policy |
OLD | NEW |