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 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 " \"double\": { \"type\": \"number\" }," | 895 " \"double\": { \"type\": \"number\" }," |
896 " \"list\": {" | 896 " \"list\": {" |
897 " \"type\": \"array\"," | 897 " \"type\": \"array\"," |
898 " \"items\": { \"$ref\": \"MainType\" }" | 898 " \"items\": { \"$ref\": \"MainType\" }" |
899 " }," | 899 " }," |
900 " \"dict\": { \"$ref\": \"MainType\" }" | 900 " \"dict\": { \"$ref\": \"MainType\" }" |
901 " }" | 901 " }" |
902 "}")); | 902 "}")); |
903 | 903 |
904 base::DictionaryValue policy; | 904 base::DictionaryValue policy; |
905 policy.Set("null", base::Value::CreateNullValue()); | 905 policy.Set("null", base::MakeUnique<base::Value>()); |
906 policy.SetBoolean("bool", true); | 906 policy.SetBoolean("bool", true); |
907 policy.SetInteger("int", -123); | 907 policy.SetInteger("int", -123); |
908 policy.SetDouble("double", 456.78e9); | 908 policy.SetDouble("double", 456.78e9); |
909 base::ListValue list; | 909 base::ListValue list; |
910 list.Append(policy.DeepCopy()); | 910 list.Append(policy.DeepCopy()); |
911 list.Append(policy.DeepCopy()); | 911 list.Append(policy.DeepCopy()); |
912 policy.Set("list", list.DeepCopy()); | 912 policy.Set("list", list.DeepCopy()); |
913 // Encode |policy| before adding the "dict" entry. | 913 // Encode |policy| before adding the "dict" entry. |
914 std::string encoded_dict; | 914 std::string encoded_dict; |
915 base::JSONWriter::Write(policy, &encoded_dict); | 915 base::JSONWriter::Write(policy, &encoded_dict); |
(...skipping 269 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 |