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

Side by Side Diff: content/shell/browser/blink_test_controller.cc

Issue 1398153002: Don't use base::MessageLoop::{Quit,QuitClosure} in content/ (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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/shell/browser/blink_test_controller.h" 5 #include "content/shell/browser/blink_test_controller.h"
6 6
7 #include <iostream> 7 #include <iostream>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 } 491 }
492 492
493 void BlinkTestController::DiscardMainWindow() { 493 void BlinkTestController::DiscardMainWindow() {
494 // If we're running a test, we need to close all windows and exit the message 494 // If we're running a test, we need to close all windows and exit the message
495 // loop. Otherwise, we're already outside of the message loop, and we just 495 // loop. Otherwise, we're already outside of the message loop, and we just
496 // discard the main window. 496 // discard the main window.
497 WebContentsObserver::Observe(NULL); 497 WebContentsObserver::Observe(NULL);
498 if (test_phase_ != BETWEEN_TESTS) { 498 if (test_phase_ != BETWEEN_TESTS) {
499 Shell::CloseAllWindows(); 499 Shell::CloseAllWindows();
500 base::ThreadTaskRunnerHandle::Get()->PostTask( 500 base::ThreadTaskRunnerHandle::Get()->PostTask(
501 FROM_HERE, base::MessageLoop::QuitClosure()); 501 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
502 test_phase_ = CLEAN_UP; 502 test_phase_ = CLEAN_UP;
503 } else if (main_window_) { 503 } else if (main_window_) {
504 main_window_->Close(); 504 main_window_->Close();
505 } 505 }
506 main_window_ = NULL; 506 main_window_ = NULL;
507 current_pid_ = base::kNullProcessId; 507 current_pid_ = base::kNullProcessId;
508 } 508 }
509 509
510 void BlinkTestController::SendTestConfiguration() { 510 void BlinkTestController::SendTestConfiguration() {
511 RenderViewHost* render_view_host = 511 RenderViewHost* render_view_host =
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 if (main_window_ && main_window_->web_contents()) { 694 if (main_window_ && main_window_->web_contents()) {
695 RenderViewHost* render_view_host = 695 RenderViewHost* render_view_host =
696 main_window_->web_contents()->GetRenderViewHost(); 696 main_window_->web_contents()->GetRenderViewHost();
697 render_view_host->Send( 697 render_view_host->Send(
698 new ShellViewMsg_TryLeakDetection(render_view_host->GetRoutingID())); 698 new ShellViewMsg_TryLeakDetection(render_view_host->GetRoutingID()));
699 } 699 }
700 return; 700 return;
701 } 701 }
702 702
703 base::ThreadTaskRunnerHandle::Get()->PostTask( 703 base::ThreadTaskRunnerHandle::Get()->PostTask(
704 FROM_HERE, base::MessageLoop::QuitClosure()); 704 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
705 } 705 }
706 706
707 void BlinkTestController::OnLeakDetectionDone( 707 void BlinkTestController::OnLeakDetectionDone(
708 const LeakDetectionResult& result) { 708 const LeakDetectionResult& result) {
709 if (!result.leaked) { 709 if (!result.leaked) {
710 base::ThreadTaskRunnerHandle::Get()->PostTask( 710 base::ThreadTaskRunnerHandle::Get()->PostTask(
711 FROM_HERE, base::MessageLoop::QuitClosure()); 711 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
712 return; 712 return;
713 } 713 }
714 714
715 printer_->AddErrorMessage( 715 printer_->AddErrorMessage(
716 base::StringPrintf("#LEAK - renderer pid %d (%s)", current_pid_, 716 base::StringPrintf("#LEAK - renderer pid %d (%s)", current_pid_,
717 result.detail.c_str())); 717 result.detail.c_str()));
718 CHECK(!crash_when_leak_found_); 718 CHECK(!crash_when_leak_found_);
719 719
720 DiscardMainWindow(); 720 DiscardMainWindow();
721 } 721 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 } else { 758 } else {
759 printer_->AddErrorMessage(base::StringPrintf( 759 printer_->AddErrorMessage(base::StringPrintf(
760 "FAIL: Unexpected sendBluetoothManualChooserEvent() event name '%s'.", 760 "FAIL: Unexpected sendBluetoothManualChooserEvent() event name '%s'.",
761 event_name.c_str())); 761 event_name.c_str()));
762 return; 762 return;
763 } 763 }
764 bluetooth_chooser_factory_->SendEvent(event, argument); 764 bluetooth_chooser_factory_->SendEvent(event, argument);
765 } 765 }
766 766
767 } // namespace content 767 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698