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

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
« no previous file with comments | « chrome/browser/host_content_settings_map.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..db1cf632b7fd4333620c2e729dc394fb181bdeae 100644
--- a/chrome/browser/host_content_settings_map_unittest.cc
+++ b/chrome/browser/host_content_settings_map_unittest.cc
@@ -984,4 +984,35 @@ 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));
+ prefs->SetUserPref(prefs::kBlockThirdPartyCookies,
+ Value::CreateBooleanValue(true));
+
+ 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
« no previous file with comments | « 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