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

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

Issue 2740783003: Revert "Revert of Reland: Switch WindowedNotificationObserver to use base::RunLoop. (patchset #3 id… (Closed)
Patch Set: Patch for NavigatingExtensionPopupBrowserTest.DownloadViaPost. Created 3 years, 9 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 "content/public/test/test_utils.h" 5 #include "content/public/test/test_utils.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 int notification_type, 285 int notification_type,
286 const NotificationSource& source) { 286 const NotificationSource& source) {
287 registrar_.Add(this, notification_type, source); 287 registrar_.Add(this, notification_type, source);
288 } 288 }
289 289
290 void WindowedNotificationObserver::Wait() { 290 void WindowedNotificationObserver::Wait() {
291 if (seen_) 291 if (seen_)
292 return; 292 return;
293 293
294 running_ = true; 294 running_ = true;
295 message_loop_runner_ = new MessageLoopRunner; 295 run_loop_.reset(new base::RunLoop);
296 message_loop_runner_->Run(); 296 run_loop_->Run();
297 EXPECT_TRUE(seen_); 297 EXPECT_TRUE(seen_);
298 } 298 }
299 299
300 void WindowedNotificationObserver::Observe( 300 void WindowedNotificationObserver::Observe(
301 int type, 301 int type,
302 const NotificationSource& source, 302 const NotificationSource& source,
303 const NotificationDetails& details) { 303 const NotificationDetails& details) {
304 source_ = source; 304 source_ = source;
305 details_ = details; 305 details_ = details;
306 if (!callback_.is_null() && !callback_.Run(source, details)) 306 if (!callback_.is_null() && !callback_.Run(source, details))
307 return; 307 return;
308 308
309 seen_ = true; 309 seen_ = true;
310 if (!running_) 310 if (!running_)
311 return; 311 return;
312 312
313 message_loop_runner_->Quit(); 313 run_loop_->Quit();
314 running_ = false; 314 running_ = false;
315 } 315 }
316 316
317 InProcessUtilityThreadHelper::InProcessUtilityThreadHelper() 317 InProcessUtilityThreadHelper::InProcessUtilityThreadHelper()
318 : child_thread_count_(0), shell_context_(new TestServiceManagerContext) { 318 : child_thread_count_(0), shell_context_(new TestServiceManagerContext) {
319 RenderProcessHost::SetRunRendererInProcess(true); 319 RenderProcessHost::SetRunRendererInProcess(true);
320 BrowserChildProcessObserver::Add(this); 320 BrowserChildProcessObserver::Add(this);
321 } 321 }
322 322
323 InProcessUtilityThreadHelper::~InProcessUtilityThreadHelper() { 323 InProcessUtilityThreadHelper::~InProcessUtilityThreadHelper() {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 388
389 void WebContentsDestroyedWatcher::Wait() { 389 void WebContentsDestroyedWatcher::Wait() {
390 run_loop_.Run(); 390 run_loop_.Run();
391 } 391 }
392 392
393 void WebContentsDestroyedWatcher::WebContentsDestroyed() { 393 void WebContentsDestroyedWatcher::WebContentsDestroyed() {
394 run_loop_.Quit(); 394 run_loop_.Quit();
395 } 395 }
396 396
397 } // namespace content 397 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698