| Index: chrome/browser/content_settings/cookie_settings_unittest.cc
|
| diff --git a/chrome/browser/content_settings/cookie_settings_unittest.cc b/chrome/browser/content_settings/cookie_settings_unittest.cc
|
| index 8fc783b8d513bfde58d620a646088717c7d98a38..af8421992d74212154ff460e15acaa44e9a1f1e5 100644
|
| --- a/chrome/browser/content_settings/cookie_settings_unittest.cc
|
| +++ b/chrome/browser/content_settings/cookie_settings_unittest.cc
|
| @@ -233,4 +233,38 @@ TEST_F(CookieSettingsTest, CookiesBlockSingleFirstParty) {
|
| kAllowedSite, kFirstPartySite));
|
| }
|
|
|
| +TEST_F(CookieSettingsTest, ExtensionsRegularSettings) {
|
| + TestingProfile profile;
|
| + CookieSettings* cookie_settings = CookieSettings::GetForProfile(&profile);
|
| + cookie_settings->SetCookieSetting(
|
| + ContentSettingsPattern::FromURL(kBlockedSite),
|
| + ContentSettingsPattern::Wildcard(),
|
| + CONTENT_SETTING_BLOCK);
|
| +
|
| + // Regular cookie settings also apply to extensions.
|
| + EXPECT_FALSE(cookie_settings->IsReadingCookieAllowed(
|
| + kBlockedSite, kExtensionURL));
|
| +}
|
| +
|
| +TEST_F(CookieSettingsTest, ExtensionsOwnCookies) {
|
| + TestingProfile profile;
|
| + CookieSettings* cookie_settings = CookieSettings::GetForProfile(&profile);
|
| + cookie_settings->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK);
|
| +
|
| + // Extensions can always use cookies (and site data) in their own origin.
|
| + EXPECT_TRUE(cookie_settings->IsReadingCookieAllowed(
|
| + kExtensionURL, kExtensionURL));
|
| +}
|
| +
|
| +TEST_F(CookieSettingsTest, ExtensionsThirdParty) {
|
| + TestingProfile profile;
|
| + CookieSettings* cookie_settings = CookieSettings::GetForProfile(&profile);
|
| + profile.GetPrefs()->SetBoolean(prefs::kBlockThirdPartyCookies, true);
|
| +
|
| + // XHRs stemming from extensions are exempt from third-party cookie blocking
|
| + // rules (as the first party is always the extension's security origin).
|
| + EXPECT_TRUE(cookie_settings->IsSettingCookieAllowed(
|
| + kBlockedSite, kExtensionURL));
|
| +}
|
| +
|
| } // namespace
|
|
|