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 "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "components/policy/core/common/schema_internal.h" | 9 #include "components/policy/core/common/schema_internal.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 // Unknown name. | 629 // Unknown name. |
630 bundle.Clear(); | 630 bundle.Clear(); |
631 bundle.SetBoolean("Unknown", true); | 631 bundle.SetBoolean("Unknown", true); |
632 TestSchemaValidation(schema, bundle, SCHEMA_STRICT, false); | 632 TestSchemaValidation(schema, bundle, SCHEMA_STRICT, false); |
633 | 633 |
634 // All of these will be valid. | 634 // All of these will be valid. |
635 bundle.Clear(); | 635 bundle.Clear(); |
636 bundle.SetBoolean("Boolean", true); | 636 bundle.SetBoolean("Boolean", true); |
637 bundle.SetInteger("Integer", 123); | 637 bundle.SetInteger("Integer", 123); |
638 bundle.Set("Null", base::Value::CreateNullValue()); | 638 bundle.Set("Null", base::Value::CreateNullValue()); |
639 bundle.Set("Number", base::Value::CreateDoubleValue(3.14)); | 639 bundle.Set("Number", new base::FundamentalValue(3.14)); |
640 bundle.SetString("String", "omg"); | 640 bundle.SetString("String", "omg"); |
641 | 641 |
642 { | 642 { |
643 base::ListValue list; | 643 base::ListValue list; |
644 list.AppendString("a string"); | 644 list.AppendString("a string"); |
645 list.AppendString("another string"); | 645 list.AppendString("another string"); |
646 bundle.Set("Array", list.DeepCopy()); | 646 bundle.Set("Array", list.DeepCopy()); |
647 } | 647 } |
648 | 648 |
649 { | 649 { |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1170 | 1170 |
1171 EXPECT_FALSE(ParseFails(SchemaObjectWrapper( | 1171 EXPECT_FALSE(ParseFails(SchemaObjectWrapper( |
1172 "{" | 1172 "{" |
1173 " \"type\": \"integer\"," | 1173 " \"type\": \"integer\"," |
1174 " \"minimum\": 10," | 1174 " \"minimum\": 10," |
1175 " \"maximum\": 20" | 1175 " \"maximum\": 20" |
1176 "}"))); | 1176 "}"))); |
1177 } | 1177 } |
1178 | 1178 |
1179 } // namespace policy | 1179 } // namespace policy |
OLD | NEW |