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

Side by Side Diff: content/test/test_utils.cc

Issue 10822030: Move ui_test_utils::RunMessageLoop to test_utils so that it can be reused by content_browsertests. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
« no previous file with comments | « content/public/test/test_utils.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/public/test/test_utils.h" 5 #include "content/public/test/test_utils.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "content/public/browser/notification_service.h" 10 #include "content/public/browser/notification_service.h"
(...skipping 20 matching lines...) Expand all
31 } else { 31 } else {
32 MessageLoop::current()->PostTask(FROM_HERE, 32 MessageLoop::current()->PostTask(FROM_HERE,
33 base::Bind(&DeferredQuitRunLoop, quit_task, num_quit_deferrals - 1)); 33 base::Bind(&DeferredQuitRunLoop, quit_task, num_quit_deferrals - 1));
34 } 34 }
35 } 35 }
36 36
37 } 37 }
38 38
39 namespace content { 39 namespace content {
40 40
41 void RunMessageLoop() {
42 base::RunLoop run_loop;
43 RunThisRunLoop(&run_loop);
44 }
45
41 void RunThisRunLoop(base::RunLoop* run_loop) { 46 void RunThisRunLoop(base::RunLoop* run_loop) {
42 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); 47 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current());
43 48
44 // If we're running inside a browser test, we might need to allow the test 49 // If we're running inside a browser test, we might need to allow the test
45 // launcher to do extra work before/after running a nested message loop. 50 // launcher to do extra work before/after running a nested message loop.
46 test_launcher::TestLauncherDelegate* delegate = 51 test_launcher::TestLauncherDelegate* delegate =
47 test_launcher::GetCurrentTestLauncherDelegate(); 52 test_launcher::GetCurrentTestLauncherDelegate();
48 if (delegate) 53 if (delegate)
49 delegate->PreRunMessageLoop(run_loop); 54 delegate->PreRunMessageLoop(run_loop);
50 run_loop->Run(); 55 run_loop->Run();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 details_ = details; 109 details_ = details;
105 seen_ = true; 110 seen_ = true;
106 if (!running_) 111 if (!running_)
107 return; 112 return;
108 113
109 message_loop_runner_->Quit(); 114 message_loop_runner_->Quit();
110 running_ = false; 115 running_ = false;
111 } 116 }
112 117
113 } // namespace content 118 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698