OLD | NEW |
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/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/net/proxy_policy_handler.h" | 9 #include "chrome/browser/net/proxy_policy_handler.h" |
10 #include "components/policy/core/browser/configuration_policy_pref_store.h" | 10 #include "components/policy/core/browser/configuration_policy_pref_store.h" |
11 #include "components/policy/core/browser/configuration_policy_pref_store_test.h" | 11 #include "components/policy/core/browser/configuration_policy_pref_store_test.h" |
12 #include "components/policy/core/common/policy_service_impl.h" | 12 #include "components/policy/core/common/policy_service_impl.h" |
13 #include "components/policy/core/common/policy_types.h" | |
14 #include "components/proxy_config/proxy_config_dictionary.h" | 13 #include "components/proxy_config/proxy_config_dictionary.h" |
15 #include "components/proxy_config/proxy_config_pref_names.h" | 14 #include "components/proxy_config/proxy_config_pref_names.h" |
16 #include "policy/policy_constants.h" | 15 #include "policy/policy_constants.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
18 | 17 |
19 namespace policy { | 18 namespace policy { |
20 | 19 |
21 // Test cases for the proxy policy settings. | 20 // Test cases for the proxy policy settings. |
22 class ProxyPolicyHandlerTest | 21 class ProxyPolicyHandlerTest |
23 : public ConfigurationPolicyPrefStoreTest { | 22 : public ConfigurationPolicyPrefStoreTest { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 ASSERT_TRUE(dict.GetMode(&mode)); | 69 ASSERT_TRUE(dict.GetMode(&mode)); |
71 EXPECT_EQ(expected_proxy_mode, mode); | 70 EXPECT_EQ(expected_proxy_mode, mode); |
72 } | 71 } |
73 }; | 72 }; |
74 | 73 |
75 TEST_F(ProxyPolicyHandlerTest, ManualOptions) { | 74 TEST_F(ProxyPolicyHandlerTest, ManualOptions) { |
76 PolicyMap policy; | 75 PolicyMap policy; |
77 policy.Set(key::kProxyBypassList, | 76 policy.Set(key::kProxyBypassList, |
78 POLICY_LEVEL_MANDATORY, | 77 POLICY_LEVEL_MANDATORY, |
79 POLICY_SCOPE_USER, | 78 POLICY_SCOPE_USER, |
80 POLICY_SOURCE_CLOUD, | |
81 new base::StringValue("http://chromium.org/override"), | 79 new base::StringValue("http://chromium.org/override"), |
82 NULL); | 80 NULL); |
83 policy.Set(key::kProxyServer, | 81 policy.Set(key::kProxyServer, |
84 POLICY_LEVEL_MANDATORY, | 82 POLICY_LEVEL_MANDATORY, |
85 POLICY_SCOPE_USER, | 83 POLICY_SCOPE_USER, |
86 POLICY_SOURCE_CLOUD, | |
87 new base::StringValue("chromium.org"), | 84 new base::StringValue("chromium.org"), |
88 NULL); | 85 NULL); |
89 policy.Set( | 86 policy.Set( |
90 key::kProxyServerMode, | 87 key::kProxyServerMode, |
91 POLICY_LEVEL_MANDATORY, | 88 POLICY_LEVEL_MANDATORY, |
92 POLICY_SCOPE_USER, | 89 POLICY_SCOPE_USER, |
93 POLICY_SOURCE_CLOUD, | |
94 new base::FundamentalValue( | 90 new base::FundamentalValue( |
95 ProxyPolicyHandler::PROXY_MANUALLY_CONFIGURED_PROXY_SERVER_MODE), | 91 ProxyPolicyHandler::PROXY_MANUALLY_CONFIGURED_PROXY_SERVER_MODE), |
96 NULL); | 92 NULL); |
97 UpdateProviderPolicy(policy); | 93 UpdateProviderPolicy(policy); |
98 | 94 |
99 VerifyProxyPrefs("chromium.org", | 95 VerifyProxyPrefs("chromium.org", |
100 std::string(), | 96 std::string(), |
101 "http://chromium.org/override", | 97 "http://chromium.org/override", |
102 ProxyPrefs::MODE_FIXED_SERVERS); | 98 ProxyPrefs::MODE_FIXED_SERVERS); |
103 } | 99 } |
104 | 100 |
105 TEST_F(ProxyPolicyHandlerTest, ManualOptionsReversedApplyOrder) { | 101 TEST_F(ProxyPolicyHandlerTest, ManualOptionsReversedApplyOrder) { |
106 PolicyMap policy; | 102 PolicyMap policy; |
107 policy.Set( | 103 policy.Set( |
108 key::kProxyServerMode, | 104 key::kProxyServerMode, |
109 POLICY_LEVEL_MANDATORY, | 105 POLICY_LEVEL_MANDATORY, |
110 POLICY_SCOPE_USER, | 106 POLICY_SCOPE_USER, |
111 POLICY_SOURCE_CLOUD, | |
112 new base::FundamentalValue( | 107 new base::FundamentalValue( |
113 ProxyPolicyHandler::PROXY_MANUALLY_CONFIGURED_PROXY_SERVER_MODE), | 108 ProxyPolicyHandler::PROXY_MANUALLY_CONFIGURED_PROXY_SERVER_MODE), |
114 NULL); | 109 NULL); |
115 policy.Set(key::kProxyBypassList, | 110 policy.Set(key::kProxyBypassList, |
116 POLICY_LEVEL_MANDATORY, | 111 POLICY_LEVEL_MANDATORY, |
117 POLICY_SCOPE_USER, | 112 POLICY_SCOPE_USER, |
118 POLICY_SOURCE_CLOUD, | |
119 new base::StringValue("http://chromium.org/override"), | 113 new base::StringValue("http://chromium.org/override"), |
120 NULL); | 114 NULL); |
121 policy.Set(key::kProxyServer, | 115 policy.Set(key::kProxyServer, |
122 POLICY_LEVEL_MANDATORY, | 116 POLICY_LEVEL_MANDATORY, |
123 POLICY_SCOPE_USER, | 117 POLICY_SCOPE_USER, |
124 POLICY_SOURCE_CLOUD, | |
125 new base::StringValue("chromium.org"), | 118 new base::StringValue("chromium.org"), |
126 NULL); | 119 NULL); |
127 UpdateProviderPolicy(policy); | 120 UpdateProviderPolicy(policy); |
128 | 121 |
129 VerifyProxyPrefs("chromium.org", | 122 VerifyProxyPrefs("chromium.org", |
130 std::string(), | 123 std::string(), |
131 "http://chromium.org/override", | 124 "http://chromium.org/override", |
132 ProxyPrefs::MODE_FIXED_SERVERS); | 125 ProxyPrefs::MODE_FIXED_SERVERS); |
133 } | 126 } |
134 | 127 |
135 TEST_F(ProxyPolicyHandlerTest, ManualOptionsInvalid) { | 128 TEST_F(ProxyPolicyHandlerTest, ManualOptionsInvalid) { |
136 PolicyMap policy; | 129 PolicyMap policy; |
137 policy.Set( | 130 policy.Set( |
138 key::kProxyServerMode, | 131 key::kProxyServerMode, |
139 POLICY_LEVEL_MANDATORY, | 132 POLICY_LEVEL_MANDATORY, |
140 POLICY_SCOPE_USER, | 133 POLICY_SCOPE_USER, |
141 POLICY_SOURCE_CLOUD, | |
142 new base::FundamentalValue( | 134 new base::FundamentalValue( |
143 ProxyPolicyHandler::PROXY_MANUALLY_CONFIGURED_PROXY_SERVER_MODE), | 135 ProxyPolicyHandler::PROXY_MANUALLY_CONFIGURED_PROXY_SERVER_MODE), |
144 NULL); | 136 NULL); |
145 UpdateProviderPolicy(policy); | 137 UpdateProviderPolicy(policy); |
146 | 138 |
147 const base::Value* value = NULL; | 139 const base::Value* value = NULL; |
148 EXPECT_FALSE(store_->GetValue(proxy_config::prefs::kProxy, &value)); | 140 EXPECT_FALSE(store_->GetValue(proxy_config::prefs::kProxy, &value)); |
149 } | 141 } |
150 | 142 |
151 TEST_F(ProxyPolicyHandlerTest, NoProxyServerMode) { | 143 TEST_F(ProxyPolicyHandlerTest, NoProxyServerMode) { |
152 PolicyMap policy; | 144 PolicyMap policy; |
153 policy.Set(key::kProxyServerMode, | 145 policy.Set(key::kProxyServerMode, |
154 POLICY_LEVEL_MANDATORY, | 146 POLICY_LEVEL_MANDATORY, |
155 POLICY_SCOPE_USER, | 147 POLICY_SCOPE_USER, |
156 POLICY_SOURCE_CLOUD, | |
157 new base::FundamentalValue(ProxyPolicyHandler::PROXY_SERVER_MODE), | 148 new base::FundamentalValue(ProxyPolicyHandler::PROXY_SERVER_MODE), |
158 NULL); | 149 NULL); |
159 UpdateProviderPolicy(policy); | 150 UpdateProviderPolicy(policy); |
160 VerifyProxyPrefs( | 151 VerifyProxyPrefs( |
161 std::string(), std::string(), std::string(), ProxyPrefs::MODE_DIRECT); | 152 std::string(), std::string(), std::string(), ProxyPrefs::MODE_DIRECT); |
162 } | 153 } |
163 | 154 |
164 TEST_F(ProxyPolicyHandlerTest, NoProxyModeName) { | 155 TEST_F(ProxyPolicyHandlerTest, NoProxyModeName) { |
165 PolicyMap policy; | 156 PolicyMap policy; |
166 policy.Set(key::kProxyMode, | 157 policy.Set(key::kProxyMode, |
167 POLICY_LEVEL_MANDATORY, | 158 POLICY_LEVEL_MANDATORY, |
168 POLICY_SCOPE_USER, | 159 POLICY_SCOPE_USER, |
169 POLICY_SOURCE_CLOUD, | |
170 new base::StringValue(ProxyPrefs::kDirectProxyModeName), | 160 new base::StringValue(ProxyPrefs::kDirectProxyModeName), |
171 NULL); | 161 NULL); |
172 UpdateProviderPolicy(policy); | 162 UpdateProviderPolicy(policy); |
173 VerifyProxyPrefs( | 163 VerifyProxyPrefs( |
174 std::string(), std::string(), std::string(), ProxyPrefs::MODE_DIRECT); | 164 std::string(), std::string(), std::string(), ProxyPrefs::MODE_DIRECT); |
175 } | 165 } |
176 | 166 |
177 TEST_F(ProxyPolicyHandlerTest, AutoDetectProxyServerMode) { | 167 TEST_F(ProxyPolicyHandlerTest, AutoDetectProxyServerMode) { |
178 PolicyMap policy; | 168 PolicyMap policy; |
179 policy.Set(key::kProxyServerMode, | 169 policy.Set(key::kProxyServerMode, |
180 POLICY_LEVEL_MANDATORY, | 170 POLICY_LEVEL_MANDATORY, |
181 POLICY_SCOPE_USER, | 171 POLICY_SCOPE_USER, |
182 POLICY_SOURCE_CLOUD, | |
183 new base::FundamentalValue( | 172 new base::FundamentalValue( |
184 ProxyPolicyHandler::PROXY_AUTO_DETECT_PROXY_SERVER_MODE), | 173 ProxyPolicyHandler::PROXY_AUTO_DETECT_PROXY_SERVER_MODE), |
185 NULL); | 174 NULL); |
186 UpdateProviderPolicy(policy); | 175 UpdateProviderPolicy(policy); |
187 VerifyProxyPrefs(std::string(), | 176 VerifyProxyPrefs(std::string(), |
188 std::string(), | 177 std::string(), |
189 std::string(), | 178 std::string(), |
190 ProxyPrefs::MODE_AUTO_DETECT); | 179 ProxyPrefs::MODE_AUTO_DETECT); |
191 } | 180 } |
192 | 181 |
193 TEST_F(ProxyPolicyHandlerTest, AutoDetectProxyModeName) { | 182 TEST_F(ProxyPolicyHandlerTest, AutoDetectProxyModeName) { |
194 PolicyMap policy; | 183 PolicyMap policy; |
195 policy.Set(key::kProxyMode, | 184 policy.Set(key::kProxyMode, |
196 POLICY_LEVEL_MANDATORY, | 185 POLICY_LEVEL_MANDATORY, |
197 POLICY_SCOPE_USER, | 186 POLICY_SCOPE_USER, |
198 POLICY_SOURCE_CLOUD, | |
199 new base::StringValue(ProxyPrefs::kAutoDetectProxyModeName), | 187 new base::StringValue(ProxyPrefs::kAutoDetectProxyModeName), |
200 NULL); | 188 NULL); |
201 UpdateProviderPolicy(policy); | 189 UpdateProviderPolicy(policy); |
202 VerifyProxyPrefs(std::string(), | 190 VerifyProxyPrefs(std::string(), |
203 std::string(), | 191 std::string(), |
204 std::string(), | 192 std::string(), |
205 ProxyPrefs::MODE_AUTO_DETECT); | 193 ProxyPrefs::MODE_AUTO_DETECT); |
206 } | 194 } |
207 | 195 |
208 TEST_F(ProxyPolicyHandlerTest, PacScriptProxyMode) { | 196 TEST_F(ProxyPolicyHandlerTest, PacScriptProxyMode) { |
209 PolicyMap policy; | 197 PolicyMap policy; |
210 policy.Set(key::kProxyPacUrl, | 198 policy.Set(key::kProxyPacUrl, |
211 POLICY_LEVEL_MANDATORY, | 199 POLICY_LEVEL_MANDATORY, |
212 POLICY_SCOPE_USER, | 200 POLICY_SCOPE_USER, |
213 POLICY_SOURCE_CLOUD, | |
214 new base::StringValue("http://short.org/proxy.pac"), | 201 new base::StringValue("http://short.org/proxy.pac"), |
215 NULL); | 202 NULL); |
216 policy.Set(key::kProxyMode, | 203 policy.Set(key::kProxyMode, |
217 POLICY_LEVEL_MANDATORY, | 204 POLICY_LEVEL_MANDATORY, |
218 POLICY_SCOPE_USER, | 205 POLICY_SCOPE_USER, |
219 POLICY_SOURCE_CLOUD, | |
220 new base::StringValue(ProxyPrefs::kPacScriptProxyModeName), | 206 new base::StringValue(ProxyPrefs::kPacScriptProxyModeName), |
221 NULL); | 207 NULL); |
222 UpdateProviderPolicy(policy); | 208 UpdateProviderPolicy(policy); |
223 VerifyProxyPrefs(std::string(), | 209 VerifyProxyPrefs(std::string(), |
224 "http://short.org/proxy.pac", | 210 "http://short.org/proxy.pac", |
225 std::string(), | 211 std::string(), |
226 ProxyPrefs::MODE_PAC_SCRIPT); | 212 ProxyPrefs::MODE_PAC_SCRIPT); |
227 } | 213 } |
228 | 214 |
229 TEST_F(ProxyPolicyHandlerTest, PacScriptProxyModeInvalid) { | 215 TEST_F(ProxyPolicyHandlerTest, PacScriptProxyModeInvalid) { |
230 PolicyMap policy; | 216 PolicyMap policy; |
231 policy.Set(key::kProxyMode, | 217 policy.Set(key::kProxyMode, |
232 POLICY_LEVEL_MANDATORY, | 218 POLICY_LEVEL_MANDATORY, |
233 POLICY_SCOPE_USER, | 219 POLICY_SCOPE_USER, |
234 POLICY_SOURCE_CLOUD, | |
235 new base::StringValue(ProxyPrefs::kPacScriptProxyModeName), | 220 new base::StringValue(ProxyPrefs::kPacScriptProxyModeName), |
236 NULL); | 221 NULL); |
237 UpdateProviderPolicy(policy); | 222 UpdateProviderPolicy(policy); |
238 const base::Value* value = NULL; | 223 const base::Value* value = NULL; |
239 EXPECT_FALSE(store_->GetValue(proxy_config::prefs::kProxy, &value)); | 224 EXPECT_FALSE(store_->GetValue(proxy_config::prefs::kProxy, &value)); |
240 } | 225 } |
241 | 226 |
242 // Regression test for http://crbug.com/78016, CPanel returns empty strings | 227 // Regression test for http://crbug.com/78016, CPanel returns empty strings |
243 // for unset properties. | 228 // for unset properties. |
244 TEST_F(ProxyPolicyHandlerTest, PacScriptProxyModeBug78016) { | 229 TEST_F(ProxyPolicyHandlerTest, PacScriptProxyModeBug78016) { |
245 PolicyMap policy; | 230 PolicyMap policy; |
246 policy.Set(key::kProxyServer, | 231 policy.Set(key::kProxyServer, |
247 POLICY_LEVEL_MANDATORY, | 232 POLICY_LEVEL_MANDATORY, |
248 POLICY_SCOPE_USER, | 233 POLICY_SCOPE_USER, |
249 POLICY_SOURCE_CLOUD, | |
250 new base::StringValue(std::string()), | 234 new base::StringValue(std::string()), |
251 NULL); | 235 NULL); |
252 policy.Set(key::kProxyPacUrl, | 236 policy.Set(key::kProxyPacUrl, |
253 POLICY_LEVEL_MANDATORY, | 237 POLICY_LEVEL_MANDATORY, |
254 POLICY_SCOPE_USER, | 238 POLICY_SCOPE_USER, |
255 POLICY_SOURCE_CLOUD, | |
256 new base::StringValue("http://short.org/proxy.pac"), | 239 new base::StringValue("http://short.org/proxy.pac"), |
257 NULL); | 240 NULL); |
258 policy.Set(key::kProxyMode, | 241 policy.Set(key::kProxyMode, |
259 POLICY_LEVEL_MANDATORY, | 242 POLICY_LEVEL_MANDATORY, |
260 POLICY_SCOPE_USER, | 243 POLICY_SCOPE_USER, |
261 POLICY_SOURCE_CLOUD, | |
262 new base::StringValue(ProxyPrefs::kPacScriptProxyModeName), | 244 new base::StringValue(ProxyPrefs::kPacScriptProxyModeName), |
263 NULL); | 245 NULL); |
264 UpdateProviderPolicy(policy); | 246 UpdateProviderPolicy(policy); |
265 VerifyProxyPrefs(std::string(), | 247 VerifyProxyPrefs(std::string(), |
266 "http://short.org/proxy.pac", | 248 "http://short.org/proxy.pac", |
267 std::string(), | 249 std::string(), |
268 ProxyPrefs::MODE_PAC_SCRIPT); | 250 ProxyPrefs::MODE_PAC_SCRIPT); |
269 } | 251 } |
270 | 252 |
271 TEST_F(ProxyPolicyHandlerTest, UseSystemProxyServerMode) { | 253 TEST_F(ProxyPolicyHandlerTest, UseSystemProxyServerMode) { |
272 PolicyMap policy; | 254 PolicyMap policy; |
273 policy.Set(key::kProxyServerMode, | 255 policy.Set(key::kProxyServerMode, |
274 POLICY_LEVEL_MANDATORY, | 256 POLICY_LEVEL_MANDATORY, |
275 POLICY_SCOPE_USER, | 257 POLICY_SCOPE_USER, |
276 POLICY_SOURCE_CLOUD, | |
277 new base::FundamentalValue( | 258 new base::FundamentalValue( |
278 ProxyPolicyHandler::PROXY_USE_SYSTEM_PROXY_SERVER_MODE), | 259 ProxyPolicyHandler::PROXY_USE_SYSTEM_PROXY_SERVER_MODE), |
279 NULL); | 260 NULL); |
280 UpdateProviderPolicy(policy); | 261 UpdateProviderPolicy(policy); |
281 VerifyProxyPrefs( | 262 VerifyProxyPrefs( |
282 std::string(), std::string(), std::string(), ProxyPrefs::MODE_SYSTEM); | 263 std::string(), std::string(), std::string(), ProxyPrefs::MODE_SYSTEM); |
283 } | 264 } |
284 | 265 |
285 TEST_F(ProxyPolicyHandlerTest, UseSystemProxyMode) { | 266 TEST_F(ProxyPolicyHandlerTest, UseSystemProxyMode) { |
286 PolicyMap policy; | 267 PolicyMap policy; |
287 policy.Set(key::kProxyMode, | 268 policy.Set(key::kProxyMode, |
288 POLICY_LEVEL_MANDATORY, | 269 POLICY_LEVEL_MANDATORY, |
289 POLICY_SCOPE_USER, | 270 POLICY_SCOPE_USER, |
290 POLICY_SOURCE_CLOUD, | |
291 new base::StringValue(ProxyPrefs::kSystemProxyModeName), | 271 new base::StringValue(ProxyPrefs::kSystemProxyModeName), |
292 NULL); | 272 NULL); |
293 UpdateProviderPolicy(policy); | 273 UpdateProviderPolicy(policy); |
294 VerifyProxyPrefs( | 274 VerifyProxyPrefs( |
295 std::string(), std::string(), std::string(), ProxyPrefs::MODE_SYSTEM); | 275 std::string(), std::string(), std::string(), ProxyPrefs::MODE_SYSTEM); |
296 } | 276 } |
297 | 277 |
298 TEST_F(ProxyPolicyHandlerTest, | 278 TEST_F(ProxyPolicyHandlerTest, |
299 ProxyModeOverridesProxyServerMode) { | 279 ProxyModeOverridesProxyServerMode) { |
300 PolicyMap policy; | 280 PolicyMap policy; |
301 policy.Set(key::kProxyServerMode, | 281 policy.Set(key::kProxyServerMode, |
302 POLICY_LEVEL_MANDATORY, | 282 POLICY_LEVEL_MANDATORY, |
303 POLICY_SCOPE_USER, | 283 POLICY_SCOPE_USER, |
304 POLICY_SOURCE_CLOUD, | |
305 new base::FundamentalValue(ProxyPolicyHandler::PROXY_SERVER_MODE), | 284 new base::FundamentalValue(ProxyPolicyHandler::PROXY_SERVER_MODE), |
306 NULL); | 285 NULL); |
307 policy.Set(key::kProxyMode, | 286 policy.Set(key::kProxyMode, |
308 POLICY_LEVEL_MANDATORY, | 287 POLICY_LEVEL_MANDATORY, |
309 POLICY_SCOPE_USER, | 288 POLICY_SCOPE_USER, |
310 POLICY_SOURCE_CLOUD, | |
311 new base::StringValue(ProxyPrefs::kAutoDetectProxyModeName), | 289 new base::StringValue(ProxyPrefs::kAutoDetectProxyModeName), |
312 NULL); | 290 NULL); |
313 UpdateProviderPolicy(policy); | 291 UpdateProviderPolicy(policy); |
314 VerifyProxyPrefs(std::string(), | 292 VerifyProxyPrefs(std::string(), |
315 std::string(), | 293 std::string(), |
316 std::string(), | 294 std::string(), |
317 ProxyPrefs::MODE_AUTO_DETECT); | 295 ProxyPrefs::MODE_AUTO_DETECT); |
318 } | 296 } |
319 | 297 |
320 TEST_F(ProxyPolicyHandlerTest, ProxyInvalid) { | 298 TEST_F(ProxyPolicyHandlerTest, ProxyInvalid) { |
321 // No mode expects all three parameters being set. | 299 // No mode expects all three parameters being set. |
322 PolicyMap policy; | 300 PolicyMap policy; |
323 policy.Set(key::kProxyPacUrl, | 301 policy.Set(key::kProxyPacUrl, |
324 POLICY_LEVEL_MANDATORY, | 302 POLICY_LEVEL_MANDATORY, |
325 POLICY_SCOPE_USER, | 303 POLICY_SCOPE_USER, |
326 POLICY_SOURCE_CLOUD, | |
327 new base::StringValue("http://short.org/proxy.pac"), | 304 new base::StringValue("http://short.org/proxy.pac"), |
328 NULL); | 305 NULL); |
329 policy.Set(key::kProxyBypassList, | 306 policy.Set(key::kProxyBypassList, |
330 POLICY_LEVEL_MANDATORY, | 307 POLICY_LEVEL_MANDATORY, |
331 POLICY_SCOPE_USER, | 308 POLICY_SCOPE_USER, |
332 POLICY_SOURCE_CLOUD, | |
333 new base::StringValue("http://chromium.org/override"), | 309 new base::StringValue("http://chromium.org/override"), |
334 NULL); | 310 NULL); |
335 policy.Set(key::kProxyServer, | 311 policy.Set(key::kProxyServer, |
336 POLICY_LEVEL_MANDATORY, | 312 POLICY_LEVEL_MANDATORY, |
337 POLICY_SCOPE_USER, | 313 POLICY_SCOPE_USER, |
338 POLICY_SOURCE_CLOUD, | |
339 new base::StringValue("chromium.org"), | 314 new base::StringValue("chromium.org"), |
340 NULL); | 315 NULL); |
341 for (int i = 0; i < ProxyPolicyHandler::MODE_COUNT; ++i) { | 316 for (int i = 0; i < ProxyPolicyHandler::MODE_COUNT; ++i) { |
342 policy.Set(key::kProxyServerMode, | 317 policy.Set(key::kProxyServerMode, |
343 POLICY_LEVEL_MANDATORY, | 318 POLICY_LEVEL_MANDATORY, |
344 POLICY_SCOPE_USER, | 319 POLICY_SCOPE_USER, |
345 POLICY_SOURCE_CLOUD, | |
346 new base::FundamentalValue(i), | 320 new base::FundamentalValue(i), |
347 NULL); | 321 NULL); |
348 UpdateProviderPolicy(policy); | 322 UpdateProviderPolicy(policy); |
349 const base::Value* value = NULL; | 323 const base::Value* value = NULL; |
350 EXPECT_FALSE(store_->GetValue(proxy_config::prefs::kProxy, &value)); | 324 EXPECT_FALSE(store_->GetValue(proxy_config::prefs::kProxy, &value)); |
351 } | 325 } |
352 } | 326 } |
353 | 327 |
354 } // namespace policy | 328 } // namespace policy |
OLD | NEW |