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( |
| 33 &prefs_, false /* incognito_profile */, false /* guest_profile */); |
33 cookie_settings_ = | 34 cookie_settings_ = |
34 new CookieSettings(settings_map_.get(), &prefs_, "chrome-extension"); | 35 new CookieSettings(settings_map_.get(), &prefs_, "chrome-extension"); |
35 } | 36 } |
36 | 37 |
37 ~CookieSettingsTest() override { settings_map_->ShutdownOnUIThread(); } | 38 ~CookieSettingsTest() override { settings_map_->ShutdownOnUIThread(); } |
38 | 39 |
39 protected: | 40 protected: |
40 user_prefs::TestingPrefServiceSyncable prefs_; | 41 user_prefs::TestingPrefServiceSyncable prefs_; |
41 scoped_refptr<HostContentSettingsMap> settings_map_; | 42 scoped_refptr<HostContentSettingsMap> settings_map_; |
42 scoped_refptr<CookieSettings> cookie_settings_; | 43 scoped_refptr<CookieSettings> cookie_settings_; |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 | 289 |
289 // XHRs stemming from extensions are exempt from third-party cookie blocking | 290 // XHRs stemming from extensions are exempt from third-party cookie blocking |
290 // rules (as the first party is always the extension's security origin). | 291 // rules (as the first party is always the extension's security origin). |
291 EXPECT_TRUE( | 292 EXPECT_TRUE( |
292 cookie_settings_->IsSettingCookieAllowed(kBlockedSite, kExtensionURL)); | 293 cookie_settings_->IsSettingCookieAllowed(kBlockedSite, kExtensionURL)); |
293 } | 294 } |
294 | 295 |
295 } // namespace | 296 } // namespace |
296 | 297 |
297 } // namespace content_settings | 298 } // namespace content_settings |
OLD | NEW |