| 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 int notification_type, | 297 int notification_type, |
| 298 const NotificationSource& source) { | 298 const NotificationSource& source) { |
| 299 registrar_.Add(this, notification_type, source); | 299 registrar_.Add(this, notification_type, source); |
| 300 } | 300 } |
| 301 | 301 |
| 302 void WindowedNotificationObserver::Wait() { | 302 void WindowedNotificationObserver::Wait() { |
| 303 if (seen_) | 303 if (seen_) |
| 304 return; | 304 return; |
| 305 | 305 |
| 306 running_ = true; | 306 running_ = true; |
| 307 run_loop_.reset(new base::RunLoop); | 307 message_loop_runner_ = new MessageLoopRunner; |
| 308 run_loop_->Run(); | 308 message_loop_runner_->Run(); |
| 309 EXPECT_TRUE(seen_); | 309 EXPECT_TRUE(seen_); |
| 310 } | 310 } |
| 311 | 311 |
| 312 void WindowedNotificationObserver::Observe( | 312 void WindowedNotificationObserver::Observe( |
| 313 int type, | 313 int type, |
| 314 const NotificationSource& source, | 314 const NotificationSource& source, |
| 315 const NotificationDetails& details) { | 315 const NotificationDetails& details) { |
| 316 source_ = source; | 316 source_ = source; |
| 317 details_ = details; | 317 details_ = details; |
| 318 if (!callback_.is_null() && !callback_.Run(source, details)) | 318 if (!callback_.is_null() && !callback_.Run(source, details)) |
| 319 return; | 319 return; |
| 320 | 320 |
| 321 seen_ = true; | 321 seen_ = true; |
| 322 if (!running_) | 322 if (!running_) |
| 323 return; | 323 return; |
| 324 | 324 |
| 325 run_loop_->Quit(); | 325 message_loop_runner_->Quit(); |
| 326 running_ = false; | 326 running_ = false; |
| 327 } | 327 } |
| 328 | 328 |
| 329 InProcessUtilityThreadHelper::InProcessUtilityThreadHelper() | 329 InProcessUtilityThreadHelper::InProcessUtilityThreadHelper() |
| 330 : child_thread_count_(0), shell_context_(new TestServiceManagerContext) { | 330 : child_thread_count_(0), shell_context_(new TestServiceManagerContext) { |
| 331 RenderProcessHost::SetRunRendererInProcess(true); | 331 RenderProcessHost::SetRunRendererInProcess(true); |
| 332 BrowserChildProcessObserver::Add(this); | 332 BrowserChildProcessObserver::Add(this); |
| 333 } | 333 } |
| 334 | 334 |
| 335 InProcessUtilityThreadHelper::~InProcessUtilityThreadHelper() { | 335 InProcessUtilityThreadHelper::~InProcessUtilityThreadHelper() { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 | 400 |
| 401 void WebContentsDestroyedWatcher::Wait() { | 401 void WebContentsDestroyedWatcher::Wait() { |
| 402 run_loop_.Run(); | 402 run_loop_.Run(); |
| 403 } | 403 } |
| 404 | 404 |
| 405 void WebContentsDestroyedWatcher::WebContentsDestroyed() { | 405 void WebContentsDestroyedWatcher::WebContentsDestroyed() { |
| 406 run_loop_.Quit(); | 406 run_loop_.Quit(); |
| 407 } | 407 } |
| 408 | 408 |
| 409 } // namespace content | 409 } // namespace content |
| OLD | NEW |