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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_test.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 uses the safebrowsing test server published at 5 // This test uses the safebrowsing test server published at
6 // http://code.google.com/p/google-safe-browsing/ to test the safebrowsing 6 // http://code.google.com/p/google-safe-browsing/ to test the safebrowsing
7 // protocol implemetation. Details of the safebrowsing testing flow is 7 // protocol implemetation. Details of the safebrowsing testing flow is
8 // documented at 8 // documented at
9 // http://code.google.com/p/google-safe-browsing/wiki/ProtocolTesting 9 // http://code.google.com/p/google-safe-browsing/wiki/ProtocolTesting
10 // 10 //
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 return response_data_; 465 return response_data_;
466 } 466 }
467 467
468 private: 468 private:
469 friend class base::RefCountedThreadSafe<SafeBrowsingServerTestHelper>; 469 friend class base::RefCountedThreadSafe<SafeBrowsingServerTestHelper>;
470 ~SafeBrowsingServerTestHelper() override {} 470 ~SafeBrowsingServerTestHelper() override {}
471 471
472 // Stops UI loop after desired status is updated. 472 // Stops UI loop after desired status is updated.
473 void StopUILoop() { 473 void StopUILoop() {
474 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI)); 474 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI));
475 base::MessageLoopForUI::current()->Quit(); 475 base::MessageLoopForUI::current()->QuitWhenIdle();
476 } 476 }
477 477
478 // Fetch a URL. If message_loop_started is true, starts the message loop 478 // Fetch a URL. If message_loop_started is true, starts the message loop
479 // so the caller could wait till OnURLFetchComplete is called. 479 // so the caller could wait till OnURLFetchComplete is called.
480 net::URLRequestStatus::Status FetchUrl(const GURL& url) { 480 net::URLRequestStatus::Status FetchUrl(const GURL& url) {
481 url_fetcher_ = net::URLFetcher::Create(url, net::URLFetcher::GET, this); 481 url_fetcher_ = net::URLFetcher::Create(url, net::URLFetcher::GET, this);
482 url_fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE); 482 url_fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE);
483 url_fetcher_->SetRequestContext(request_context_); 483 url_fetcher_->SetRequestContext(request_context_);
484 url_fetcher_->Start(); 484 url_fetcher_->Start();
485 content::RunMessageLoop(); 485 content::RunMessageLoop();
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 safe_browsing_helper->FetchDBToVerify(test_server(), step)); 574 safe_browsing_helper->FetchDBToVerify(test_server(), step));
575 EXPECT_GT(safe_browsing_helper->response_data().size(), 0U); 575 EXPECT_GT(safe_browsing_helper->response_data().size(), 0U);
576 last_step = step; 576 last_step = step;
577 } 577 }
578 578
579 // Verifies with server if test is done and waits till server responses. 579 // Verifies with server if test is done and waits till server responses.
580 EXPECT_EQ(net::URLRequestStatus::SUCCESS, 580 EXPECT_EQ(net::URLRequestStatus::SUCCESS,
581 safe_browsing_helper->VerifyTestComplete(test_server(), last_step)); 581 safe_browsing_helper->VerifyTestComplete(test_server(), last_step));
582 EXPECT_EQ("yes", safe_browsing_helper->response_data()); 582 EXPECT_EQ("yes", safe_browsing_helper->response_data());
583 } 583 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698