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 "components/policy/core/common/schema.h" | 5 #include "components/policy/core/common/schema.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 // Unknown name. | 634 // Unknown name. |
635 bundle.Clear(); | 635 bundle.Clear(); |
636 bundle.SetBoolean("Unknown", true); | 636 bundle.SetBoolean("Unknown", true); |
637 TestSchemaValidation(schema, bundle, SCHEMA_STRICT, false); | 637 TestSchemaValidation(schema, bundle, SCHEMA_STRICT, false); |
638 | 638 |
639 // All of these will be valid. | 639 // All of these will be valid. |
640 bundle.Clear(); | 640 bundle.Clear(); |
641 bundle.SetBoolean("Boolean", true); | 641 bundle.SetBoolean("Boolean", true); |
642 bundle.SetInteger("Integer", 123); | 642 bundle.SetInteger("Integer", 123); |
643 bundle.Set("Null", base::Value::CreateNullValue()); | 643 bundle.Set("Null", base::Value::CreateNullValue()); |
644 bundle.Set("Number", new base::FundamentalValue(3.14)); | 644 bundle.Set("Number", new base::Value(3.14)); |
645 bundle.SetString("String", "omg"); | 645 bundle.SetString("String", "omg"); |
646 | 646 |
647 { | 647 { |
648 base::ListValue list; | 648 base::ListValue list; |
649 list.AppendString("a string"); | 649 list.AppendString("a string"); |
650 list.AppendString("another string"); | 650 list.AppendString("another string"); |
651 bundle.Set("Array", list.DeepCopy()); | 651 bundle.Set("Array", list.DeepCopy()); |
652 } | 652 } |
653 | 653 |
654 { | 654 { |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 | 1177 |
1178 EXPECT_FALSE(ParseFails(SchemaObjectWrapper( | 1178 EXPECT_FALSE(ParseFails(SchemaObjectWrapper( |
1179 "{" | 1179 "{" |
1180 " \"type\": \"integer\"," | 1180 " \"type\": \"integer\"," |
1181 " \"minimum\": 10," | 1181 " \"minimum\": 10," |
1182 " \"maximum\": 20" | 1182 " \"maximum\": 20" |
1183 "}"))); | 1183 "}"))); |
1184 } | 1184 } |
1185 | 1185 |
1186 } // namespace policy | 1186 } // namespace policy |
OLD | NEW |