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 "base/file_path.h" | 5 #include "base/file_path.h" |
6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
7 #include "chrome/browser/policy/configuration_policy_pref_store.h" | 7 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
8 #include "chrome/browser/policy/mock_configuration_policy_provider.h" | 8 #include "chrome/browser/policy/mock_configuration_policy_provider.h" |
9 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 9 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
10 #include "chrome/browser/prefs/proxy_config_dictionary.h" | 10 #include "chrome/browser/prefs/proxy_config_dictionary.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 prefs::kExtensionInstallAllowList), | 79 prefs::kExtensionInstallAllowList), |
80 TypeAndName(kPolicyExtensionInstallBlacklist, | 80 TypeAndName(kPolicyExtensionInstallBlacklist, |
81 prefs::kExtensionInstallDenyList), | 81 prefs::kExtensionInstallDenyList), |
82 TypeAndName(kPolicyDisabledPlugins, | 82 TypeAndName(kPolicyDisabledPlugins, |
83 prefs::kPluginsDisabledPlugins), | 83 prefs::kPluginsDisabledPlugins), |
84 TypeAndName(kPolicyDisabledPluginsExceptions, | 84 TypeAndName(kPolicyDisabledPluginsExceptions, |
85 prefs::kPluginsDisabledPluginsExceptions), | 85 prefs::kPluginsDisabledPluginsExceptions), |
86 TypeAndName(kPolicyEnabledPlugins, | 86 TypeAndName(kPolicyEnabledPlugins, |
87 prefs::kPluginsEnabledPlugins), | 87 prefs::kPluginsEnabledPlugins), |
88 TypeAndName(kPolicyDisabledSchemes, | 88 TypeAndName(kPolicyDisabledSchemes, |
89 prefs::kDisabledSchemes))); | 89 prefs::kDisabledSchemes), |
| 90 TypeAndName(kPolicyAutoSelectCertificateForUrls, |
| 91 prefs::kManagedAutoSelectCertificateForUrls))); |
90 | 92 |
91 // Test cases for string-valued policy settings. | 93 // Test cases for string-valued policy settings. |
92 class ConfigurationPolicyPrefStoreStringTest | 94 class ConfigurationPolicyPrefStoreStringTest |
93 : public ConfigurationPolicyPrefStoreTestBase< | 95 : public ConfigurationPolicyPrefStoreTestBase< |
94 testing::TestWithParam<TypeAndName> > { | 96 testing::TestWithParam<TypeAndName> > { |
95 }; | 97 }; |
96 | 98 |
97 TEST_P(ConfigurationPolicyPrefStoreStringTest, GetDefault) { | 99 TEST_P(ConfigurationPolicyPrefStoreStringTest, GetDefault) { |
98 EXPECT_EQ(PrefStore::READ_NO_VALUE, | 100 EXPECT_EQ(PrefStore::READ_NO_VALUE, |
99 store_->GetValue(GetParam().pref_name(), NULL)); | 101 store_->GetValue(GetParam().pref_name(), NULL)); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 | 283 |
282 INSTANTIATE_TEST_CASE_P( | 284 INSTANTIATE_TEST_CASE_P( |
283 ConfigurationPolicyPrefStoreIntegerTestInstance, | 285 ConfigurationPolicyPrefStoreIntegerTestInstance, |
284 ConfigurationPolicyPrefStoreIntegerTest, | 286 ConfigurationPolicyPrefStoreIntegerTest, |
285 testing::Values( | 287 testing::Values( |
286 TypeAndName(kPolicyRestoreOnStartup, | 288 TypeAndName(kPolicyRestoreOnStartup, |
287 prefs::kRestoreOnStartup), | 289 prefs::kRestoreOnStartup), |
288 TypeAndName(kPolicyPolicyRefreshRate, | 290 TypeAndName(kPolicyPolicyRefreshRate, |
289 prefs::kUserPolicyRefreshRate), | 291 prefs::kUserPolicyRefreshRate), |
290 TypeAndName(kPolicyMaxConnectionsPerProxy, | 292 TypeAndName(kPolicyMaxConnectionsPerProxy, |
291 prefs::kMaxConnectionsPerProxy))); | 293 prefs::kMaxConnectionsPerProxy), |
| 294 TypeAndName(kPolicyDefaultAutoSelectCertificateSetting, |
| 295 prefs::kManagedDefaultAutoSelectCertificateSetting))); |
292 | 296 |
293 // Test cases for the proxy policy settings. | 297 // Test cases for the proxy policy settings. |
294 class ConfigurationPolicyPrefStoreProxyTest : public testing::Test { | 298 class ConfigurationPolicyPrefStoreProxyTest : public testing::Test { |
295 protected: | 299 protected: |
296 // Verify that all the proxy prefs are set to the specified expected values. | 300 // Verify that all the proxy prefs are set to the specified expected values. |
297 static void VerifyProxyPrefs( | 301 static void VerifyProxyPrefs( |
298 const ConfigurationPolicyPrefStore& store, | 302 const ConfigurationPolicyPrefStore& store, |
299 const std::string& expected_proxy_server, | 303 const std::string& expected_proxy_server, |
300 const std::string& expected_proxy_pac_url, | 304 const std::string& expected_proxy_pac_url, |
301 const std::string& expected_proxy_bypass_list, | 305 const std::string& expected_proxy_bypass_list, |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 | 974 |
971 provider_.SetInitializationComplete(true); | 975 provider_.SetInitializationComplete(true); |
972 EXPECT_FALSE(store_->IsInitializationComplete()); | 976 EXPECT_FALSE(store_->IsInitializationComplete()); |
973 | 977 |
974 store_->OnUpdatePolicy(); | 978 store_->OnUpdatePolicy(); |
975 Mock::VerifyAndClearExpectations(&observer_); | 979 Mock::VerifyAndClearExpectations(&observer_); |
976 EXPECT_TRUE(store_->IsInitializationComplete()); | 980 EXPECT_TRUE(store_->IsInitializationComplete()); |
977 } | 981 } |
978 | 982 |
979 } // namespace policy | 983 } // namespace policy |
OLD | NEW |