Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Side by Side Diff: chrome/browser/content_settings/cookie_settings_factory_unittest.cc

Issue 2799883003: Switch from TestBrowserThread to TestBrowserThreadBundle in chrome. (Closed)
Patch Set: fix-string Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/message_loop/message_loop.h"
6 #include "chrome/browser/content_settings/cookie_settings_factory.h" 5 #include "chrome/browser/content_settings/cookie_settings_factory.h"
7 #include "chrome/test/base/testing_profile.h" 6 #include "chrome/test/base/testing_profile.h"
8 #include "components/content_settings/core/browser/cookie_settings.h" 7 #include "components/content_settings/core/browser/cookie_settings.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/prefs/pref_service.h" 9 #include "components/prefs/pref_service.h"
11 #include "content/public/test/test_browser_thread.h" 10 #include "content/public/test/test_browser_thread_bundle.h"
12 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
13 #include "url/gurl.h" 12 #include "url/gurl.h"
14 13
15 namespace { 14 namespace {
16 15
17 class CookieSettingsFactoryTest : public testing::Test { 16 class CookieSettingsFactoryTest : public testing::Test {
18 public: 17 public:
19 CookieSettingsFactoryTest() 18 CookieSettingsFactoryTest()
20 : ui_thread_(content::BrowserThread::UI, &message_loop_), 19 : cookie_settings_(CookieSettingsFactory::GetForProfile(&profile_).get()),
21 cookie_settings_(CookieSettingsFactory::GetForProfile(&profile_).get()),
22 kBlockedSite("http://ads.thirdparty.com"), 20 kBlockedSite("http://ads.thirdparty.com"),
23 kAllowedSite("http://good.allays.com"), 21 kAllowedSite("http://good.allays.com"),
24 kFirstPartySite("http://cool.things.com"), 22 kFirstPartySite("http://cool.things.com"),
25 kHttpsSite("https://example.com") {} 23 kHttpsSite("https://example.com") {}
26 24
27 protected: 25 protected:
28 base::MessageLoop message_loop_; 26 content::TestBrowserThreadBundle test_browser_thread_bundle_;
29 content::TestBrowserThread ui_thread_;
30 TestingProfile profile_; 27 TestingProfile profile_;
31 content_settings::CookieSettings* cookie_settings_; 28 content_settings::CookieSettings* cookie_settings_;
32 const GURL kBlockedSite; 29 const GURL kBlockedSite;
33 const GURL kAllowedSite; 30 const GURL kAllowedSite;
34 const GURL kFirstPartySite; 31 const GURL kFirstPartySite;
35 const GURL kHttpsSite; 32 const GURL kHttpsSite;
36 }; 33 };
37 34
38 TEST_F(CookieSettingsFactoryTest, IncognitoBehaviorOfBlockingRules) { 35 TEST_F(CookieSettingsFactoryTest, IncognitoBehaviorOfBlockingRules) {
39 scoped_refptr<content_settings::CookieSettings> incognito_settings = 36 scoped_refptr<content_settings::CookieSettings> incognito_settings =
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 77
81 // A whitelisted item set in regular mode should apply to regular and 78 // A whitelisted item set in regular mode should apply to regular and
82 // incognito mode. 79 // incognito mode.
83 cookie_settings_->SetCookieSetting(kHttpsSite, CONTENT_SETTING_ALLOW); 80 cookie_settings_->SetCookieSetting(kHttpsSite, CONTENT_SETTING_ALLOW);
84 EXPECT_TRUE( 81 EXPECT_TRUE(
85 incognito_settings->IsCookieAccessAllowed(kHttpsSite, kHttpsSite)); 82 incognito_settings->IsCookieAccessAllowed(kHttpsSite, kHttpsSite));
86 EXPECT_TRUE(cookie_settings_->IsCookieAccessAllowed(kHttpsSite, kHttpsSite)); 83 EXPECT_TRUE(cookie_settings_->IsCookieAccessAllowed(kHttpsSite, kHttpsSite));
87 } 84 }
88 85
89 } // namespace 86 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698