OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/prefs/pref_service.h" | 5 #include "base/prefs/pref_service.h" |
6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/content_settings/cookie_settings.h" | 9 #include "chrome/browser/content_settings/cookie_settings.h" |
10 #include "chrome/browser/extensions/api/content_settings/content_settings_api.h" | 10 #include "chrome/browser/extensions/api/content_settings/content_settings_api.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 EXPECT_EQ(CONTENT_SETTING_ASK, | 124 EXPECT_EQ(CONTENT_SETTING_ASK, |
125 map->GetContentSetting(example_url, | 125 map->GetContentSetting(example_url, |
126 example_url, | 126 example_url, |
127 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, | 127 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, |
128 std::string())); | 128 std::string())); |
129 EXPECT_EQ(CONTENT_SETTING_ASK, | 129 EXPECT_EQ(CONTENT_SETTING_ASK, |
130 map->GetContentSetting(example_url, | 130 map->GetContentSetting(example_url, |
131 example_url, | 131 example_url, |
132 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, | 132 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, |
133 std::string())); | 133 std::string())); |
| 134 EXPECT_EQ(CONTENT_SETTING_ASK, |
| 135 map->GetContentSetting(example_url, |
| 136 example_url, |
| 137 CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, |
| 138 std::string())); |
134 | 139 |
135 // Check content settings for www.google.com | 140 // Check content settings for www.google.com |
136 GURL url("http://www.google.com"); | 141 GURL url("http://www.google.com"); |
137 EXPECT_FALSE(cookie_settings->IsReadingCookieAllowed(url, url)); | 142 EXPECT_FALSE(cookie_settings->IsReadingCookieAllowed(url, url)); |
138 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 143 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
139 map->GetContentSetting( | 144 map->GetContentSetting( |
140 url, url, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); | 145 url, url, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
141 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 146 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
142 map->GetContentSetting( | 147 map->GetContentSetting( |
143 url, url, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string())); | 148 url, url, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string())); |
(...skipping 18 matching lines...) Expand all Loading... |
162 url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string())); | 167 url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string())); |
163 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 168 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
164 map->GetContentSetting( | 169 map->GetContentSetting( |
165 url, url, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, std::string())); | 170 url, url, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, std::string())); |
166 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 171 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
167 map->GetContentSetting( | 172 map->GetContentSetting( |
168 url, url, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, std::string())); | 173 url, url, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, std::string())); |
169 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 174 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
170 map->GetContentSetting( | 175 map->GetContentSetting( |
171 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string())); | 176 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string())); |
| 177 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 178 map->GetContentSetting( |
| 179 url, url, CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, |
| 180 std::string())); |
172 } | 181 } |
173 | 182 |
174 void CheckContentSettingsDefault() { | 183 void CheckContentSettingsDefault() { |
175 HostContentSettingsMap* map = | 184 HostContentSettingsMap* map = |
176 profile_->GetHostContentSettingsMap(); | 185 profile_->GetHostContentSettingsMap(); |
177 CookieSettings* cookie_settings = | 186 CookieSettings* cookie_settings = |
178 CookieSettings::Factory::GetForProfile(profile_).get(); | 187 CookieSettings::Factory::GetForProfile(profile_).get(); |
179 | 188 |
180 // Check content settings for www.google.com | 189 // Check content settings for www.google.com |
181 GURL url("http://www.google.com"); | 190 GURL url("http://www.google.com"); |
(...skipping 27 matching lines...) Expand all Loading... |
209 url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string())); | 218 url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string())); |
210 EXPECT_EQ(CONTENT_SETTING_ASK, | 219 EXPECT_EQ(CONTENT_SETTING_ASK, |
211 map->GetContentSetting( | 220 map->GetContentSetting( |
212 url, url, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, std::string())); | 221 url, url, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, std::string())); |
213 EXPECT_EQ(CONTENT_SETTING_ASK, | 222 EXPECT_EQ(CONTENT_SETTING_ASK, |
214 map->GetContentSetting( | 223 map->GetContentSetting( |
215 url, url, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, std::string())); | 224 url, url, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, std::string())); |
216 EXPECT_EQ(CONTENT_SETTING_ASK, | 225 EXPECT_EQ(CONTENT_SETTING_ASK, |
217 map->GetContentSetting( | 226 map->GetContentSetting( |
218 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string())); | 227 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string())); |
| 228 EXPECT_EQ(CONTENT_SETTING_ASK, |
| 229 map->GetContentSetting( |
| 230 url, url, CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, |
| 231 std::string())); |
219 } | 232 } |
220 | 233 |
221 private: | 234 private: |
222 Profile* profile_; | 235 Profile* profile_; |
223 }; | 236 }; |
224 | 237 |
225 // http://crbug.com/177163 | 238 // http://crbug.com/177163 |
226 #if defined(OS_WIN) && !defined(NDEBUG) | 239 #if defined(OS_WIN) && !defined(NDEBUG) |
227 #define MAYBE_Standard DISABLED_Standard | 240 #define MAYBE_Standard DISABLED_Standard |
228 #else | 241 #else |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 base::FilePath(kBarPath), | 286 base::FilePath(kBarPath), |
274 base::ASCIIToUTF16("2.3.4"), | 287 base::ASCIIToUTF16("2.3.4"), |
275 base::ASCIIToUTF16("bar")), | 288 base::ASCIIToUTF16("bar")), |
276 false); | 289 false); |
277 | 290 |
278 EXPECT_TRUE(RunExtensionTest("content_settings/getresourceidentifiers")) | 291 EXPECT_TRUE(RunExtensionTest("content_settings/getresourceidentifiers")) |
279 << message_; | 292 << message_; |
280 } | 293 } |
281 | 294 |
282 } // namespace extensions | 295 } // namespace extensions |
OLD | NEW |