| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <gtest/gtest.h> | 5 #include <gtest/gtest.h> |
| 6 | 6 |
| 7 #include "base/basictypes.h" |
| 7 #include "base/mac/scoped_cftyperef.h" | 8 #include "base/mac/scoped_cftyperef.h" |
| 8 #include "base/stl_util.h" | |
| 9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
| 10 #include "chrome/browser/policy/configuration_policy_pref_store.h" | 10 #include "chrome/browser/policy/asynchronous_policy_test_base.h" |
| 11 #include "chrome/browser/policy/configuration_policy_provider_mac.h" | 11 #include "chrome/browser/policy/configuration_policy_provider_mac.h" |
| 12 #include "chrome/browser/policy/configuration_policy_provider_test.h" |
| 12 #include "chrome/browser/policy/policy_map.h" | 13 #include "chrome/browser/policy/policy_map.h" |
| 13 #include "chrome/browser/preferences_mock_mac.h" | 14 #include "chrome/browser/preferences_mock_mac.h" |
| 14 #include "policy/policy_constants.h" | 15 #include "policy/policy_constants.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 17 |
| 17 namespace policy { | 18 namespace policy { |
| 18 | 19 |
| 19 // Holds parameters for the parametrized policy tests. | 20 namespace { |
| 20 class PolicyTestParams { | 21 |
| 22 class TestHarness : public PolicyProviderTestHarness { |
| 21 public: | 23 public: |
| 22 // Takes ownership of |test_value|. | 24 TestHarness(); |
| 23 PolicyTestParams(ConfigurationPolicyType type, | 25 virtual ~TestHarness(); |
| 24 const char* policy_name, | |
| 25 Value* test_value) | |
| 26 : type_(type), | |
| 27 policy_name_(policy_name), | |
| 28 test_value_(test_value) {} | |
| 29 | 26 |
| 30 // testing::TestWithParam does copying, so provide copy constructor and | 27 virtual void SetUp() OVERRIDE; |
| 31 // assignment operator. | |
| 32 PolicyTestParams(const PolicyTestParams& other) | |
| 33 : type_(other.type_), | |
| 34 policy_name_(other.policy_name_), | |
| 35 test_value_(other.test_value_->DeepCopy()) {} | |
| 36 | 28 |
| 37 const PolicyTestParams& operator=(PolicyTestParams other) { | 29 virtual AsynchronousPolicyProvider* CreateProvider( |
| 38 swap(other); | 30 const PolicyDefinitionList* policy_definition_list) OVERRIDE; |
| 39 return *this; | 31 |
| 32 virtual void InstallEmptyPolicy() OVERRIDE; |
| 33 virtual void InstallStringPolicy(const std::string& policy_name, |
| 34 const std::string& policy_value) OVERRIDE; |
| 35 virtual void InstallIntegerPolicy(const std::string& policy_name, |
| 36 int policy_value) OVERRIDE; |
| 37 virtual void InstallBooleanPolicy(const std::string& policy_name, |
| 38 bool policy_value) OVERRIDE; |
| 39 virtual void InstallStringListPolicy(const std::string& policy_name, |
| 40 const ListValue* policy_value) OVERRIDE; |
| 41 |
| 42 static PolicyProviderTestHarness* Create(); |
| 43 |
| 44 private: |
| 45 MockPreferences* prefs_; |
| 46 |
| 47 DISALLOW_COPY_AND_ASSIGN(TestHarness); |
| 48 }; |
| 49 |
| 50 TestHarness::TestHarness() {} |
| 51 |
| 52 TestHarness::~TestHarness() {} |
| 53 |
| 54 void TestHarness::SetUp() {} |
| 55 |
| 56 AsynchronousPolicyProvider* TestHarness::CreateProvider( |
| 57 const PolicyDefinitionList* policy_definition_list) { |
| 58 prefs_ = new MockPreferences(); |
| 59 return new ConfigurationPolicyProviderMac(policy_definition_list, prefs_); |
| 60 } |
| 61 |
| 62 void TestHarness::InstallEmptyPolicy() {} |
| 63 |
| 64 void TestHarness::InstallStringPolicy(const std::string& policy_name, |
| 65 const std::string& policy_value) { |
| 66 prefs_->AddTestItem(base::SysUTF8ToCFStringRef(policy_name), |
| 67 base::SysUTF8ToCFStringRef(policy_value), |
| 68 true); |
| 69 } |
| 70 |
| 71 void TestHarness::InstallIntegerPolicy(const std::string& policy_name, |
| 72 int policy_value) { |
| 73 prefs_->AddTestItem(base::SysUTF8ToCFStringRef(policy_name), |
| 74 CFNumberCreate(NULL, kCFNumberIntType, &policy_value), |
| 75 true); |
| 76 } |
| 77 |
| 78 void TestHarness::InstallBooleanPolicy(const std::string& policy_name, |
| 79 bool policy_value) { |
| 80 prefs_->AddTestItem(base::SysUTF8ToCFStringRef(policy_name), |
| 81 CFRetain(policy_value ? kCFBooleanTrue : kCFBooleanFalse), |
| 82 true); |
| 83 } |
| 84 |
| 85 void TestHarness::InstallStringListPolicy(const std::string& policy_name, |
| 86 const ListValue* policy_value) { |
| 87 base::mac::ScopedCFTypeRef<CFMutableArrayRef> array( |
| 88 CFArrayCreateMutable(NULL, policy_value->GetSize(), |
| 89 &kCFTypeArrayCallBacks)); |
| 90 for (ListValue::const_iterator element(policy_value->begin()); |
| 91 element != policy_value->end(); ++element) { |
| 92 std::string element_value; |
| 93 if (!(*element)->GetAsString(&element_value)) |
| 94 continue; |
| 95 CFArrayAppendValue(array, base::SysUTF8ToCFStringRef(element_value)); |
| 40 } | 96 } |
| 41 | 97 |
| 42 void swap(PolicyTestParams& other) { | 98 prefs_->AddTestItem(base::SysUTF8ToCFStringRef(policy_name), |
| 43 std::swap(type_, other.type_); | 99 array.release(), |
| 44 std::swap(policy_name_, other.policy_name_); | 100 true); |
| 45 test_value_.swap(other.test_value_); | 101 } |
| 46 } | |
| 47 | 102 |
| 48 ConfigurationPolicyType type() const { return type_; } | 103 // static |
| 49 const char* policy_name() const { return policy_name_; } | 104 PolicyProviderTestHarness* TestHarness::Create() { |
| 50 const Value* test_value() const { return test_value_.get(); } | 105 return new TestHarness(); |
| 106 } |
| 51 | 107 |
| 52 // Get the test value in the appropriate CFPropertyListRef representation. | 108 } // namespace |
| 53 CFPropertyListRef GetPropertyListValue() const { | |
| 54 switch (test_value_->GetType()) { | |
| 55 case Value::TYPE_BOOLEAN: { | |
| 56 bool v; | |
| 57 if (!test_value_->GetAsBoolean(&v)) | |
| 58 return NULL; | |
| 59 return CFRetain(v ? kCFBooleanTrue : kCFBooleanFalse); | |
| 60 } | |
| 61 case Value::TYPE_INTEGER: { | |
| 62 int v; | |
| 63 if (!test_value_->GetAsInteger(&v)) | |
| 64 return NULL; | |
| 65 return CFNumberCreate(NULL, kCFNumberIntType, &v); | |
| 66 } | |
| 67 case Value::TYPE_STRING: { | |
| 68 std::string v; | |
| 69 if (!test_value_->GetAsString(&v)) | |
| 70 return NULL; | |
| 71 return base::SysUTF8ToCFStringRef(v); | |
| 72 } | |
| 73 case Value::TYPE_LIST: { | |
| 74 const ListValue* list = | |
| 75 static_cast<const ListValue*>(test_value_.get()); | |
| 76 base::mac::ScopedCFTypeRef<CFMutableArrayRef> array( | |
| 77 CFArrayCreateMutable(NULL, list->GetSize(), | |
| 78 &kCFTypeArrayCallBacks)); | |
| 79 for (ListValue::const_iterator element(list->begin()); | |
| 80 element != list->end(); ++element) { | |
| 81 if (!(*element)->IsType(Value::TYPE_STRING)) | |
| 82 return NULL; | |
| 83 std::string element_value; | |
| 84 if (!(*element)->GetAsString(&element_value)) | |
| 85 return NULL; | |
| 86 base::mac::ScopedCFTypeRef<CFStringRef> cf_element_value( | |
| 87 base::SysUTF8ToCFStringRef(element_value)); | |
| 88 CFArrayAppendValue(array, cf_element_value.get()); | |
| 89 } | |
| 90 return array.release(); | |
| 91 } | |
| 92 default: | |
| 93 return NULL; | |
| 94 } | |
| 95 } | |
| 96 | 109 |
| 97 // Factory methods that create parameter objects for different value types. | 110 // Instantiate abstract test case for basic policy reading tests. |
| 98 static PolicyTestParams ForStringPolicy( | 111 INSTANTIATE_TEST_CASE_P( |
| 99 ConfigurationPolicyType type, | 112 ConfigurationPolicyProviderMacTest, |
| 100 const char* name) { | 113 ConfigurationPolicyProviderTest, |
| 101 return PolicyTestParams(type, name, Value::CreateStringValue("test")); | 114 testing::Values(TestHarness::Create)); |
| 102 } | |
| 103 static PolicyTestParams ForBooleanPolicy( | |
| 104 ConfigurationPolicyType type, | |
| 105 const char* name) { | |
| 106 return PolicyTestParams(type, name, Value::CreateBooleanValue(true)); | |
| 107 } | |
| 108 static PolicyTestParams ForIntegerPolicy( | |
| 109 ConfigurationPolicyType type, | |
| 110 const char* name) { | |
| 111 return PolicyTestParams(type, name, Value::CreateIntegerValue(42)); | |
| 112 } | |
| 113 static PolicyTestParams ForListPolicy( | |
| 114 ConfigurationPolicyType type, | |
| 115 const char* name) { | |
| 116 ListValue* value = new ListValue; | |
| 117 value->Set(0U, Value::CreateStringValue("first")); | |
| 118 value->Set(1U, Value::CreateStringValue("second")); | |
| 119 return PolicyTestParams(type, name, value); | |
| 120 } | |
| 121 | 115 |
| 122 private: | 116 // Special test cases for some mac preferences details. |
| 123 ConfigurationPolicyType type_; | 117 class ConfigurationPolicyProviderMacTest : public AsynchronousPolicyTestBase { |
| 124 const char* policy_name_; | 118 protected: |
| 125 scoped_ptr<Value> test_value_; | 119 ConfigurationPolicyProviderMacTest() |
| 120 : prefs_(new MockPreferences()), |
| 121 provider_(&test_policy_definitions::kList, prefs_) {} |
| 122 virtual ~ConfigurationPolicyProviderMacTest() {} |
| 123 |
| 124 MockPreferences* prefs_; |
| 125 ConfigurationPolicyProviderMac provider_; |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 // Parametrized test class for testing whether ConfigurationPolicyProviderMac | 128 TEST_F(ConfigurationPolicyProviderMacTest, Invalid) { |
| 129 // can handle all policies correctly. | |
| 130 class ConfigurationPolicyProviderMacTest | |
| 131 : public testing::TestWithParam<PolicyTestParams> { | |
| 132 public: | |
| 133 virtual void SetUp() { | |
| 134 prefs_ = new MockPreferences; | |
| 135 } | |
| 136 | |
| 137 protected: | |
| 138 MockPreferences* prefs_; | |
| 139 }; | |
| 140 | |
| 141 TEST_P(ConfigurationPolicyProviderMacTest, Default) { | |
| 142 ConfigurationPolicyProviderMac provider( | |
| 143 GetChromePolicyDefinitionList(), prefs_); | |
| 144 PolicyMap policy_map; | |
| 145 EXPECT_TRUE(provider.Provide(&policy_map)); | |
| 146 EXPECT_TRUE(policy_map.empty()); | |
| 147 } | |
| 148 | |
| 149 TEST_P(ConfigurationPolicyProviderMacTest, Invalid) { | |
| 150 base::mac::ScopedCFTypeRef<CFStringRef> name( | 129 base::mac::ScopedCFTypeRef<CFStringRef> name( |
| 151 base::SysUTF8ToCFStringRef(GetParam().policy_name())); | 130 base::SysUTF8ToCFStringRef(test_policy_definitions::kKeyString)); |
| 152 base::mac::ScopedCFTypeRef<CFDataRef> invalid_data( | 131 base::mac::ScopedCFTypeRef<CFDataRef> invalid_data( |
| 153 CFDataCreate(NULL, NULL, 0)); | 132 CFDataCreate(NULL, NULL, 0)); |
| 154 prefs_->AddTestItem(name, invalid_data.get(), true); | 133 prefs_->AddTestItem(name, invalid_data.get(), true); |
| 155 | 134 |
| 156 // Create the provider and have it read |prefs_|. | 135 // Create the provider and have it read |prefs_|. |
| 157 ConfigurationPolicyProviderMac provider( | 136 provider_.ForceReload(); |
| 158 GetChromePolicyDefinitionList(), prefs_); | |
| 159 PolicyMap policy_map; | 137 PolicyMap policy_map; |
| 160 EXPECT_TRUE(provider.Provide(&policy_map)); | 138 EXPECT_TRUE(provider_.Provide(&policy_map)); |
| 161 EXPECT_TRUE(policy_map.empty()); | 139 EXPECT_TRUE(policy_map.empty()); |
| 162 } | 140 } |
| 163 | 141 |
| 164 TEST_P(ConfigurationPolicyProviderMacTest, TestNonForcedValue) { | 142 TEST_F(ConfigurationPolicyProviderMacTest, TestNonForcedValue) { |
| 165 base::mac::ScopedCFTypeRef<CFStringRef> name( | 143 base::mac::ScopedCFTypeRef<CFStringRef> name( |
| 166 base::SysUTF8ToCFStringRef(GetParam().policy_name())); | 144 base::SysUTF8ToCFStringRef(test_policy_definitions::kKeyString)); |
| 167 base::mac::ScopedCFTypeRef<CFPropertyListRef> test_value( | 145 base::mac::ScopedCFTypeRef<CFPropertyListRef> test_value( |
| 168 GetParam().GetPropertyListValue()); | 146 base::SysUTF8ToCFStringRef("string value")); |
| 169 ASSERT_TRUE(test_value.get()); | 147 ASSERT_TRUE(test_value.get()); |
| 170 prefs_->AddTestItem(name, test_value.get(), false); | 148 prefs_->AddTestItem(name, test_value.get(), false); |
| 171 | 149 |
| 172 // Create the provider and have it read |prefs_|. | 150 // Create the provider and have it read |prefs_|. |
| 173 ConfigurationPolicyProviderMac provider( | 151 provider_.ForceReload(); |
| 174 GetChromePolicyDefinitionList(), prefs_); | |
| 175 PolicyMap policy_map; | 152 PolicyMap policy_map; |
| 176 EXPECT_TRUE(provider.Provide(&policy_map)); | 153 EXPECT_TRUE(provider_.Provide(&policy_map)); |
| 177 EXPECT_TRUE(policy_map.empty()); | 154 EXPECT_TRUE(policy_map.empty()); |
| 178 } | 155 } |
| 179 | 156 |
| 180 TEST_P(ConfigurationPolicyProviderMacTest, TestValue) { | |
| 181 base::mac::ScopedCFTypeRef<CFStringRef> name( | |
| 182 base::SysUTF8ToCFStringRef(GetParam().policy_name())); | |
| 183 base::mac::ScopedCFTypeRef<CFPropertyListRef> test_value( | |
| 184 GetParam().GetPropertyListValue()); | |
| 185 ASSERT_TRUE(test_value.get()); | |
| 186 prefs_->AddTestItem(name, test_value, true); | |
| 187 | |
| 188 // Create the provider and have it read |prefs_|. | |
| 189 ConfigurationPolicyProviderMac provider( | |
| 190 GetChromePolicyDefinitionList(), prefs_); | |
| 191 PolicyMap policy_map; | |
| 192 EXPECT_TRUE(provider.Provide(&policy_map)); | |
| 193 ASSERT_EQ(1U, policy_map.size()); | |
| 194 const Value* value = policy_map.Get(GetParam().type()); | |
| 195 ASSERT_TRUE(value); | |
| 196 EXPECT_TRUE(GetParam().test_value()->Equals(value)); | |
| 197 } | |
| 198 | |
| 199 // Test parameters for all supported policies. testing::Values() has a limit of | |
| 200 // 50 parameters which is reached in this instantiation; new policies should go | |
| 201 // in the next instantiation after this one. | |
| 202 INSTANTIATE_TEST_CASE_P( | |
| 203 ConfigurationPolicyProviderMacTestInstance, | |
| 204 ConfigurationPolicyProviderMacTest, | |
| 205 testing::Values( | |
| 206 PolicyTestParams::ForStringPolicy( | |
| 207 kPolicyHomepageLocation, | |
| 208 key::kHomepageLocation), | |
| 209 PolicyTestParams::ForBooleanPolicy( | |
| 210 kPolicyHomepageIsNewTabPage, | |
| 211 key::kHomepageIsNewTabPage), | |
| 212 PolicyTestParams::ForIntegerPolicy( | |
| 213 kPolicyRestoreOnStartup, | |
| 214 key::kRestoreOnStartup), | |
| 215 PolicyTestParams::ForListPolicy( | |
| 216 kPolicyRestoreOnStartupURLs, | |
| 217 key::kRestoreOnStartupURLs), | |
| 218 PolicyTestParams::ForBooleanPolicy( | |
| 219 kPolicyDefaultSearchProviderEnabled, | |
| 220 key::kDefaultSearchProviderEnabled), | |
| 221 PolicyTestParams::ForStringPolicy( | |
| 222 kPolicyDefaultSearchProviderName, | |
| 223 key::kDefaultSearchProviderName), | |
| 224 PolicyTestParams::ForStringPolicy( | |
| 225 kPolicyDefaultSearchProviderKeyword, | |
| 226 key::kDefaultSearchProviderKeyword), | |
| 227 PolicyTestParams::ForStringPolicy( | |
| 228 kPolicyDefaultSearchProviderSearchURL, | |
| 229 key::kDefaultSearchProviderSearchURL), | |
| 230 PolicyTestParams::ForStringPolicy( | |
| 231 kPolicyDefaultSearchProviderSuggestURL, | |
| 232 key::kDefaultSearchProviderSuggestURL), | |
| 233 PolicyTestParams::ForStringPolicy( | |
| 234 kPolicyDefaultSearchProviderInstantURL, | |
| 235 key::kDefaultSearchProviderInstantURL), | |
| 236 PolicyTestParams::ForStringPolicy( | |
| 237 kPolicyDefaultSearchProviderIconURL, | |
| 238 key::kDefaultSearchProviderIconURL), | |
| 239 PolicyTestParams::ForListPolicy( | |
| 240 kPolicyDefaultSearchProviderEncodings, | |
| 241 key::kDefaultSearchProviderEncodings), | |
| 242 PolicyTestParams::ForStringPolicy( | |
| 243 kPolicyProxyMode, | |
| 244 key::kProxyMode), | |
| 245 PolicyTestParams::ForIntegerPolicy( | |
| 246 kPolicyProxyServerMode, | |
| 247 key::kProxyServerMode), | |
| 248 PolicyTestParams::ForStringPolicy( | |
| 249 kPolicyProxyServer, | |
| 250 key::kProxyServer), | |
| 251 PolicyTestParams::ForStringPolicy( | |
| 252 kPolicyProxyPacUrl, | |
| 253 key::kProxyPacUrl), | |
| 254 PolicyTestParams::ForStringPolicy( | |
| 255 kPolicyProxyBypassList, | |
| 256 key::kProxyBypassList), | |
| 257 PolicyTestParams::ForBooleanPolicy( | |
| 258 kPolicyAlternateErrorPagesEnabled, | |
| 259 key::kAlternateErrorPagesEnabled), | |
| 260 PolicyTestParams::ForBooleanPolicy( | |
| 261 kPolicySearchSuggestEnabled, | |
| 262 key::kSearchSuggestEnabled), | |
| 263 PolicyTestParams::ForBooleanPolicy( | |
| 264 kPolicyDnsPrefetchingEnabled, | |
| 265 key::kDnsPrefetchingEnabled), | |
| 266 PolicyTestParams::ForBooleanPolicy( | |
| 267 kPolicySafeBrowsingEnabled, | |
| 268 key::kSafeBrowsingEnabled), | |
| 269 PolicyTestParams::ForBooleanPolicy( | |
| 270 kPolicyMetricsReportingEnabled, | |
| 271 key::kMetricsReportingEnabled), | |
| 272 PolicyTestParams::ForBooleanPolicy( | |
| 273 kPolicyPasswordManagerEnabled, | |
| 274 key::kPasswordManagerEnabled), | |
| 275 PolicyTestParams::ForBooleanPolicy( | |
| 276 kPolicyPasswordManagerAllowShowPasswords, | |
| 277 key::kPasswordManagerAllowShowPasswords), | |
| 278 PolicyTestParams::ForListPolicy( | |
| 279 kPolicyDisabledPlugins, | |
| 280 key::kDisabledPlugins), | |
| 281 PolicyTestParams::ForListPolicy( | |
| 282 kPolicyDisabledPluginsExceptions, | |
| 283 key::kDisabledPluginsExceptions), | |
| 284 PolicyTestParams::ForListPolicy( | |
| 285 kPolicyEnabledPlugins, | |
| 286 key::kEnabledPlugins), | |
| 287 PolicyTestParams::ForBooleanPolicy( | |
| 288 kPolicyAutoFillEnabled, | |
| 289 key::kAutoFillEnabled), | |
| 290 PolicyTestParams::ForStringPolicy( | |
| 291 kPolicyApplicationLocaleValue, | |
| 292 key::kApplicationLocaleValue), | |
| 293 PolicyTestParams::ForBooleanPolicy( | |
| 294 kPolicySyncDisabled, | |
| 295 key::kSyncDisabled), | |
| 296 PolicyTestParams::ForListPolicy( | |
| 297 kPolicyExtensionInstallWhitelist, | |
| 298 key::kExtensionInstallWhitelist), | |
| 299 PolicyTestParams::ForListPolicy( | |
| 300 kPolicyExtensionInstallBlacklist, | |
| 301 key::kExtensionInstallBlacklist), | |
| 302 PolicyTestParams::ForBooleanPolicy( | |
| 303 kPolicyShowHomeButton, | |
| 304 key::kShowHomeButton), | |
| 305 PolicyTestParams::ForBooleanPolicy( | |
| 306 kPolicyPrintingEnabled, | |
| 307 key::kPrintingEnabled), | |
| 308 PolicyTestParams::ForBooleanPolicy( | |
| 309 kPolicyInstantEnabled, | |
| 310 key::kInstantEnabled), | |
| 311 PolicyTestParams::ForBooleanPolicy( | |
| 312 kPolicyDisablePluginFinder, | |
| 313 key::kDisablePluginFinder), | |
| 314 PolicyTestParams::ForBooleanPolicy( | |
| 315 kPolicyClearSiteDataOnExit, | |
| 316 key::kClearSiteDataOnExit), | |
| 317 PolicyTestParams::ForStringPolicy( | |
| 318 kPolicyDownloadDirectory, | |
| 319 key::kDownloadDirectory), | |
| 320 PolicyTestParams::ForBooleanPolicy( | |
| 321 kPolicyDefaultBrowserSettingEnabled, | |
| 322 key::kDefaultBrowserSettingEnabled), | |
| 323 PolicyTestParams::ForBooleanPolicy( | |
| 324 kPolicyCloudPrintProxyEnabled, | |
| 325 key::kCloudPrintProxyEnabled), | |
| 326 PolicyTestParams::ForBooleanPolicy( | |
| 327 kPolicyTranslateEnabled, | |
| 328 key::kTranslateEnabled), | |
| 329 PolicyTestParams::ForBooleanPolicy( | |
| 330 kPolicyAllowOutdatedPlugins, | |
| 331 key::kAllowOutdatedPlugins), | |
| 332 PolicyTestParams::ForBooleanPolicy( | |
| 333 kPolicyAlwaysAuthorizePlugins, | |
| 334 key::kAlwaysAuthorizePlugins), | |
| 335 PolicyTestParams::ForBooleanPolicy( | |
| 336 kPolicyBookmarkBarEnabled, | |
| 337 key::kBookmarkBarEnabled), | |
| 338 PolicyTestParams::ForBooleanPolicy( | |
| 339 kPolicyEditBookmarksEnabled, | |
| 340 key::kEditBookmarksEnabled), | |
| 341 PolicyTestParams::ForBooleanPolicy( | |
| 342 kPolicyAllowFileSelectionDialogs, | |
| 343 key::kAllowFileSelectionDialogs), | |
| 344 PolicyTestParams::ForListPolicy( | |
| 345 kPolicyDisabledSchemes, | |
| 346 key::kDisabledSchemes), | |
| 347 PolicyTestParams::ForStringPolicy( | |
| 348 kPolicyDiskCacheDir, | |
| 349 key::kDiskCacheDir), | |
| 350 PolicyTestParams::ForIntegerPolicy( | |
| 351 kPolicyMaxConnectionsPerProxy, | |
| 352 key::kMaxConnectionsPerProxy), | |
| 353 PolicyTestParams::ForListPolicy( | |
| 354 kPolicyURLBlacklist, | |
| 355 key::kURLBlacklist))); | |
| 356 | |
| 357 // testing::Values has a limit of 50 test templates, which is reached by the | |
| 358 // instantiations above. Add tests for new policies here: | |
| 359 INSTANTIATE_TEST_CASE_P( | |
| 360 ConfigurationPolicyProviderMacTestInstance2, | |
| 361 ConfigurationPolicyProviderMacTest, | |
| 362 testing::Values( | |
| 363 PolicyTestParams::ForListPolicy( | |
| 364 kPolicyURLWhitelist, | |
| 365 key::kURLWhitelist), | |
| 366 PolicyTestParams::ForBooleanPolicy( | |
| 367 kPolicyCloudPrintSubmitEnabled, | |
| 368 key::kCloudPrintSubmitEnabled))); | |
| 369 } // namespace policy | 157 } // namespace policy |
| OLD | NEW |