| 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 "components/policy/core/common/schema_internal.h" | 7 #include "components/policy/core/common/schema_internal.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace policy { | 10 namespace policy { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 "{" | 104 "{" |
| 105 " \"type\": \"object\"," | 105 " \"type\": \"object\"," |
| 106 " \"properties\": { \"Policy\": { \"type\": \"any\" } }" | 106 " \"properties\": { \"Policy\": { \"type\": \"any\" } }" |
| 107 "}")); | 107 "}")); |
| 108 | 108 |
| 109 EXPECT_TRUE(ParseFails( | 109 EXPECT_TRUE(ParseFails( |
| 110 "{" | 110 "{" |
| 111 " \"type\": \"object\"," | 111 " \"type\": \"object\"," |
| 112 " \"properties\": { \"Policy\": 123 }" | 112 " \"properties\": { \"Policy\": 123 }" |
| 113 "}")); | 113 "}")); |
| 114 |
| 115 EXPECT_FALSE(ParseFails( |
| 116 "{" |
| 117 " \"type\": \"object\"," |
| 118 " \"unknown attribute\": \"is ignored\"" |
| 119 "}")); |
| 114 } | 120 } |
| 115 | 121 |
| 116 TEST(SchemaTest, Ownership) { | 122 TEST(SchemaTest, Ownership) { |
| 117 std::string error; | 123 std::string error; |
| 118 Schema schema = Schema::Parse( | 124 Schema schema = Schema::Parse( |
| 119 "{" | 125 "{" |
| 120 " \"type\": \"object\"," | 126 " \"type\": \"object\"," |
| 121 " \"properties\": {" | 127 " \"properties\": {" |
| 122 " \"sub\": {" | 128 " \"sub\": {" |
| 123 " \"type\": \"object\"," | 129 " \"type\": \"object\"," |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 ASSERT_TRUE(list.valid()); | 677 ASSERT_TRUE(list.valid()); |
| 672 ASSERT_EQ(base::Value::TYPE_LIST, list.type()); | 678 ASSERT_EQ(base::Value::TYPE_LIST, list.type()); |
| 673 | 679 |
| 674 Schema items = list.GetItems(); | 680 Schema items = list.GetItems(); |
| 675 ASSERT_TRUE(items.valid()); | 681 ASSERT_TRUE(items.valid()); |
| 676 ASSERT_EQ(base::Value::TYPE_BOOLEAN, items.type()); | 682 ASSERT_EQ(base::Value::TYPE_BOOLEAN, items.type()); |
| 677 } | 683 } |
| 678 | 684 |
| 679 | 685 |
| 680 } // namespace policy | 686 } // namespace policy |
| OLD | NEW |