OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/host_content_settings_map.h" | 5 #include "chrome/browser/host_content_settings_map.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
977 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 977 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
978 host_content_settings_map->GetDefaultContentSetting( | 978 host_content_settings_map->GetDefaultContentSetting( |
979 CONTENT_SETTINGS_TYPE_PLUGINS)); | 979 CONTENT_SETTINGS_TYPE_PLUGINS)); |
980 | 980 |
981 prefs->RemoveManagedPref(prefs::kManagedDefaultPluginsSetting); | 981 prefs->RemoveManagedPref(prefs::kManagedDefaultPluginsSetting); |
982 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 982 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
983 host_content_settings_map->GetDefaultContentSetting( | 983 host_content_settings_map->GetDefaultContentSetting( |
984 CONTENT_SETTINGS_TYPE_PLUGINS)); | 984 CONTENT_SETTINGS_TYPE_PLUGINS)); |
985 } | 985 } |
986 | 986 |
987 TEST_F(HostContentSettingsMapTest, ResetToDefaultsWhenManaged) { | |
988 TestingProfile profile; | |
989 HostContentSettingsMap* host_content_settings_map = | |
990 profile.GetHostContentSettingsMap(); | |
991 TestingPrefService* prefs = profile.GetTestingPrefService(); | |
992 | |
993 prefs->SetManagedPref(prefs::kBlockThirdPartyCookies, Value::CreateBooleanValu e(true)); | |
jochen (gone - plz use gerrit)
2010/11/29 13:31:28
80c
markusheintz_
2010/11/29 13:58:02
Done.
| |
994 prefs->SetUserPref(prefs::kBlockThirdPartyCookies, Value::CreateBooleanValue(t rue)); | |
jochen (gone - plz use gerrit)
2010/11/29 13:31:28
80c
markusheintz_
2010/11/29 13:58:02
Done.
| |
995 | |
996 EXPECT_EQ(true, | |
997 host_content_settings_map->IsBlockThirdPartyCookiesManaged()); | |
998 EXPECT_EQ(true, host_content_settings_map->BlockThirdPartyCookies()); | |
999 | |
1000 // Reset to the default value (false). | |
1001 host_content_settings_map->ResetToDefaults(); | |
1002 // Since the preference BlockThirdPartyCookies is managed the | |
1003 // HostContentSettingsMap should still return the managed value which is true. | |
1004 EXPECT_EQ(true, | |
1005 host_content_settings_map->IsBlockThirdPartyCookiesManaged()); | |
1006 EXPECT_EQ(true, host_content_settings_map->BlockThirdPartyCookies()); | |
1007 | |
1008 // After unsetting the managed value for the preference BlockThirdPartyCookies | |
1009 // the default value should be returned now. | |
1010 prefs->RemoveManagedPref(prefs::kBlockThirdPartyCookies); | |
1011 EXPECT_EQ(false, | |
1012 host_content_settings_map->IsBlockThirdPartyCookiesManaged()); | |
1013 EXPECT_EQ(false, host_content_settings_map->BlockThirdPartyCookies()); | |
1014 } | |
1015 | |
987 } // namespace | 1016 } // namespace |
OLD | NEW |