| 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/content_settings/host_content_settings_map.h" | 5 #include "chrome/browser/content_settings/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 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 TestingProfile profile; | 988 TestingProfile profile; |
| 989 HostContentSettingsMap* host_content_settings_map = | 989 HostContentSettingsMap* host_content_settings_map = |
| 990 profile.GetHostContentSettingsMap(); | 990 profile.GetHostContentSettingsMap(); |
| 991 TestingPrefService* prefs = profile.GetTestingPrefService(); | 991 TestingPrefService* prefs = profile.GetTestingPrefService(); |
| 992 | 992 |
| 993 prefs->SetManagedPref(prefs::kBlockThirdPartyCookies, | 993 prefs->SetManagedPref(prefs::kBlockThirdPartyCookies, |
| 994 Value::CreateBooleanValue(true)); | 994 Value::CreateBooleanValue(true)); |
| 995 prefs->SetUserPref(prefs::kBlockThirdPartyCookies, | 995 prefs->SetUserPref(prefs::kBlockThirdPartyCookies, |
| 996 Value::CreateBooleanValue(true)); | 996 Value::CreateBooleanValue(true)); |
| 997 | 997 |
| 998 EXPECT_EQ(true, | 998 EXPECT_TRUE(host_content_settings_map->IsBlockThirdPartyCookiesManaged()); |
| 999 host_content_settings_map->IsBlockThirdPartyCookiesManaged()); | 999 EXPECT_TRUE(host_content_settings_map->BlockThirdPartyCookies()); |
| 1000 EXPECT_EQ(true, host_content_settings_map->BlockThirdPartyCookies()); | |
| 1001 | 1000 |
| 1002 // Reset to the default value (false). | 1001 // Reset to the default value (false). |
| 1003 host_content_settings_map->ResetToDefaults(); | 1002 host_content_settings_map->ResetToDefaults(); |
| 1004 // Since the preference BlockThirdPartyCookies is managed the | 1003 // Since the preference BlockThirdPartyCookies is managed the |
| 1005 // HostContentSettingsMap should still return the managed value which is true. | 1004 // HostContentSettingsMap should still return the managed value which is true. |
| 1006 EXPECT_EQ(true, | 1005 EXPECT_TRUE(host_content_settings_map->IsBlockThirdPartyCookiesManaged()); |
| 1007 host_content_settings_map->IsBlockThirdPartyCookiesManaged()); | 1006 EXPECT_TRUE(host_content_settings_map->BlockThirdPartyCookies()); |
| 1008 EXPECT_EQ(true, host_content_settings_map->BlockThirdPartyCookies()); | |
| 1009 | 1007 |
| 1010 // After unsetting the managed value for the preference BlockThirdPartyCookies | 1008 // After unsetting the managed value for the preference BlockThirdPartyCookies |
| 1011 // the default value should be returned now. | 1009 // the default value should be returned now. |
| 1012 prefs->RemoveManagedPref(prefs::kBlockThirdPartyCookies); | 1010 prefs->RemoveManagedPref(prefs::kBlockThirdPartyCookies); |
| 1013 EXPECT_EQ(false, | 1011 EXPECT_FALSE(host_content_settings_map->IsBlockThirdPartyCookiesManaged()); |
| 1014 host_content_settings_map->IsBlockThirdPartyCookiesManaged()); | 1012 EXPECT_FALSE(host_content_settings_map->BlockThirdPartyCookies()); |
| 1015 EXPECT_EQ(false, host_content_settings_map->BlockThirdPartyCookies()); | |
| 1016 } | 1013 } |
| 1017 | 1014 |
| 1018 } // namespace | 1015 } // namespace |
| OLD | NEW |