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

Side by Side Diff: chrome/browser/policy/url_blacklist_manager_unittest.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 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 | Annotate | Revision Log
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 "chrome/browser/policy/url_blacklist_manager.h" 5 #include "chrome/browser/policy/url_blacklist_manager.h"
6 6
7 #include <ostream> 7 #include <ostream>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 private: 63 private:
64 int update_called_; 64 int update_called_;
65 bool set_blacklist_called_; 65 bool set_blacklist_called_;
66 66
67 DISALLOW_COPY_AND_ASSIGN(TestingURLBlacklistManager); 67 DISALLOW_COPY_AND_ASSIGN(TestingURLBlacklistManager);
68 }; 68 };
69 69
70 class URLBlacklistManagerTest : public testing::Test { 70 class URLBlacklistManagerTest : public testing::Test {
71 protected: 71 protected:
72 URLBlacklistManagerTest() 72 URLBlacklistManagerTest()
73 : loop_(MessageLoop::TYPE_IO), 73 : loop_(base::MessageLoop::TYPE_IO),
74 ui_thread_(BrowserThread::UI, &loop_), 74 ui_thread_(BrowserThread::UI, &loop_),
75 file_thread_(BrowserThread::FILE, &loop_), 75 file_thread_(BrowserThread::FILE, &loop_),
76 io_thread_(BrowserThread::IO, &loop_) { 76 io_thread_(BrowserThread::IO, &loop_) {
77 } 77 }
78 78
79 virtual void SetUp() OVERRIDE { 79 virtual void SetUp() OVERRIDE {
80 pref_service_.registry()->RegisterListPref(prefs::kUrlBlacklist); 80 pref_service_.registry()->RegisterListPref(prefs::kUrlBlacklist);
81 pref_service_.registry()->RegisterListPref(prefs::kUrlWhitelist); 81 pref_service_.registry()->RegisterListPref(prefs::kUrlWhitelist);
82 blacklist_manager_.reset( 82 blacklist_manager_.reset(
83 new TestingURLBlacklistManager(&pref_service_)); 83 new TestingURLBlacklistManager(&pref_service_));
84 loop_.RunUntilIdle(); 84 loop_.RunUntilIdle();
85 } 85 }
86 86
87 virtual void TearDown() OVERRIDE { 87 virtual void TearDown() OVERRIDE {
88 if (blacklist_manager_.get()) 88 if (blacklist_manager_.get())
89 blacklist_manager_->ShutdownOnUIThread(); 89 blacklist_manager_->ShutdownOnUIThread();
90 loop_.RunUntilIdle(); 90 loop_.RunUntilIdle();
91 // Delete |blacklist_manager_| while |io_thread_| is mapping IO to 91 // Delete |blacklist_manager_| while |io_thread_| is mapping IO to
92 // |loop_|. 92 // |loop_|.
93 blacklist_manager_.reset(); 93 blacklist_manager_.reset();
94 } 94 }
95 95
96 MessageLoop loop_; 96 base::MessageLoop loop_;
97 TestingPrefServiceSimple pref_service_; 97 TestingPrefServiceSimple pref_service_;
98 scoped_ptr<TestingURLBlacklistManager> blacklist_manager_; 98 scoped_ptr<TestingURLBlacklistManager> blacklist_manager_;
99 99
100 private: 100 private:
101 content::TestBrowserThread ui_thread_; 101 content::TestBrowserThread ui_thread_;
102 content::TestBrowserThread file_thread_; 102 content::TestBrowserThread file_thread_;
103 content::TestBrowserThread io_thread_; 103 content::TestBrowserThread io_thread_;
104 104
105 DISALLOW_COPY_AND_ASSIGN(URLBlacklistManagerTest); 105 DISALLOW_COPY_AND_ASSIGN(URLBlacklistManagerTest);
106 }; 106 };
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 525
526 GURL sync_url( 526 GURL sync_url(
527 GaiaUrls::GetInstance()->service_login_url() + "?service=chromiumsync"); 527 GaiaUrls::GetInstance()->service_login_url() + "?service=chromiumsync");
528 net::URLRequest sync_request(sync_url, NULL, &context); 528 net::URLRequest sync_request(sync_url, NULL, &context);
529 sync_request.set_load_flags(net::LOAD_MAIN_FRAME); 529 sync_request.set_load_flags(net::LOAD_MAIN_FRAME);
530 EXPECT_EQ(block_signin_urls, 530 EXPECT_EQ(block_signin_urls,
531 blacklist_manager_->IsRequestBlocked(sync_request)); 531 blacklist_manager_->IsRequestBlocked(sync_request));
532 } 532 }
533 533
534 } // namespace policy 534 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698