| 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 22 matching lines...) Expand all Loading... |
| 33 EXPECT_EQ(base::Value::TYPE_BOOLEAN, subschema.type()); | 33 EXPECT_EQ(base::Value::TYPE_BOOLEAN, subschema.type()); |
| 34 | 34 |
| 35 subschema = schema.GetProperty(key::kIncognitoModeAvailability); | 35 subschema = schema.GetProperty(key::kIncognitoModeAvailability); |
| 36 ASSERT_TRUE(subschema.valid()); | 36 ASSERT_TRUE(subschema.valid()); |
| 37 EXPECT_EQ(base::Value::TYPE_INTEGER, subschema.type()); | 37 EXPECT_EQ(base::Value::TYPE_INTEGER, subschema.type()); |
| 38 | 38 |
| 39 subschema = schema.GetProperty(key::kProxyMode); | 39 subschema = schema.GetProperty(key::kProxyMode); |
| 40 ASSERT_TRUE(subschema.valid()); | 40 ASSERT_TRUE(subschema.valid()); |
| 41 EXPECT_EQ(base::Value::TYPE_STRING, subschema.type()); | 41 EXPECT_EQ(base::Value::TYPE_STRING, subschema.type()); |
| 42 | 42 |
| 43 subschema = schema.GetProperty(key::kCookiesAllowedForUrls); | 43 subschema = schema.GetProperty(key::kURLBlacklist); |
| 44 ASSERT_TRUE(subschema.valid()); | 44 ASSERT_TRUE(subschema.valid()); |
| 45 EXPECT_EQ(base::Value::TYPE_LIST, subschema.type()); | 45 EXPECT_EQ(base::Value::TYPE_LIST, subschema.type()); |
| 46 ASSERT_TRUE(subschema.GetItems().valid()); | 46 ASSERT_TRUE(subschema.GetItems().valid()); |
| 47 EXPECT_EQ(base::Value::TYPE_STRING, subschema.GetItems().type()); | 47 EXPECT_EQ(base::Value::TYPE_STRING, subschema.GetItems().type()); |
| 48 | 48 |
| 49 subschema = schema.GetProperty(key::kProxySettings); | 49 subschema = schema.GetProperty(key::kProxySettings); |
| 50 ASSERT_TRUE(subschema.valid()); | 50 ASSERT_TRUE(subschema.valid()); |
| 51 EXPECT_EQ(base::Value::TYPE_DICTIONARY, subschema.type()); | 51 EXPECT_EQ(base::Value::TYPE_DICTIONARY, subschema.type()); |
| 52 EXPECT_FALSE(subschema.GetAdditionalProperties().valid()); | 52 EXPECT_FALSE(subschema.GetAdditionalProperties().valid()); |
| 53 EXPECT_FALSE(subschema.GetProperty("no such proxy key exists").valid()); | 53 EXPECT_FALSE(subschema.GetProperty("no such proxy key exists").valid()); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 EXPECT_FALSE(GetChromePolicyDetails("AAlternateErrorPagesEnabled")); | 93 EXPECT_FALSE(GetChromePolicyDetails("AAlternateErrorPagesEnabled")); |
| 94 | 94 |
| 95 const PolicyDetails* details = | 95 const PolicyDetails* details = |
| 96 GetChromePolicyDetails(key::kAlternateErrorPagesEnabled); | 96 GetChromePolicyDetails(key::kAlternateErrorPagesEnabled); |
| 97 ASSERT_TRUE(details); | 97 ASSERT_TRUE(details); |
| 98 EXPECT_FALSE(details->is_deprecated); | 98 EXPECT_FALSE(details->is_deprecated); |
| 99 EXPECT_FALSE(details->is_device_policy); | 99 EXPECT_FALSE(details->is_device_policy); |
| 100 EXPECT_EQ(5, details->id); | 100 EXPECT_EQ(5, details->id); |
| 101 EXPECT_EQ(0u, details->max_external_data_size); | 101 EXPECT_EQ(0u, details->max_external_data_size); |
| 102 | 102 |
| 103 #if !defined(OS_IOS) |
| 103 details = GetChromePolicyDetails(key::kJavascriptEnabled); | 104 details = GetChromePolicyDetails(key::kJavascriptEnabled); |
| 104 ASSERT_TRUE(details); | 105 ASSERT_TRUE(details); |
| 105 EXPECT_TRUE(details->is_deprecated); | 106 EXPECT_TRUE(details->is_deprecated); |
| 106 EXPECT_FALSE(details->is_device_policy); | 107 EXPECT_FALSE(details->is_device_policy); |
| 107 EXPECT_EQ(9, details->id); | 108 EXPECT_EQ(9, details->id); |
| 108 EXPECT_EQ(0u, details->max_external_data_size); | 109 EXPECT_EQ(0u, details->max_external_data_size); |
| 110 #endif |
| 109 | 111 |
| 110 #if defined(OS_CHROMEOS) | 112 #if defined(OS_CHROMEOS) |
| 111 details = GetChromePolicyDetails(key::kDevicePolicyRefreshRate); | 113 details = GetChromePolicyDetails(key::kDevicePolicyRefreshRate); |
| 112 ASSERT_TRUE(details); | 114 ASSERT_TRUE(details); |
| 113 EXPECT_FALSE(details->is_deprecated); | 115 EXPECT_FALSE(details->is_deprecated); |
| 114 EXPECT_TRUE(details->is_device_policy); | 116 EXPECT_TRUE(details->is_device_policy); |
| 115 EXPECT_EQ(90, details->id); | 117 EXPECT_EQ(90, details->id); |
| 116 EXPECT_EQ(0u, details->max_external_data_size); | 118 EXPECT_EQ(0u, details->max_external_data_size); |
| 117 #endif | 119 #endif |
| 118 | 120 |
| 119 // TODO(bartfab): add a test that verifies a max_external_data_size larger | 121 // TODO(bartfab): add a test that verifies a max_external_data_size larger |
| 120 // than 0, once a type 'external' policy is added. | 122 // than 0, once a type 'external' policy is added. |
| 121 } | 123 } |
| 122 | 124 |
| 123 } // namespace policy | 125 } // namespace policy |
| OLD | NEW |