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/sync_preferences/testing_pref_service_syncable.h" |
11 #include "extensions/features/features.h" | 11 #include "extensions/features/features.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
14 | 14 |
15 namespace content_settings { | 15 namespace content_settings { |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 class CookieSettingsTest : public testing::Test { | 19 class CookieSettingsTest : public testing::Test { |
20 public: | 20 public: |
(...skipping 10 matching lines...) Expand all Loading... |
31 HostContentSettingsMap::RegisterProfilePrefs(prefs_.registry()); | 31 HostContentSettingsMap::RegisterProfilePrefs(prefs_.registry()); |
32 settings_map_ = new HostContentSettingsMap( | 32 settings_map_ = new HostContentSettingsMap( |
33 &prefs_, false /* incognito_profile */, false /* guest_profile */); | 33 &prefs_, false /* incognito_profile */, false /* guest_profile */); |
34 cookie_settings_ = | 34 cookie_settings_ = |
35 new CookieSettings(settings_map_.get(), &prefs_, "chrome-extension"); | 35 new CookieSettings(settings_map_.get(), &prefs_, "chrome-extension"); |
36 } | 36 } |
37 | 37 |
38 ~CookieSettingsTest() override { settings_map_->ShutdownOnUIThread(); } | 38 ~CookieSettingsTest() override { settings_map_->ShutdownOnUIThread(); } |
39 | 39 |
40 protected: | 40 protected: |
41 user_prefs::TestingPrefServiceSyncable prefs_; | 41 sync_preferences::TestingPrefServiceSyncable prefs_; |
42 scoped_refptr<HostContentSettingsMap> settings_map_; | 42 scoped_refptr<HostContentSettingsMap> settings_map_; |
43 scoped_refptr<CookieSettings> cookie_settings_; | 43 scoped_refptr<CookieSettings> cookie_settings_; |
44 const GURL kBlockedSite; | 44 const GURL kBlockedSite; |
45 const GURL kAllowedSite; | 45 const GURL kAllowedSite; |
46 const GURL kFirstPartySite; | 46 const GURL kFirstPartySite; |
47 const GURL kChromeURL; | 47 const GURL kChromeURL; |
48 const GURL kExtensionURL; | 48 const GURL kExtensionURL; |
49 const GURL kHttpSite; | 49 const GURL kHttpSite; |
50 const GURL kHttpsSite; | 50 const GURL kHttpsSite; |
51 ContentSettingsPattern kAllHttpsSitesPattern; | 51 ContentSettingsPattern kAllHttpsSitesPattern; |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 | 230 |
231 // XHRs stemming from extensions are exempt from third-party cookie blocking | 231 // XHRs stemming from extensions are exempt from third-party cookie blocking |
232 // rules (as the first party is always the extension's security origin). | 232 // rules (as the first party is always the extension's security origin). |
233 EXPECT_TRUE( | 233 EXPECT_TRUE( |
234 cookie_settings_->IsSettingCookieAllowed(kBlockedSite, kExtensionURL)); | 234 cookie_settings_->IsSettingCookieAllowed(kBlockedSite, kExtensionURL)); |
235 } | 235 } |
236 | 236 |
237 } // namespace | 237 } // namespace |
238 | 238 |
239 } // namespace content_settings | 239 } // namespace content_settings |
OLD | NEW |