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

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

Issue 11228040: Move sandbox code in content to content namespace. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 1 month 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
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 void RunMessageLoop() { 47 void RunMessageLoop() {
48 base::RunLoop run_loop; 48 base::RunLoop run_loop;
49 RunThisRunLoop(&run_loop); 49 RunThisRunLoop(&run_loop);
50 } 50 }
51 51
52 void RunThisRunLoop(base::RunLoop* run_loop) { 52 void RunThisRunLoop(base::RunLoop* run_loop) {
53 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); 53 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current());
54 54
55 // If we're running inside a browser test, we might need to allow the test 55 // If we're running inside a browser test, we might need to allow the test
56 // launcher to do extra work before/after running a nested message loop. 56 // launcher to do extra work before/after running a nested message loop.
57 test_launcher::TestLauncherDelegate* delegate = 57 TestLauncherDelegate* delegate = GetCurrentTestLauncherDelegate();
58 test_launcher::GetCurrentTestLauncherDelegate();
59 if (delegate) 58 if (delegate)
60 delegate->PreRunMessageLoop(run_loop); 59 delegate->PreRunMessageLoop(run_loop);
61 run_loop->Run(); 60 run_loop->Run();
62 if (delegate) 61 if (delegate)
63 delegate->PostRunMessageLoop(); 62 delegate->PostRunMessageLoop();
64 } 63 }
65 64
66 void RunAllPendingInMessageLoop() { 65 void RunAllPendingInMessageLoop() {
67 MessageLoop::current()->PostTask(FROM_HERE, 66 MessageLoop::current()->PostTask(FROM_HERE,
68 MessageLoop::QuitWhenIdleClosure()); 67 MessageLoop::QuitWhenIdleClosure());
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 details_ = details; 138 details_ = details;
140 seen_ = true; 139 seen_ = true;
141 if (!running_) 140 if (!running_)
142 return; 141 return;
143 142
144 message_loop_runner_->Quit(); 143 message_loop_runner_->Quit();
145 running_ = false; 144 running_ = false;
146 } 145 }
147 146
148 } // namespace content 147 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698