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 <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 "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "components/policy/core/common/policy_details.h" | 10 #include "components/policy/core/common/policy_details.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 }; | 76 }; |
77 const char** next = kExpectedProperties; | 77 const char** next = kExpectedProperties; |
78 for (Schema::Iterator it(subschema.GetPropertiesIterator()); | 78 for (Schema::Iterator it(subschema.GetPropertiesIterator()); |
79 !it.IsAtEnd(); it.Advance(), ++next) { | 79 !it.IsAtEnd(); it.Advance(), ++next) { |
80 ASSERT_TRUE(*next != NULL); | 80 ASSERT_TRUE(*next != NULL); |
81 EXPECT_STREQ(*next, it.key()); | 81 EXPECT_STREQ(*next, it.key()); |
82 ASSERT_TRUE(it.schema().valid()); | 82 ASSERT_TRUE(it.schema().valid()); |
83 EXPECT_EQ(base::Value::TYPE_STRING, it.schema().type()); | 83 EXPECT_EQ(base::Value::TYPE_STRING, it.schema().type()); |
84 } | 84 } |
85 EXPECT_TRUE(*next == NULL); | 85 EXPECT_TRUE(*next == NULL); |
86 | |
87 #if defined(OS_CHROMEOS) | |
88 subschema = schema.GetKnownProperty(key::kPowerManagementIdleSettings); | |
89 ASSERT_TRUE(subschema.valid()); | |
90 | |
91 subschema = subschema.GetKnownProperty("Battery"); | |
92 ASSERT_TRUE(subschema.valid()); | |
93 | |
94 subschema = subschema.GetKnownProperty("Delays"); | |
95 ASSERT_TRUE(subschema.valid()); | |
96 | |
97 EXPECT_TRUE(subschema.GetKnownProperty("ScreenDim").valid()); | |
98 EXPECT_TRUE(subschema.GetKnownProperty("ScreenOff").valid()); | |
99 EXPECT_TRUE(subschema.GetKnownProperty("IdleWarning").valid()); | |
100 EXPECT_TRUE(subschema.GetKnownProperty("Idle").valid()); | |
Joao da Silva
2014/04/08 15:02:10
Let's have a more strict test for this: check that
binjin
2014/04/09 11:00:36
Done.
| |
101 #endif | |
86 } | 102 } |
87 | 103 |
88 TEST(GeneratePolicySource, PolicyDetails) { | 104 TEST(GeneratePolicySource, PolicyDetails) { |
89 EXPECT_FALSE(GetChromePolicyDetails("")); | 105 EXPECT_FALSE(GetChromePolicyDetails("")); |
90 EXPECT_FALSE(GetChromePolicyDetails("no such policy")); | 106 EXPECT_FALSE(GetChromePolicyDetails("no such policy")); |
91 EXPECT_FALSE(GetChromePolicyDetails("SearchSuggestEnable")); | 107 EXPECT_FALSE(GetChromePolicyDetails("SearchSuggestEnable")); |
92 EXPECT_FALSE(GetChromePolicyDetails("searchSuggestEnabled")); | 108 EXPECT_FALSE(GetChromePolicyDetails("searchSuggestEnabled")); |
93 EXPECT_FALSE(GetChromePolicyDetails("SSearchSuggestEnabled")); | 109 EXPECT_FALSE(GetChromePolicyDetails("SSearchSuggestEnabled")); |
94 | 110 |
95 const PolicyDetails* details = | 111 const PolicyDetails* details = |
(...skipping 20 matching lines...) Expand all Loading... | |
116 EXPECT_TRUE(details->is_device_policy); | 132 EXPECT_TRUE(details->is_device_policy); |
117 EXPECT_EQ(90, details->id); | 133 EXPECT_EQ(90, details->id); |
118 EXPECT_EQ(0u, details->max_external_data_size); | 134 EXPECT_EQ(0u, details->max_external_data_size); |
119 #endif | 135 #endif |
120 | 136 |
121 // TODO(bartfab): add a test that verifies a max_external_data_size larger | 137 // TODO(bartfab): add a test that verifies a max_external_data_size larger |
122 // than 0, once a type 'external' policy is added. | 138 // than 0, once a type 'external' policy is added. |
123 } | 139 } |
124 | 140 |
125 } // namespace policy | 141 } // namespace policy |
OLD | NEW |