Chromium Code Reviews| Index: chrome/browser/content_settings/content_settings_pref_provider_unittest.cc |
| diff --git a/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc b/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc |
| index 50e56ff33e2d45e30f7f8eb2b308a789f08b9551..92838134efd038cab65cfc5575ddd74a19b05b7a 100644 |
| --- a/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc |
| +++ b/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc |
| @@ -8,6 +8,7 @@ |
| #include "base/command_line.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/threading/platform_thread.h" |
| +#include "base/values.h" |
| #include "chrome/browser/content_settings/content_settings_mock_observer.h" |
| #include "chrome/browser/content_settings/content_settings_utils.h" |
| #include "chrome/browser/prefs/browser_prefs.h" |
| @@ -120,11 +121,15 @@ class PrefProviderTest : public testing::Test { |
| public: |
| PrefProviderTest() : ui_thread_( |
| BrowserThread::UI, &message_loop_) { |
| + value_allow.reset(Value::CreateIntegerValue(CONTENT_SETTING_ALLOW)); |
| + value_block.reset(Value::CreateIntegerValue(CONTENT_SETTING_BLOCK)); |
| } |
| protected: |
| MessageLoop message_loop_; |
| content::TestBrowserThread ui_thread_; |
| + scoped_ptr<base::Value> value_allow; |
|
Bernhard Bauer
2011/11/11 14:00:40
Class member names end with an underscore.
markusheintz_
2011/11/14 11:15:10
Shame on me. Glad I removed them now.
|
| + scoped_ptr<base::Value> value_block; |
| }; |
| TEST_F(PrefProviderTest, Observer) { |
| @@ -142,12 +147,12 @@ TEST_F(PrefProviderTest, Observer) { |
| pref_content_settings_provider.AddObserver(&mock_observer); |
| - pref_content_settings_provider.SetContentSetting( |
| + pref_content_settings_provider.SetWebsiteSetting( |
| pattern, |
| ContentSettingsPattern::Wildcard(), |
| CONTENT_SETTINGS_TYPE_IMAGES, |
| "", |
| - CONTENT_SETTING_ALLOW); |
| + value_allow.get()); |
| pref_content_settings_provider.ShutdownOnUIThread(); |
| } |
| @@ -181,12 +186,12 @@ TEST_F(PrefProviderTest, Incognito) { |
| PrefProvider pref_content_settings_provider_incognito(otr_prefs, true); |
| ContentSettingsPattern pattern = |
| ContentSettingsPattern::FromString("[*.]example.com"); |
| - pref_content_settings_provider.SetContentSetting( |
| + pref_content_settings_provider.SetWebsiteSetting( |
| pattern, |
| pattern, |
| CONTENT_SETTINGS_TYPE_IMAGES, |
| "", |
| - CONTENT_SETTING_ALLOW); |
| + value_allow.get()); |
| GURL host("http://example.com/"); |
| // The value should of course be visible in the regular PrefProvider. |
| @@ -223,11 +228,11 @@ TEST_F(PrefProviderTest, GetContentSettingsValue) { |
| &provider, primary_url, primary_url, |
| CONTENT_SETTINGS_TYPE_IMAGES, "", false)); |
| - provider.SetContentSetting(primary_pattern, |
| + provider.SetWebsiteSetting(primary_pattern, |
| primary_pattern, |
| CONTENT_SETTINGS_TYPE_IMAGES, |
| "", |
| - CONTENT_SETTING_BLOCK); |
| + value_block.get()); |
| EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| GetContentSetting(&provider, primary_url, primary_url, |
| CONTENT_SETTINGS_TYPE_IMAGES, "", false)); |
| @@ -238,11 +243,11 @@ TEST_F(PrefProviderTest, GetContentSettingsValue) { |
| value_ptr->GetAsInteger(&int_value); |
| EXPECT_EQ(CONTENT_SETTING_BLOCK, IntToContentSetting(int_value)); |
| - provider.SetContentSetting(primary_pattern, |
| + provider.SetWebsiteSetting(primary_pattern, |
| primary_pattern, |
| CONTENT_SETTINGS_TYPE_IMAGES, |
| "", |
| - CONTENT_SETTING_DEFAULT); |
| + NULL); |
| EXPECT_EQ(NULL, |
| GetContentSettingValue( |
| &provider, primary_url, primary_url, |
| @@ -270,12 +275,12 @@ TEST_F(PrefProviderTest, Patterns) { |
| GetContentSetting( |
| &pref_content_settings_provider, |
| host1, host1, CONTENT_SETTINGS_TYPE_IMAGES, "", false)); |
| - pref_content_settings_provider.SetContentSetting( |
| + pref_content_settings_provider.SetWebsiteSetting( |
| pattern1, |
| pattern1, |
| CONTENT_SETTINGS_TYPE_IMAGES, |
| "", |
| - CONTENT_SETTING_BLOCK); |
| + value_block.get()); |
| EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| GetContentSetting( |
| &pref_content_settings_provider, |
| @@ -289,12 +294,12 @@ TEST_F(PrefProviderTest, Patterns) { |
| GetContentSetting( |
| &pref_content_settings_provider, |
| host3, host3, CONTENT_SETTINGS_TYPE_IMAGES, "", false)); |
| - pref_content_settings_provider.SetContentSetting( |
| + pref_content_settings_provider.SetWebsiteSetting( |
| pattern2, |
| pattern2, |
| CONTENT_SETTINGS_TYPE_IMAGES, |
| "", |
| - CONTENT_SETTING_BLOCK); |
| + value_block.get()); |
| EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| GetContentSetting( |
| &pref_content_settings_provider, |
| @@ -304,12 +309,12 @@ TEST_F(PrefProviderTest, Patterns) { |
| GetContentSetting(&pref_content_settings_provider, |
| host4, host4, CONTENT_SETTINGS_TYPE_IMAGES, "", |
| false)); |
| - pref_content_settings_provider.SetContentSetting( |
| + pref_content_settings_provider.SetWebsiteSetting( |
| pattern3, |
| pattern3, |
| CONTENT_SETTINGS_TYPE_IMAGES, |
| "", |
| - CONTENT_SETTING_BLOCK); |
| + value_block.get()); |
| EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| GetContentSetting( |
| &pref_content_settings_provider, |
| @@ -334,12 +339,12 @@ TEST_F(PrefProviderTest, ResourceIdentifier) { |
| &pref_content_settings_provider, |
| host, host, CONTENT_SETTINGS_TYPE_PLUGINS, |
| resource1, false)); |
| - pref_content_settings_provider.SetContentSetting( |
| + pref_content_settings_provider.SetWebsiteSetting( |
| pattern, |
| pattern, |
| CONTENT_SETTINGS_TYPE_PLUGINS, |
| resource1, |
| - CONTENT_SETTING_BLOCK); |
| + value_block.get()); |
| EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| GetContentSetting( |
| &pref_content_settings_provider, |
| @@ -422,11 +427,11 @@ TEST_F(PrefProviderTest, SyncObsoletePref) { |
| ContentSettingsPattern::FromString("[*.]example.com"); |
| ContentSettingsPattern secondary_pattern = |
| ContentSettingsPattern::Wildcard(); |
| - provider.SetContentSetting(primary_pattern, |
| + provider.SetWebsiteSetting(primary_pattern, |
| secondary_pattern, |
| CONTENT_SETTINGS_TYPE_JAVASCRIPT, |
| std::string(), |
| - CONTENT_SETTING_BLOCK); |
| + value_block.get()); |
| // Test whether the obsolete preference is synced correctly. |
| patterns = prefs->GetDictionary(prefs::kContentSettingsPatterns); |
| @@ -688,12 +693,12 @@ TEST_F(PrefProviderTest, AutoSubmitCertificateContentSetting) { |
| std::string(), |
| false)); |
| - provider.SetContentSetting( |
| + provider.SetWebsiteSetting( |
| ContentSettingsPattern::FromURL(primary_url), |
| ContentSettingsPattern::Wildcard(), |
| CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, |
| std::string(), |
| - CONTENT_SETTING_ALLOW); |
| + value_allow.get()); |
| EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| GetContentSetting( |
| &provider, |