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 EXPECT_EQ(1U, host_settings.size()); | 185 EXPECT_EQ(1U, host_settings.size()); |
186 host_content_settings_map->GetSettingsForOneType( | 186 host_content_settings_map->GetSettingsForOneType( |
187 CONTENT_SETTINGS_TYPE_PLUGINS, "", &host_settings); | 187 CONTENT_SETTINGS_TYPE_PLUGINS, "", &host_settings); |
188 EXPECT_EQ(2U, host_settings.size()); | 188 EXPECT_EQ(2U, host_settings.size()); |
189 host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_POPUPS, | 189 host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_POPUPS, |
190 "", | 190 "", |
191 &host_settings); | 191 &host_settings); |
(...skipping 29 matching lines...) Expand all Loading... |
221 std::string(), | 221 std::string(), |
222 CONTENT_SETTING_BLOCK); | 222 CONTENT_SETTING_BLOCK); |
223 host_content_settings_map->SetContentSetting( | 223 host_content_settings_map->SetContentSetting( |
224 pattern2, | 224 pattern2, |
225 ContentSettingsPattern::Wildcard(), | 225 ContentSettingsPattern::Wildcard(), |
226 CONTENT_SETTINGS_TYPE_IMAGES, | 226 CONTENT_SETTINGS_TYPE_IMAGES, |
227 std::string(), | 227 std::string(), |
228 CONTENT_SETTING_BLOCK); | 228 CONTENT_SETTING_BLOCK); |
229 host_content_settings_map->ClearSettingsForOneType( | 229 host_content_settings_map->ClearSettingsForOneType( |
230 CONTENT_SETTINGS_TYPE_IMAGES); | 230 CONTENT_SETTINGS_TYPE_IMAGES); |
231 HostContentSettingsMap::SettingsForOneType host_settings; | 231 ContentSettingsForOneType host_settings; |
232 host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_IMAGES, | 232 host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_IMAGES, |
233 "", | 233 "", |
234 &host_settings); | 234 &host_settings); |
235 EXPECT_EQ(0U, host_settings.size()); | 235 EXPECT_EQ(0U, host_settings.size()); |
236 host_content_settings_map->GetSettingsForOneType( | 236 host_content_settings_map->GetSettingsForOneType( |
237 CONTENT_SETTINGS_TYPE_PLUGINS, "", &host_settings); | 237 CONTENT_SETTINGS_TYPE_PLUGINS, "", &host_settings); |
238 EXPECT_EQ(1U, host_settings.size()); | 238 EXPECT_EQ(1U, host_settings.size()); |
239 } | 239 } |
240 | 240 |
241 TEST_F(HostContentSettingsMapTest, Patterns) { | 241 TEST_F(HostContentSettingsMapTest, Patterns) { |
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1236 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 1236 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
1237 host_content_settings_map->GetCookieContentSetting( | 1237 host_content_settings_map->GetCookieContentSetting( |
1238 kAllowedSite, kFirstPartySite, true)); | 1238 kAllowedSite, kFirstPartySite, true)); |
1239 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 1239 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
1240 host_content_settings_map->GetCookieContentSetting( | 1240 host_content_settings_map->GetCookieContentSetting( |
1241 kAllowedSite, kAllowedSite, false)); | 1241 kAllowedSite, kAllowedSite, false)); |
1242 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 1242 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
1243 host_content_settings_map->GetCookieContentSetting( | 1243 host_content_settings_map->GetCookieContentSetting( |
1244 kAllowedSite, kAllowedSite, true)); | 1244 kAllowedSite, kAllowedSite, true)); |
1245 } | 1245 } |
OLD | NEW |