Chromium Code Reviews| 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 552ae410d3dd495a1209c2930ddbefb9e1d0d675..3973656b50c89524a47197f70d50df51920fcac2 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) { |
| + TestingProfile profile; |
| + TestingPrefService* prefs = profile.GetTestingPrefService(); |
| + PolicyDefaultProvider provider(prefs); |
| + |
| + EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| + 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(); |
|
Mattias Nissler (ping if slow)
2011/08/09 15:37:25
Are you actually using |profile|? If not, why not
markusheintz_
2011/08/15 19:09:04
If I use the TestingPrefService I can not set test
|
| + |
| + PolicyProvider provider(prefs, NULL); |
| + GURL google_url("http://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, |
| + "")); |
|
wtc
2011/08/11 18:33:55
Nit: please pick either "" or std::string() for an
markusheintz_
2011/08/15 19:09:04
Done.
|
| + |
| + // 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("http://www.youtube.com"); |
| + EXPECT_EQ(CONTENT_SETTING_DEFAULT, |
|
Mattias Nissler (ping if slow)
2011/08/09 15:37:25
indentation
markusheintz_
2011/08/15 19:09:04
Done.
|
| + provider.GetContentSetting( |
| + youtube_url, |
| + youtube_url, |
| + CONTENT_SETTINGS_TYPE_AUTO_SUBMIT_CERTIFICATE, |
| + "")); |
| + EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| + provider.GetContentSetting( |
| + google_url, |
| + google_url, |
| + CONTENT_SETTINGS_TYPE_AUTO_SUBMIT_CERTIFICATE, |
| + "")); |
| + |
| + provider.ShutdownOnUIThread(); |
| +} |
| } // namespace content_settings |