OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "components/policy/core/common/schema.h" | 9 #include "components/policy/core/common/schema.h" |
10 #include "policy/policy_constants.h" | 10 #include "policy/policy_constants.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 // This unittest tests the code generated by | 13 // This unittest tests the code generated by |
14 // chrome/tools/build/generate_policy_source.py. | 14 // chrome/tools/build/generate_policy_source.py. |
15 | 15 |
16 namespace policy { | 16 namespace policy { |
17 | 17 |
18 TEST(GeneratePolicySource, ChromeSchemaData) { | 18 TEST(GeneratePolicySource, ChromeSchemaData) { |
19 scoped_ptr<SchemaOwner> schema_owner = | 19 Schema schema = Schema::Wrap(GetChromeSchemaData()); |
20 SchemaOwner::Wrap(GetChromeSchemaData()); | 20 ASSERT_TRUE(schema.valid()); |
21 ASSERT_TRUE(schema_owner); | |
22 | |
23 Schema schema = schema_owner->schema(); | |
24 EXPECT_EQ(base::Value::TYPE_DICTIONARY, schema.type()); | 21 EXPECT_EQ(base::Value::TYPE_DICTIONARY, schema.type()); |
25 | 22 |
26 Schema subschema = schema.GetAdditionalProperties(); | 23 Schema subschema = schema.GetAdditionalProperties(); |
27 EXPECT_FALSE(subschema.valid()); | 24 EXPECT_FALSE(subschema.valid()); |
28 | 25 |
29 subschema = schema.GetProperty("no such policy exists"); | 26 subschema = schema.GetProperty("no such policy exists"); |
30 EXPECT_FALSE(subschema.valid()); | 27 EXPECT_FALSE(subschema.valid()); |
31 | 28 |
32 subschema = schema.GetProperty(key::kAlternateErrorPagesEnabled); | 29 subschema = schema.GetProperty(key::kAlternateErrorPagesEnabled); |
33 ASSERT_TRUE(subschema.valid()); | 30 ASSERT_TRUE(subschema.valid()); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 !it.IsAtEnd(); it.Advance(), ++next) { | 69 !it.IsAtEnd(); it.Advance(), ++next) { |
73 ASSERT_TRUE(*next != NULL); | 70 ASSERT_TRUE(*next != NULL); |
74 EXPECT_STREQ(*next, it.key()); | 71 EXPECT_STREQ(*next, it.key()); |
75 ASSERT_TRUE(it.schema().valid()); | 72 ASSERT_TRUE(it.schema().valid()); |
76 EXPECT_EQ(base::Value::TYPE_STRING, it.schema().type()); | 73 EXPECT_EQ(base::Value::TYPE_STRING, it.schema().type()); |
77 } | 74 } |
78 EXPECT_TRUE(*next == NULL); | 75 EXPECT_TRUE(*next == NULL); |
79 } | 76 } |
80 | 77 |
81 } // namespace policy | 78 } // namespace policy |
OLD | NEW |