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 b2bdf74d095eecdfb7ec8829a850f2d0d9605c32..ea9b6ae8b82930bcdc34f66385389bf99cbeabf5 100644 |
| --- a/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc |
| +++ b/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc |
| @@ -12,7 +12,7 @@ |
| #include "chrome/test/testing_pref_service.h" |
| #include "chrome/test/testing_profile.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| - |
| +#include "googleurl/src/gurl.h" |
| namespace content_settings { |
| @@ -80,4 +80,48 @@ TEST_F(PolicyDefaultProviderTest, ObserveManagedSettingsChange) { |
| EXPECT_EQ(2, observer.counter); |
| } |
| +class PolicyProviderTest : public testing::Test { |
| + public: |
| + PolicyProviderTest() |
| + : ui_thread_(BrowserThread::UI, &message_loop_) { |
|
Bernhard Bauer
2011/02/23 13:18:53
Is this because of a |DCHECK(BrowserThread::Curren
Bernhard Bauer
2011/02/25 16:08:01
Did you see this comment?
markusheintz_
2011/02/28 09:08:44
Sorry I forgot to add my reply. Yeah I agree. We s
|
| + } |
| + |
| + protected: |
| + MessageLoop message_loop_; |
| + BrowserThread ui_thread_; |
| +}; |
| + |
| +TEST_F(PolicyProviderTest, Default) { |
| + TestingProfile profile; |
| + TestingPrefService* prefs = profile.GetTestingPrefService(); |
| + |
| + ListValue* value = new ListValue(); |
| + value->Append(Value::CreateStringValue("[*.]google.com")); |
| + prefs->SetManagedPref(prefs::kManagedImagesBlockedForUrls, |
| + value); |
| + |
| + PolicyProvider provider(static_cast<Profile*>(&profile)); |
| + |
| + ContentSettingsPattern yt_url_pattern("www.youtube.com"); |
| + GURL youtube_url("http://www.youtube.com"); |
| + GURL google_url("http://mail.google.com"); |
| + |
| + EXPECT_EQ(CONTENT_SETTING_DEFAULT, |
| + provider.GetContentSetting( |
| + youtube_url, youtube_url, CONTENT_SETTINGS_TYPE_COOKIES, "")); |
| + EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| + provider.GetContentSetting( |
| + google_url, google_url, CONTENT_SETTINGS_TYPE_IMAGES, "")); |
| + |
| + provider.SetContentSetting( |
| + yt_url_pattern, |
| + yt_url_pattern, |
| + CONTENT_SETTINGS_TYPE_COOKIES, |
| + "", |
| + CONTENT_SETTING_BLOCK); |
| + EXPECT_EQ(CONTENT_SETTING_DEFAULT, |
| + provider.GetContentSetting( |
| + youtube_url, youtube_url, CONTENT_SETTINGS_TYPE_COOKIES, "")); |
| +} |
| + |
| } // namespace content_settings |