| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 EXPECT_EQ(CONTENT_SETTING_ASK, | 99 EXPECT_EQ(CONTENT_SETTING_ASK, |
| 100 map->GetContentSetting(example_url, | 100 map->GetContentSetting(example_url, |
| 101 example_url, | 101 example_url, |
| 102 CONTENT_SETTINGS_TYPE_GEOLOCATION, | 102 CONTENT_SETTINGS_TYPE_GEOLOCATION, |
| 103 std::string())); | 103 std::string())); |
| 104 EXPECT_EQ(CONTENT_SETTING_ASK, | 104 EXPECT_EQ(CONTENT_SETTING_ASK, |
| 105 map->GetContentSetting(example_url, | 105 map->GetContentSetting(example_url, |
| 106 example_url, | 106 example_url, |
| 107 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, | 107 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
| 108 std::string())); | 108 std::string())); |
| 109 EXPECT_EQ(CONTENT_SETTING_ASK, |
| 110 map->GetContentSetting(example_url, |
| 111 example_url, |
| 112 CONTENT_SETTINGS_TYPE_MOUSELOCK, |
| 113 std::string())); |
| 109 | 114 |
| 110 // Check content settings for www.google.com | 115 // Check content settings for www.google.com |
| 111 GURL url("http://www.google.com"); | 116 GURL url("http://www.google.com"); |
| 112 EXPECT_FALSE(cookie_settings->IsReadingCookieAllowed(url, url)); | 117 EXPECT_FALSE(cookie_settings->IsReadingCookieAllowed(url, url)); |
| 113 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 118 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 114 map->GetContentSetting( | 119 map->GetContentSetting( |
| 115 url, url, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); | 120 url, url, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
| 116 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 121 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 117 map->GetContentSetting( | 122 map->GetContentSetting( |
| 118 url, url, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string())); | 123 url, url, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string())); |
| 119 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 124 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 120 map->GetContentSetting( | 125 map->GetContentSetting( |
| 121 url, url, CONTENT_SETTINGS_TYPE_PLUGINS, std::string())); | 126 url, url, CONTENT_SETTINGS_TYPE_PLUGINS, std::string())); |
| 122 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 127 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 123 map->GetContentSetting( | 128 map->GetContentSetting( |
| 124 url, url, CONTENT_SETTINGS_TYPE_POPUPS, std::string())); | 129 url, url, CONTENT_SETTINGS_TYPE_POPUPS, std::string())); |
| 125 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 130 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 126 map->GetContentSetting( | 131 map->GetContentSetting( |
| 127 url, url, CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string())); | 132 url, url, CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string())); |
| 128 EXPECT_EQ( | 133 EXPECT_EQ( |
| 129 CONTENT_SETTING_BLOCK, | 134 CONTENT_SETTING_BLOCK, |
| 130 map->GetContentSetting( | 135 map->GetContentSetting( |
| 131 url, url, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string())); | 136 url, url, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string())); |
| 137 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 138 map->GetContentSetting( |
| 139 url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string())); |
| 132 } | 140 } |
| 133 | 141 |
| 134 void CheckContentSettingsDefault() { | 142 void CheckContentSettingsDefault() { |
| 135 HostContentSettingsMap* map = | 143 HostContentSettingsMap* map = |
| 136 profile_->GetHostContentSettingsMap(); | 144 profile_->GetHostContentSettingsMap(); |
| 137 CookieSettings* cookie_settings = | 145 CookieSettings* cookie_settings = |
| 138 CookieSettings::Factory::GetForProfile(profile_).get(); | 146 CookieSettings::Factory::GetForProfile(profile_).get(); |
| 139 | 147 |
| 140 // Check content settings for www.google.com | 148 // Check content settings for www.google.com |
| 141 GURL url("http://www.google.com"); | 149 GURL url("http://www.google.com"); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 154 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 162 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 155 map->GetContentSetting( | 163 map->GetContentSetting( |
| 156 url, url, CONTENT_SETTINGS_TYPE_POPUPS, std::string())); | 164 url, url, CONTENT_SETTINGS_TYPE_POPUPS, std::string())); |
| 157 EXPECT_EQ(CONTENT_SETTING_ASK, | 165 EXPECT_EQ(CONTENT_SETTING_ASK, |
| 158 map->GetContentSetting( | 166 map->GetContentSetting( |
| 159 url, url, CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string())); | 167 url, url, CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string())); |
| 160 EXPECT_EQ( | 168 EXPECT_EQ( |
| 161 CONTENT_SETTING_ASK, | 169 CONTENT_SETTING_ASK, |
| 162 map->GetContentSetting( | 170 map->GetContentSetting( |
| 163 url, url, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string())); | 171 url, url, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string())); |
| 172 EXPECT_EQ(CONTENT_SETTING_ASK, |
| 173 map->GetContentSetting( |
| 174 url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string())); |
| 164 } | 175 } |
| 165 | 176 |
| 166 private: | 177 private: |
| 167 Profile* profile_; | 178 Profile* profile_; |
| 168 }; | 179 }; |
| 169 | 180 |
| 170 // http://crbug.com/177163 | 181 // http://crbug.com/177163 |
| 171 #if defined(OS_WIN) && !defined(NDEBUG) | 182 #if defined(OS_WIN) && !defined(NDEBUG) |
| 172 #define MAYBE_Standard DISABLED_Standard | 183 #define MAYBE_Standard DISABLED_Standard |
| 173 #else | 184 #else |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 base::FilePath(kBarPath), | 229 base::FilePath(kBarPath), |
| 219 base::ASCIIToUTF16("2.3.4"), | 230 base::ASCIIToUTF16("2.3.4"), |
| 220 base::ASCIIToUTF16("bar")), | 231 base::ASCIIToUTF16("bar")), |
| 221 false); | 232 false); |
| 222 | 233 |
| 223 EXPECT_TRUE(RunExtensionTest("content_settings/getresourceidentifiers")) | 234 EXPECT_TRUE(RunExtensionTest("content_settings/getresourceidentifiers")) |
| 224 << message_; | 235 << message_; |
| 225 } | 236 } |
| 226 | 237 |
| 227 } // namespace extensions | 238 } // namespace extensions |
| OLD | NEW |