| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/auto_reset.h" | 5 #include "base/auto_reset.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "chrome/browser/content_settings/content_settings_details.h" | 9 #include "chrome/browser/content_settings/content_settings_details.h" |
| 10 #include "chrome/browser/content_settings/host_content_settings_map.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 ContentSettingsPattern::Wildcard(), | 171 ContentSettingsPattern::Wildcard(), |
| 172 CONTENT_SETTINGS_TYPE_IMAGES, | 172 CONTENT_SETTINGS_TYPE_IMAGES, |
| 173 std::string(), | 173 std::string(), |
| 174 CONTENT_SETTING_BLOCK); | 174 CONTENT_SETTING_BLOCK); |
| 175 host_content_settings_map->SetContentSetting( | 175 host_content_settings_map->SetContentSetting( |
| 176 pattern2, | 176 pattern2, |
| 177 ContentSettingsPattern::Wildcard(), | 177 ContentSettingsPattern::Wildcard(), |
| 178 CONTENT_SETTINGS_TYPE_PLUGINS, | 178 CONTENT_SETTINGS_TYPE_PLUGINS, |
| 179 std::string(), | 179 std::string(), |
| 180 CONTENT_SETTING_BLOCK); | 180 CONTENT_SETTING_BLOCK); |
| 181 HostContentSettingsMap::SettingsForOneType host_settings; | 181 ContentSettingsForOneType host_settings; |
| 182 host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_IMAGES, | 182 host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_IMAGES, |
| 183 "", | 183 "", |
| 184 &host_settings); | 184 &host_settings); |
| 185 // |host_settings| contains the default setting and an exception. | 185 // |host_settings| contains the default setting and an exception. |
| 186 EXPECT_EQ(2U, host_settings.size()); | 186 EXPECT_EQ(2U, host_settings.size()); |
| 187 host_content_settings_map->GetSettingsForOneType( | 187 host_content_settings_map->GetSettingsForOneType( |
| 188 CONTENT_SETTINGS_TYPE_PLUGINS, "", &host_settings); | 188 CONTENT_SETTINGS_TYPE_PLUGINS, "", &host_settings); |
| 189 // |host_settings| contains the default setting and 2 exceptions. | 189 // |host_settings| contains the default setting and 2 exceptions. |
| 190 EXPECT_EQ(3U, host_settings.size()); | 190 EXPECT_EQ(3U, host_settings.size()); |
| 191 host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_POPUPS, | 191 host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_POPUPS, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 std::string(), | 224 std::string(), |
| 225 CONTENT_SETTING_BLOCK); | 225 CONTENT_SETTING_BLOCK); |
| 226 host_content_settings_map->SetContentSetting( | 226 host_content_settings_map->SetContentSetting( |
| 227 pattern2, | 227 pattern2, |
| 228 ContentSettingsPattern::Wildcard(), | 228 ContentSettingsPattern::Wildcard(), |
| 229 CONTENT_SETTINGS_TYPE_IMAGES, | 229 CONTENT_SETTINGS_TYPE_IMAGES, |
| 230 std::string(), | 230 std::string(), |
| 231 CONTENT_SETTING_BLOCK); | 231 CONTENT_SETTING_BLOCK); |
| 232 host_content_settings_map->ClearSettingsForOneType( | 232 host_content_settings_map->ClearSettingsForOneType( |
| 233 CONTENT_SETTINGS_TYPE_IMAGES); | 233 CONTENT_SETTINGS_TYPE_IMAGES); |
| 234 HostContentSettingsMap::SettingsForOneType host_settings; | 234 ContentSettingsForOneType host_settings; |
| 235 host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_IMAGES, | 235 host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_IMAGES, |
| 236 "", | 236 "", |
| 237 &host_settings); | 237 &host_settings); |
| 238 // |host_settings| contains only the default setting. | 238 // |host_settings| contains only the default setting. |
| 239 EXPECT_EQ(1U, host_settings.size()); | 239 EXPECT_EQ(1U, host_settings.size()); |
| 240 host_content_settings_map->GetSettingsForOneType( | 240 host_content_settings_map->GetSettingsForOneType( |
| 241 CONTENT_SETTINGS_TYPE_PLUGINS, "", &host_settings); | 241 CONTENT_SETTINGS_TYPE_PLUGINS, "", &host_settings); |
| 242 // |host_settings| contains the default setting and an exception. | 242 // |host_settings| contains the default setting and an exception. |
| 243 EXPECT_EQ(2U, host_settings.size()); | 243 EXPECT_EQ(2U, host_settings.size()); |
| 244 } | 244 } |
| (...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1243 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 1243 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 1244 host_content_settings_map->GetCookieContentSetting( | 1244 host_content_settings_map->GetCookieContentSetting( |
| 1245 kAllowedSite, kFirstPartySite, true)); | 1245 kAllowedSite, kFirstPartySite, true)); |
| 1246 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 1246 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 1247 host_content_settings_map->GetCookieContentSetting( | 1247 host_content_settings_map->GetCookieContentSetting( |
| 1248 kAllowedSite, kAllowedSite, false)); | 1248 kAllowedSite, kAllowedSite, false)); |
| 1249 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 1249 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 1250 host_content_settings_map->GetCookieContentSetting( | 1250 host_content_settings_map->GetCookieContentSetting( |
| 1251 kAllowedSite, kAllowedSite, true)); | 1251 kAllowedSite, kAllowedSite, true)); |
| 1252 } | 1252 } |
| OLD | NEW |