| OLD | NEW |
| 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 int notification_type, | 284 int notification_type, |
| 285 const NotificationSource& source) { | 285 const NotificationSource& source) { |
| 286 registrar_.Add(this, notification_type, source); | 286 registrar_.Add(this, notification_type, source); |
| 287 } | 287 } |
| 288 | 288 |
| 289 void WindowedNotificationObserver::Wait() { | 289 void WindowedNotificationObserver::Wait() { |
| 290 if (seen_) | 290 if (seen_) |
| 291 return; | 291 return; |
| 292 | 292 |
| 293 running_ = true; | 293 running_ = true; |
| 294 message_loop_runner_ = new MessageLoopRunner; | 294 run_loop_.reset(new base::RunLoop); |
| 295 message_loop_runner_->Run(); | 295 run_loop_->Run(); |
| 296 EXPECT_TRUE(seen_); | 296 EXPECT_TRUE(seen_); |
| 297 } | 297 } |
| 298 | 298 |
| 299 void WindowedNotificationObserver::Observe( | 299 void WindowedNotificationObserver::Observe( |
| 300 int type, | 300 int type, |
| 301 const NotificationSource& source, | 301 const NotificationSource& source, |
| 302 const NotificationDetails& details) { | 302 const NotificationDetails& details) { |
| 303 source_ = source; | 303 source_ = source; |
| 304 details_ = details; | 304 details_ = details; |
| 305 if (!callback_.is_null() && !callback_.Run(source, details)) | 305 if (!callback_.is_null() && !callback_.Run(source, details)) |
| 306 return; | 306 return; |
| 307 | 307 |
| 308 seen_ = true; | 308 seen_ = true; |
| 309 if (!running_) | 309 if (!running_) |
| 310 return; | 310 return; |
| 311 | 311 |
| 312 message_loop_runner_->Quit(); | 312 run_loop_->Quit(); |
| 313 running_ = false; | 313 running_ = false; |
| 314 } | 314 } |
| 315 | 315 |
| 316 InProcessUtilityThreadHelper::InProcessUtilityThreadHelper() | 316 InProcessUtilityThreadHelper::InProcessUtilityThreadHelper() |
| 317 : child_thread_count_(0), shell_context_(new TestServiceManagerContext) { | 317 : child_thread_count_(0), shell_context_(new TestServiceManagerContext) { |
| 318 RenderProcessHost::SetRunRendererInProcess(true); | 318 RenderProcessHost::SetRunRendererInProcess(true); |
| 319 BrowserChildProcessObserver::Add(this); | 319 BrowserChildProcessObserver::Add(this); |
| 320 } | 320 } |
| 321 | 321 |
| 322 InProcessUtilityThreadHelper::~InProcessUtilityThreadHelper() { | 322 InProcessUtilityThreadHelper::~InProcessUtilityThreadHelper() { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 | 387 |
| 388 void WebContentsDestroyedWatcher::Wait() { | 388 void WebContentsDestroyedWatcher::Wait() { |
| 389 run_loop_.Run(); | 389 run_loop_.Run(); |
| 390 } | 390 } |
| 391 | 391 |
| 392 void WebContentsDestroyedWatcher::WebContentsDestroyed() { | 392 void WebContentsDestroyedWatcher::WebContentsDestroyed() { |
| 393 run_loop_.Quit(); | 393 run_loop_.Quit(); |
| 394 } | 394 } |
| 395 | 395 |
| 396 } // namespace content | 396 } // namespace content |
| OLD | NEW |