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

Side by Side Diff: chrome/browser/safe_browsing/download_protection_service_unittest.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 #include "chrome/browser/safe_browsing/download_protection_service.h" 5 #include "chrome/browser/safe_browsing/download_protection_service.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 // Helper functions for FlushThreadMessageLoops. 336 // Helper functions for FlushThreadMessageLoops.
337 void RunAllPendingAndQuitUI() { 337 void RunAllPendingAndQuitUI() {
338 base::MessageLoop::current()->RunUntilIdle(); 338 base::MessageLoop::current()->RunUntilIdle();
339 BrowserThread::PostTask( 339 BrowserThread::PostTask(
340 BrowserThread::UI, 340 BrowserThread::UI,
341 FROM_HERE, 341 FROM_HERE,
342 base::Bind(&DownloadProtectionServiceTest::QuitMessageLoop, 342 base::Bind(&DownloadProtectionServiceTest::QuitMessageLoop,
343 base::Unretained(this))); 343 base::Unretained(this)));
344 } 344 }
345 345
346 void QuitMessageLoop() { 346 void QuitMessageLoop() { base::MessageLoop::current()->QuitWhenIdle(); }
347 base::MessageLoop::current()->Quit();
348 }
349 347
350 void PostRunMessageLoopTask(BrowserThread::ID thread) { 348 void PostRunMessageLoopTask(BrowserThread::ID thread) {
351 BrowserThread::PostTask( 349 BrowserThread::PostTask(
352 thread, 350 thread,
353 FROM_HERE, 351 FROM_HERE,
354 base::Bind(&DownloadProtectionServiceTest::RunAllPendingAndQuitUI, 352 base::Bind(&DownloadProtectionServiceTest::RunAllPendingAndQuitUI,
355 base::Unretained(this))); 353 base::Unretained(this)));
356 } 354 }
357 355
358 void FlushMessageLoop(BrowserThread::ID thread) { 356 void FlushMessageLoop(BrowserThread::ID thread) {
(...skipping 11 matching lines...) Expand all
370 last_client_download_request_.reset(new ClientDownloadRequest(*request)); 368 last_client_download_request_.reset(new ClientDownloadRequest(*request));
371 else 369 else
372 last_client_download_request_.reset(); 370 last_client_download_request_.reset();
373 } 371 }
374 372
375 public: 373 public:
376 void CheckDoneCallback( 374 void CheckDoneCallback(
377 DownloadProtectionService::DownloadCheckResult result) { 375 DownloadProtectionService::DownloadCheckResult result) {
378 result_ = result; 376 result_ = result;
379 has_result_ = true; 377 has_result_ = true;
380 MessageLoop::current()->Quit(); 378 MessageLoop::current()->QuitWhenIdle();
381 } 379 }
382 380
383 void SyncCheckDoneCallback( 381 void SyncCheckDoneCallback(
384 DownloadProtectionService::DownloadCheckResult result) { 382 DownloadProtectionService::DownloadCheckResult result) {
385 result_ = result; 383 result_ = result;
386 has_result_ = true; 384 has_result_ = true;
387 } 385 }
388 386
389 void SendURLFetchComplete(net::TestURLFetcher* fetcher) { 387 void SendURLFetchComplete(net::TestURLFetcher* fetcher) {
390 fetcher->delegate()->OnURLFetchComplete(fetcher); 388 fetcher->delegate()->OnURLFetchComplete(fetcher);
(...skipping 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after
1945 1943
1946 EXPECT_CALL(mock_download_item, GetDangerType()) 1944 EXPECT_CALL(mock_download_item, GetDangerType())
1947 .WillOnce(Return(content::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST)); 1945 .WillOnce(Return(content::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST));
1948 EXPECT_CALL(mock_page_navigator, OpenURL(OpenURLParamsWithContextValue("7"))); 1946 EXPECT_CALL(mock_page_navigator, OpenURL(OpenURLParamsWithContextValue("7")));
1949 1947
1950 download_service_->ShowDetailsForDownload(mock_download_item, 1948 download_service_->ShowDetailsForDownload(mock_download_item,
1951 &mock_page_navigator); 1949 &mock_page_navigator);
1952 } 1950 }
1953 1951
1954 } // namespace safe_browsing 1952 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698