| 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 "components/content_settings/core/browser/cookie_settings.h" | 5 #include "components/content_settings/core/browser/cookie_settings.h" |
| 6 | 6 |
| 7 #include "components/content_settings/core/browser/host_content_settings_map.h" | 7 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 8 #include "components/content_settings/core/common/content_settings_pattern.h" | 8 #include "components/content_settings/core/common/content_settings_pattern.h" |
| 9 #include "components/content_settings/core/common/pref_names.h" | 9 #include "components/content_settings/core/common/pref_names.h" |
| 10 #include "components/pref_registry/testing_pref_service_syncable.h" | 10 #include "components/pref_registry/testing_pref_service_syncable.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 kAllowedSite("http://good.allays.com"), | 22 kAllowedSite("http://good.allays.com"), |
| 23 kFirstPartySite("http://cool.things.com"), | 23 kFirstPartySite("http://cool.things.com"), |
| 24 kBlockedFirstPartySite("http://no.thirdparties.com"), | 24 kBlockedFirstPartySite("http://no.thirdparties.com"), |
| 25 kChromeURL("chrome://foo"), | 25 kChromeURL("chrome://foo"), |
| 26 kExtensionURL("chrome-extension://deadbeef"), | 26 kExtensionURL("chrome-extension://deadbeef"), |
| 27 kHttpSite("http://example.com"), | 27 kHttpSite("http://example.com"), |
| 28 kHttpsSite("https://example.com"), | 28 kHttpsSite("https://example.com"), |
| 29 kAllHttpsSitesPattern(ContentSettingsPattern::FromString("https://*")) { | 29 kAllHttpsSitesPattern(ContentSettingsPattern::FromString("https://*")) { |
| 30 CookieSettings::RegisterProfilePrefs(prefs_.registry()); | 30 CookieSettings::RegisterProfilePrefs(prefs_.registry()); |
| 31 HostContentSettingsMap::RegisterProfilePrefs(prefs_.registry()); | 31 HostContentSettingsMap::RegisterProfilePrefs(prefs_.registry()); |
| 32 settings_map_ = new HostContentSettingsMap(&prefs_, false); | 32 settings_map_ = new HostContentSettingsMap(&prefs_, false, false); |
| 33 cookie_settings_ = | 33 cookie_settings_ = |
| 34 new CookieSettings(settings_map_.get(), &prefs_, "chrome-extension"); | 34 new CookieSettings(settings_map_.get(), &prefs_, "chrome-extension"); |
| 35 } | 35 } |
| 36 | 36 |
| 37 ~CookieSettingsTest() override { settings_map_->ShutdownOnUIThread(); } | 37 ~CookieSettingsTest() override { settings_map_->ShutdownOnUIThread(); } |
| 38 | 38 |
| 39 protected: | 39 protected: |
| 40 user_prefs::TestingPrefServiceSyncable prefs_; | 40 user_prefs::TestingPrefServiceSyncable prefs_; |
| 41 scoped_refptr<HostContentSettingsMap> settings_map_; | 41 scoped_refptr<HostContentSettingsMap> settings_map_; |
| 42 scoped_refptr<CookieSettings> cookie_settings_; | 42 scoped_refptr<CookieSettings> cookie_settings_; |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 288 |
| 289 // XHRs stemming from extensions are exempt from third-party cookie blocking | 289 // XHRs stemming from extensions are exempt from third-party cookie blocking |
| 290 // rules (as the first party is always the extension's security origin). | 290 // rules (as the first party is always the extension's security origin). |
| 291 EXPECT_TRUE( | 291 EXPECT_TRUE( |
| 292 cookie_settings_->IsSettingCookieAllowed(kBlockedSite, kExtensionURL)); | 292 cookie_settings_->IsSettingCookieAllowed(kBlockedSite, kExtensionURL)); |
| 293 } | 293 } |
| 294 | 294 |
| 295 } // namespace | 295 } // namespace |
| 296 | 296 |
| 297 } // namespace content_settings | 297 } // namespace content_settings |
| OLD | NEW |