Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1652)

Unified Diff: chrome/browser/host_content_settings_map_unittest.cc

Issue 5355005: Don't reset BlockThirdPartyCookies to it's default value if the preference it managed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/host_content_settings_map_unittest.cc
diff --git a/chrome/browser/host_content_settings_map_unittest.cc b/chrome/browser/host_content_settings_map_unittest.cc
index 1312d4396c0cb9c4503b583d4775ea43cf5043d9..c4e930daf5c0ffba705318a8d3aa9fcd45b60b31 100644
--- a/chrome/browser/host_content_settings_map_unittest.cc
+++ b/chrome/browser/host_content_settings_map_unittest.cc
@@ -984,4 +984,33 @@ TEST_F(HostContentSettingsMapTest, SettingDefaultContentSettingsWhenManaged) {
CONTENT_SETTINGS_TYPE_PLUGINS));
}
+TEST_F(HostContentSettingsMapTest, ResetToDefaultsWhenManaged) {
+ TestingProfile profile;
+ HostContentSettingsMap* host_content_settings_map =
+ profile.GetHostContentSettingsMap();
+ TestingPrefService* prefs = profile.GetTestingPrefService();
+
+ prefs->SetManagedPref(prefs::kBlockThirdPartyCookies, Value::CreateBooleanValue(true));
jochen (gone - plz use gerrit) 2010/11/29 13:31:28 80c
markusheintz_ 2010/11/29 13:58:02 Done.
+ prefs->SetUserPref(prefs::kBlockThirdPartyCookies, Value::CreateBooleanValue(true));
jochen (gone - plz use gerrit) 2010/11/29 13:31:28 80c
markusheintz_ 2010/11/29 13:58:02 Done.
+
+ EXPECT_EQ(true,
+ host_content_settings_map->IsBlockThirdPartyCookiesManaged());
+ EXPECT_EQ(true, host_content_settings_map->BlockThirdPartyCookies());
+
+ // Reset to the default value (false).
+ host_content_settings_map->ResetToDefaults();
+ // Since the preference BlockThirdPartyCookies is managed the
+ // HostContentSettingsMap should still return the managed value which is true.
+ EXPECT_EQ(true,
+ host_content_settings_map->IsBlockThirdPartyCookiesManaged());
+ EXPECT_EQ(true, host_content_settings_map->BlockThirdPartyCookies());
+
+ // After unsetting the managed value for the preference BlockThirdPartyCookies
+ // the default value should be returned now.
+ prefs->RemoveManagedPref(prefs::kBlockThirdPartyCookies);
+ EXPECT_EQ(false,
+ host_content_settings_map->IsBlockThirdPartyCookiesManaged());
+ EXPECT_EQ(false, host_content_settings_map->BlockThirdPartyCookies());
+}
+
} // namespace
« chrome/browser/host_content_settings_map.cc ('K') | « chrome/browser/host_content_settings_map.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698