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