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 "components/policy/core/common/policy_loader_win.h" | 5 #include "components/policy/core/common/policy_loader_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <userenv.h> | 10 #include <userenv.h> |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 RegKey key(hive_, | 391 RegKey key(hive_, |
392 (base::string16(kTestPolicyKey) + base::ASCIIToUTF16("\\") + | 392 (base::string16(kTestPolicyKey) + base::ASCIIToUTF16("\\") + |
393 UTF8ToUTF16(policy_name)).c_str(), | 393 UTF8ToUTF16(policy_name)).c_str(), |
394 KEY_ALL_ACCESS); | 394 KEY_ALL_ACCESS); |
395 ASSERT_TRUE(key.Valid()); | 395 ASSERT_TRUE(key.Valid()); |
396 int index = 1; | 396 int index = 1; |
397 for (base::ListValue::const_iterator element(policy_value->begin()); | 397 for (base::ListValue::const_iterator element(policy_value->begin()); |
398 element != policy_value->end(); | 398 element != policy_value->end(); |
399 ++element) { | 399 ++element) { |
400 std::string element_value; | 400 std::string element_value; |
401 if (!(*element)->GetAsString(&element_value)) | 401 if (!element->GetAsString(&element_value)) |
402 continue; | 402 continue; |
403 std::string name(base::IntToString(index++)); | 403 std::string name(base::IntToString(index++)); |
404 key.WriteValue(UTF8ToUTF16(name).c_str(), | 404 key.WriteValue(UTF8ToUTF16(name).c_str(), |
405 UTF8ToUTF16(element_value).c_str()); | 405 UTF8ToUTF16(element_value).c_str()); |
406 } | 406 } |
407 } | 407 } |
408 | 408 |
409 void RegistryTestHarness::InstallDictionaryPolicy( | 409 void RegistryTestHarness::InstallDictionaryPolicy( |
410 const std::string& policy_name, | 410 const std::string& policy_name, |
411 const base::DictionaryValue* policy_value) { | 411 const base::DictionaryValue* policy_value) { |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1185 expected.Get(ns_a).LoadFrom(&expected_a, POLICY_LEVEL_MANDATORY, | 1185 expected.Get(ns_a).LoadFrom(&expected_a, POLICY_LEVEL_MANDATORY, |
1186 POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM); | 1186 POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM); |
1187 base::DictionaryValue expected_b; | 1187 base::DictionaryValue expected_b; |
1188 expected_b.SetInteger("policy 1", 2); | 1188 expected_b.SetInteger("policy 1", 2); |
1189 expected.Get(ns_b).LoadFrom(&expected_b, POLICY_LEVEL_MANDATORY, | 1189 expected.Get(ns_b).LoadFrom(&expected_b, POLICY_LEVEL_MANDATORY, |
1190 POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM); | 1190 POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM); |
1191 EXPECT_TRUE(Matches(expected)); | 1191 EXPECT_TRUE(Matches(expected)); |
1192 } | 1192 } |
1193 | 1193 |
1194 } // namespace policy | 1194 } // namespace policy |
OLD | NEW |