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 |