OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 expected_values[policy::key::kHomepageLocation] = "http://google.com"; | 215 expected_values[policy::key::kHomepageLocation] = "http://google.com"; |
216 values.Set(policy::key::kRestoreOnStartup, | 216 values.Set(policy::key::kRestoreOnStartup, |
217 policy::POLICY_LEVEL_RECOMMENDED, | 217 policy::POLICY_LEVEL_RECOMMENDED, |
218 policy::POLICY_SCOPE_USER, | 218 policy::POLICY_SCOPE_USER, |
219 base::Value::CreateIntegerValue(4), | 219 base::Value::CreateIntegerValue(4), |
220 NULL); | 220 NULL); |
221 expected_values[policy::key::kRestoreOnStartup] = "4"; | 221 expected_values[policy::key::kRestoreOnStartup] = "4"; |
222 values.Set(policy::key::kShowHomeButton, | 222 values.Set(policy::key::kShowHomeButton, |
223 policy::POLICY_LEVEL_RECOMMENDED, | 223 policy::POLICY_LEVEL_RECOMMENDED, |
224 policy::POLICY_SCOPE_MACHINE, | 224 policy::POLICY_SCOPE_MACHINE, |
225 base::Value::CreateBooleanValue(true), | 225 new base::FundamentalValue(true), |
226 NULL); | 226 NULL); |
227 expected_values[policy::key::kShowHomeButton] = "true"; | 227 expected_values[policy::key::kShowHomeButton] = "true"; |
228 // Set the value of a policy that does not exist. | 228 // Set the value of a policy that does not exist. |
229 const std::string kUnknownPolicy = "NoSuchThing"; | 229 const std::string kUnknownPolicy = "NoSuchThing"; |
230 values.Set(kUnknownPolicy, | 230 values.Set(kUnknownPolicy, |
231 policy::POLICY_LEVEL_MANDATORY, | 231 policy::POLICY_LEVEL_MANDATORY, |
232 policy::POLICY_SCOPE_USER, | 232 policy::POLICY_SCOPE_USER, |
233 base::Value::CreateBooleanValue(true), | 233 new base::FundamentalValue(true), |
234 NULL); | 234 NULL); |
235 expected_values[kUnknownPolicy] = "true"; | 235 expected_values[kUnknownPolicy] = "true"; |
236 UpdateProviderPolicy(values); | 236 UpdateProviderPolicy(values); |
237 | 237 |
238 // Expect that the policy table contains, in order: | 238 // Expect that the policy table contains, in order: |
239 // * All known policies whose value has been set, in alphabetical order. | 239 // * All known policies whose value has been set, in alphabetical order. |
240 // * The unknown policy. | 240 // * The unknown policy. |
241 // * All known policies whose value has not been set, in alphabetical order. | 241 // * All known policies whose value has not been set, in alphabetical order. |
242 std::vector<std::vector<std::string> > expected_policies; | 242 std::vector<std::vector<std::string> > expected_policies; |
243 size_t first_unset_position = 0; | 243 size_t first_unset_position = 0; |
(...skipping 16 matching lines...) Expand all Loading... |
260 expected_policies.begin() + first_unset_position++, | 260 expected_policies.begin() + first_unset_position++, |
261 PopulateExpectedPolicy(kUnknownPolicy, | 261 PopulateExpectedPolicy(kUnknownPolicy, |
262 expected_values[kUnknownPolicy], | 262 expected_values[kUnknownPolicy], |
263 values.Get(kUnknownPolicy), | 263 values.Get(kUnknownPolicy), |
264 true)); | 264 true)); |
265 | 265 |
266 // Retrieve the contents of the policy table from the UI and verify that it | 266 // Retrieve the contents of the policy table from the UI and verify that it |
267 // matches the expectation. | 267 // matches the expectation. |
268 VerifyPolicies(expected_policies); | 268 VerifyPolicies(expected_policies); |
269 } | 269 } |
OLD | NEW |