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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc

Issue 1395103003: Don't use base::MessageLoop::{Quit,QuitClosure} in chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 // This test creates a safebrowsing service using test safebrowsing database 5 // This test creates a safebrowsing service using test safebrowsing database
6 // and a test protocol manager. It is used to test logics in safebrowsing 6 // and a test protocol manager. It is used to test logics in safebrowsing
7 // service. 7 // service.
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 869
870 // Called when the result of checking a browse URL is known. 870 // Called when the result of checking a browse URL is known.
871 void OnCheckBrowseUrlResult(const GURL& /* url */, 871 void OnCheckBrowseUrlResult(const GURL& /* url */,
872 SBThreatType threat_type, 872 SBThreatType threat_type,
873 const std::string& /* metadata */) override { 873 const std::string& /* metadata */) override {
874 threat_type_ = threat_type; 874 threat_type_ = threat_type;
875 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 875 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
876 base::Bind(&TestSBClient::CheckDone, this)); 876 base::Bind(&TestSBClient::CheckDone, this));
877 } 877 }
878 878
879 void CheckDone() { 879 void CheckDone() { base::MessageLoopForUI::current()->QuitWhenIdle(); }
880 base::MessageLoopForUI::current()->Quit();
881 }
882 880
883 SBThreatType threat_type_; 881 SBThreatType threat_type_;
884 SafeBrowsingService* safe_browsing_service_; 882 SafeBrowsingService* safe_browsing_service_;
885 883
886 DISALLOW_COPY_AND_ASSIGN(TestSBClient); 884 DISALLOW_COPY_AND_ASSIGN(TestSBClient);
887 }; 885 };
888 886
889 // These tests use SafeBrowsingService::Client to directly interact with 887 // These tests use SafeBrowsingService::Client to directly interact with
890 // SafeBrowsingService. 888 // SafeBrowsingService.
891 namespace { 889 namespace {
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 1140
1143 SafeBrowsingServiceTest::TearDown(); 1141 SafeBrowsingServiceTest::TearDown();
1144 } 1142 }
1145 1143
1146 // An observer that returns back to test code after a new profile is 1144 // An observer that returns back to test code after a new profile is
1147 // initialized. 1145 // initialized.
1148 void OnUnblockOnProfileCreation(Profile* profile, 1146 void OnUnblockOnProfileCreation(Profile* profile,
1149 Profile::CreateStatus status) { 1147 Profile::CreateStatus status) {
1150 if (status == Profile::CREATE_STATUS_INITIALIZED) { 1148 if (status == Profile::CREATE_STATUS_INITIALIZED) {
1151 profile2_ = profile; 1149 profile2_ = profile;
1152 base::MessageLoop::current()->Quit(); 1150 base::MessageLoop::current()->QuitWhenIdle();
1153 } 1151 }
1154 } 1152 }
1155 1153
1156 protected: 1154 protected:
1157 Profile* profile2_; 1155 Profile* profile2_;
1158 }; 1156 };
1159 1157
1160 IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceShutdownTest, 1158 IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceShutdownTest,
1161 DontStartAfterShutdown) { 1159 DontStartAfterShutdown) {
1162 CreateCSDService(); 1160 CreateCSDService();
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 content::WindowedNotificationObserver observer( 1356 content::WindowedNotificationObserver observer(
1359 chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, 1357 chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE,
1360 content::Source<SafeBrowsingDatabaseManager>( 1358 content::Source<SafeBrowsingDatabaseManager>(
1361 sb_service_->database_manager().get())); 1359 sb_service_->database_manager().get()));
1362 BrowserThread::PostTask( 1360 BrowserThread::PostTask(
1363 BrowserThread::IO, 1361 BrowserThread::IO,
1364 FROM_HERE, 1362 FROM_HERE,
1365 base::Bind(&SafeBrowsingDatabaseManagerCookieTest::ForceUpdate, this)); 1363 base::Bind(&SafeBrowsingDatabaseManagerCookieTest::ForceUpdate, this));
1366 observer.Wait(); 1364 observer.Wait();
1367 } 1365 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc ('k') | chrome/browser/safe_browsing/safe_browsing_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698