Index: chrome/browser/content_settings/content_settings_policy_provider_unittest.cc |
diff --git a/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc b/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc |
index 3e4ff2e5d2ed234ef2653dfc314f8d9aea879d2e..02be53626879a7c21ed9c5bc5c4f095bc5abcfce 100644 |
--- a/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc |
+++ b/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc |
@@ -127,6 +127,18 @@ TEST_F(PolicyDefaultProviderTest, ObserveManagedSettingsChange) { |
provider.ShutdownOnUIThread(); |
} |
+TEST_F(PolicyDefaultProviderTest, AutoSubmitCertificateList) { |
wtc
2011/08/18 22:03:38
Nit: Remove "List" from the unit test's name, or r
markusheintz_
2011/08/19 15:17:58
Done.
|
+ TestingProfile profile; |
+ TestingPrefService* prefs = profile.GetTestingPrefService(); |
+ PolicyDefaultProvider provider(prefs); |
+ |
+ EXPECT_EQ(CONTENT_SETTING_ASK, |
+ provider.ProvideDefaultSetting( |
+ CONTENT_SETTINGS_TYPE_AUTO_SUBMIT_CERTIFICATE)); |
+ |
+ provider.ShutdownOnUIThread(); |
+} |
+ |
class PolicyProviderTest : public TestingBrowserProcessTest { |
public: |
PolicyProviderTest() |
@@ -223,4 +235,40 @@ TEST_F(PolicyProviderTest, ResourceIdentifier) { |
provider.ShutdownOnUIThread(); |
} |
+TEST_F(PolicyProviderTest, AutoSubmitCertificateList) { |
+ TestingProfile profile; |
+ TestingPrefService* prefs = profile.GetTestingPrefService(); |
+ |
+ PolicyProvider provider(prefs, NULL); |
+ GURL google_url("https://mail.google.com"); |
+ // Tests the default setting for auto submitting certificates |
+ EXPECT_EQ(CONTENT_SETTING_DEFAULT, |
+ provider.GetContentSetting( |
+ google_url, |
+ google_url, |
+ CONTENT_SETTINGS_TYPE_AUTO_SUBMIT_CERTIFICATE, |
+ std::string())); |
+ |
+ // Set the content settings pattern list for origins to auto submit |
+ // certificates. |
+ ListValue* value = new ListValue(); |
+ value->Append(Value::CreateStringValue("[*.]google.com")); |
+ prefs->SetManagedPref(prefs::kManagedAutoSubmitCertificateForUrls, |
+ value); |
+ GURL youtube_url("https://www.youtube.com"); |
+ EXPECT_EQ(CONTENT_SETTING_DEFAULT, |
+ provider.GetContentSetting( |
+ youtube_url, |
+ youtube_url, |
+ CONTENT_SETTINGS_TYPE_AUTO_SUBMIT_CERTIFICATE, |
+ std::string())); |
+ EXPECT_EQ(CONTENT_SETTING_ALLOW, |
+ provider.GetContentSetting( |
+ google_url, |
+ google_url, |
+ CONTENT_SETTINGS_TYPE_AUTO_SUBMIT_CERTIFICATE, |
+ std::string())); |
+ |
+ provider.ShutdownOnUIThread(); |
+} |
} // namespace content_settings |