| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 ContentSettingsPattern::Wildcard(), | 173 ContentSettingsPattern::Wildcard(), |
| 174 CONTENT_SETTINGS_TYPE_IMAGES, | 174 CONTENT_SETTINGS_TYPE_IMAGES, |
| 175 std::string(), | 175 std::string(), |
| 176 CONTENT_SETTING_BLOCK); | 176 CONTENT_SETTING_BLOCK); |
| 177 host_content_settings_map->SetContentSetting( | 177 host_content_settings_map->SetContentSetting( |
| 178 pattern2, | 178 pattern2, |
| 179 ContentSettingsPattern::Wildcard(), | 179 ContentSettingsPattern::Wildcard(), |
| 180 CONTENT_SETTINGS_TYPE_PLUGINS, | 180 CONTENT_SETTINGS_TYPE_PLUGINS, |
| 181 std::string(), | 181 std::string(), |
| 182 CONTENT_SETTING_BLOCK); | 182 CONTENT_SETTING_BLOCK); |
| 183 HostContentSettingsMap::SettingsForOneType host_settings; | 183 ContentSettingsForOneType host_settings; |
| 184 host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_IMAGES, | 184 host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_IMAGES, |
| 185 "", | 185 "", |
| 186 &host_settings); | 186 &host_settings); |
| 187 // |host_settings| contains the default setting and an exception. | 187 // |host_settings| contains the default setting and an exception. |
| 188 EXPECT_EQ(2U, host_settings.size()); | 188 EXPECT_EQ(2U, host_settings.size()); |
| 189 host_content_settings_map->GetSettingsForOneType( | 189 host_content_settings_map->GetSettingsForOneType( |
| 190 CONTENT_SETTINGS_TYPE_PLUGINS, "", &host_settings); | 190 CONTENT_SETTINGS_TYPE_PLUGINS, "", &host_settings); |
| 191 // |host_settings| contains the default setting and 2 exceptions. | 191 // |host_settings| contains the default setting and 2 exceptions. |
| 192 EXPECT_EQ(3U, host_settings.size()); | 192 EXPECT_EQ(3U, host_settings.size()); |
| 193 host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_POPUPS, | 193 host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_POPUPS, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 std::string(), | 226 std::string(), |
| 227 CONTENT_SETTING_BLOCK); | 227 CONTENT_SETTING_BLOCK); |
| 228 host_content_settings_map->SetContentSetting( | 228 host_content_settings_map->SetContentSetting( |
| 229 pattern2, | 229 pattern2, |
| 230 ContentSettingsPattern::Wildcard(), | 230 ContentSettingsPattern::Wildcard(), |
| 231 CONTENT_SETTINGS_TYPE_IMAGES, | 231 CONTENT_SETTINGS_TYPE_IMAGES, |
| 232 std::string(), | 232 std::string(), |
| 233 CONTENT_SETTING_BLOCK); | 233 CONTENT_SETTING_BLOCK); |
| 234 host_content_settings_map->ClearSettingsForOneType( | 234 host_content_settings_map->ClearSettingsForOneType( |
| 235 CONTENT_SETTINGS_TYPE_IMAGES); | 235 CONTENT_SETTINGS_TYPE_IMAGES); |
| 236 HostContentSettingsMap::SettingsForOneType host_settings; | 236 ContentSettingsForOneType host_settings; |
| 237 host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_IMAGES, | 237 host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_IMAGES, |
| 238 "", | 238 "", |
| 239 &host_settings); | 239 &host_settings); |
| 240 // |host_settings| contains only the default setting. | 240 // |host_settings| contains only the default setting. |
| 241 EXPECT_EQ(1U, host_settings.size()); | 241 EXPECT_EQ(1U, host_settings.size()); |
| 242 host_content_settings_map->GetSettingsForOneType( | 242 host_content_settings_map->GetSettingsForOneType( |
| 243 CONTENT_SETTINGS_TYPE_PLUGINS, "", &host_settings); | 243 CONTENT_SETTINGS_TYPE_PLUGINS, "", &host_settings); |
| 244 // |host_settings| contains the default setting and an exception. | 244 // |host_settings| contains the default setting and an exception. |
| 245 EXPECT_EQ(2U, host_settings.size()); | 245 EXPECT_EQ(2U, host_settings.size()); |
| 246 } | 246 } |
| (...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, kFirstPartySite, true)); | 1251 kAllowedSite, kFirstPartySite, true)); |
| 1252 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 1252 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 1253 host_content_settings_map->GetCookieContentSetting( | 1253 host_content_settings_map->GetCookieContentSetting( |
| 1254 kAllowedSite, kAllowedSite, false)); | 1254 kAllowedSite, kAllowedSite, false)); |
| 1255 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 1255 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 1256 host_content_settings_map->GetCookieContentSetting( | 1256 host_content_settings_map->GetCookieContentSetting( |
| 1257 kAllowedSite, kAllowedSite, true)); | 1257 kAllowedSite, kAllowedSite, true)); |
| 1258 } | 1258 } |
| OLD | NEW |