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 "base/message_loop/message_loop.h" |
7 #include "components/content_settings/core/browser/host_content_settings_map.h" | 8 #include "components/content_settings/core/browser/host_content_settings_map.h" |
8 #include "components/content_settings/core/common/content_settings_pattern.h" | 9 #include "components/content_settings/core/common/content_settings_pattern.h" |
9 #include "components/content_settings/core/common/pref_names.h" | 10 #include "components/content_settings/core/common/pref_names.h" |
10 #include "components/sync_preferences/testing_pref_service_syncable.h" | 11 #include "components/sync_preferences/testing_pref_service_syncable.h" |
11 #include "extensions/features/features.h" | 12 #include "extensions/features/features.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "url/gurl.h" | 14 #include "url/gurl.h" |
14 | 15 |
15 namespace content_settings { | 16 namespace content_settings { |
16 | 17 |
(...skipping 14 matching lines...) Expand all Loading... |
31 HostContentSettingsMap::RegisterProfilePrefs(prefs_.registry()); | 32 HostContentSettingsMap::RegisterProfilePrefs(prefs_.registry()); |
32 settings_map_ = new HostContentSettingsMap( | 33 settings_map_ = new HostContentSettingsMap( |
33 &prefs_, false /* incognito_profile */, false /* guest_profile */); | 34 &prefs_, false /* incognito_profile */, false /* guest_profile */); |
34 cookie_settings_ = | 35 cookie_settings_ = |
35 new CookieSettings(settings_map_.get(), &prefs_, "chrome-extension"); | 36 new CookieSettings(settings_map_.get(), &prefs_, "chrome-extension"); |
36 } | 37 } |
37 | 38 |
38 ~CookieSettingsTest() override { settings_map_->ShutdownOnUIThread(); } | 39 ~CookieSettingsTest() override { settings_map_->ShutdownOnUIThread(); } |
39 | 40 |
40 protected: | 41 protected: |
| 42 // There must be a valid ThreadTaskRunnerHandle in HostContentSettingsMap's |
| 43 // scope. |
| 44 base::MessageLoop message_loop_; |
| 45 |
41 sync_preferences::TestingPrefServiceSyncable prefs_; | 46 sync_preferences::TestingPrefServiceSyncable prefs_; |
42 scoped_refptr<HostContentSettingsMap> settings_map_; | 47 scoped_refptr<HostContentSettingsMap> settings_map_; |
43 scoped_refptr<CookieSettings> cookie_settings_; | 48 scoped_refptr<CookieSettings> cookie_settings_; |
44 const GURL kBlockedSite; | 49 const GURL kBlockedSite; |
45 const GURL kAllowedSite; | 50 const GURL kAllowedSite; |
46 const GURL kFirstPartySite; | 51 const GURL kFirstPartySite; |
47 const GURL kChromeURL; | 52 const GURL kChromeURL; |
48 const GURL kExtensionURL; | 53 const GURL kExtensionURL; |
49 const GURL kHttpSite; | 54 const GURL kHttpSite; |
50 const GURL kHttpsSite; | 55 const GURL kHttpsSite; |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 | 235 |
231 // XHRs stemming from extensions are exempt from third-party cookie blocking | 236 // XHRs stemming from extensions are exempt from third-party cookie blocking |
232 // rules (as the first party is always the extension's security origin). | 237 // rules (as the first party is always the extension's security origin). |
233 EXPECT_TRUE( | 238 EXPECT_TRUE( |
234 cookie_settings_->IsSettingCookieAllowed(kBlockedSite, kExtensionURL)); | 239 cookie_settings_->IsSettingCookieAllowed(kBlockedSite, kExtensionURL)); |
235 } | 240 } |
236 | 241 |
237 } // namespace | 242 } // namespace |
238 | 243 |
239 } // namespace content_settings | 244 } // namespace content_settings |
OLD | NEW |