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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 ContentSettingsPattern::Wildcard(), | 169 ContentSettingsPattern::Wildcard(), |
170 CONTENT_SETTINGS_TYPE_IMAGES, | 170 CONTENT_SETTINGS_TYPE_IMAGES, |
171 std::string(), | 171 std::string(), |
172 CONTENT_SETTING_BLOCK); | 172 CONTENT_SETTING_BLOCK); |
173 host_content_settings_map->SetContentSetting( | 173 host_content_settings_map->SetContentSetting( |
174 pattern2, | 174 pattern2, |
175 ContentSettingsPattern::Wildcard(), | 175 ContentSettingsPattern::Wildcard(), |
176 CONTENT_SETTINGS_TYPE_PLUGINS, | 176 CONTENT_SETTINGS_TYPE_PLUGINS, |
177 std::string(), | 177 std::string(), |
178 CONTENT_SETTING_BLOCK); | 178 CONTENT_SETTING_BLOCK); |
179 HostContentSettingsMap::SettingsForOneType host_settings; | 179 ContentSettingsForOneType host_settings; |
180 host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_IMAGES, | 180 host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_IMAGES, |
181 "", | 181 "", |
182 &host_settings); | 182 &host_settings); |
183 EXPECT_EQ(1U, host_settings.size()); | 183 EXPECT_EQ(1U, host_settings.size()); |
184 host_content_settings_map->GetSettingsForOneType( | 184 host_content_settings_map->GetSettingsForOneType( |
185 CONTENT_SETTINGS_TYPE_PLUGINS, "", &host_settings); | 185 CONTENT_SETTINGS_TYPE_PLUGINS, "", &host_settings); |
186 EXPECT_EQ(2U, host_settings.size()); | 186 EXPECT_EQ(2U, host_settings.size()); |
187 host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_POPUPS, | 187 host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_POPUPS, |
188 "", | 188 "", |
189 &host_settings); | 189 &host_settings); |
(...skipping 29 matching lines...) Expand all Loading... |
219 std::string(), | 219 std::string(), |
220 CONTENT_SETTING_BLOCK); | 220 CONTENT_SETTING_BLOCK); |
221 host_content_settings_map->SetContentSetting( | 221 host_content_settings_map->SetContentSetting( |
222 pattern2, | 222 pattern2, |
223 ContentSettingsPattern::Wildcard(), | 223 ContentSettingsPattern::Wildcard(), |
224 CONTENT_SETTINGS_TYPE_IMAGES, | 224 CONTENT_SETTINGS_TYPE_IMAGES, |
225 std::string(), | 225 std::string(), |
226 CONTENT_SETTING_BLOCK); | 226 CONTENT_SETTING_BLOCK); |
227 host_content_settings_map->ClearSettingsForOneType( | 227 host_content_settings_map->ClearSettingsForOneType( |
228 CONTENT_SETTINGS_TYPE_IMAGES); | 228 CONTENT_SETTINGS_TYPE_IMAGES); |
229 HostContentSettingsMap::SettingsForOneType host_settings; | 229 ContentSettingsForOneType host_settings; |
230 host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_IMAGES, | 230 host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_IMAGES, |
231 "", | 231 "", |
232 &host_settings); | 232 &host_settings); |
233 EXPECT_EQ(0U, host_settings.size()); | 233 EXPECT_EQ(0U, host_settings.size()); |
234 host_content_settings_map->GetSettingsForOneType( | 234 host_content_settings_map->GetSettingsForOneType( |
235 CONTENT_SETTINGS_TYPE_PLUGINS, "", &host_settings); | 235 CONTENT_SETTINGS_TYPE_PLUGINS, "", &host_settings); |
236 EXPECT_EQ(1U, host_settings.size()); | 236 EXPECT_EQ(1U, host_settings.size()); |
237 } | 237 } |
238 | 238 |
239 TEST_F(HostContentSettingsMapTest, Patterns) { | 239 TEST_F(HostContentSettingsMapTest, Patterns) { |
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 1261 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
1262 host_content_settings_map->GetCookieContentSetting( | 1262 host_content_settings_map->GetCookieContentSetting( |
1263 kAllowedSite, kFirstPartySite, true)); | 1263 kAllowedSite, kFirstPartySite, true)); |
1264 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 1264 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
1265 host_content_settings_map->GetCookieContentSetting( | 1265 host_content_settings_map->GetCookieContentSetting( |
1266 kAllowedSite, kAllowedSite, false)); | 1266 kAllowedSite, kAllowedSite, false)); |
1267 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 1267 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
1268 host_content_settings_map->GetCookieContentSetting( | 1268 host_content_settings_map->GetCookieContentSetting( |
1269 kAllowedSite, kAllowedSite, true)); | 1269 kAllowedSite, kAllowedSite, true)); |
1270 } | 1270 } |
OLD | NEW |