OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "blimp/engine/browser_tests/waitable_content_pump.h" |
| 6 |
| 7 #include "content/public/browser/browser_thread.h" |
| 8 #include "content/public/test/test_utils.h" |
| 9 |
| 10 namespace blimp { |
| 11 |
| 12 WaitableContentPump::WaitableContentPump() |
| 13 : event_(base::WaitableEvent::ResetPolicy::MANUAL, |
| 14 base::WaitableEvent::InitialState::NOT_SIGNALED) {} |
| 15 |
| 16 WaitableContentPump::~WaitableContentPump() = default; |
| 17 |
| 18 // static |
| 19 void WaitableContentPump::WaitFor(base::WaitableEvent* event) { |
| 20 while (!event->IsSignaled()) { |
| 21 content::RunAllPendingInMessageLoop(content::BrowserThread::UI); |
| 22 content::RunAllPendingInMessageLoop(content::BrowserThread::IO); |
| 23 content::RunAllPendingInMessageLoop(content::BrowserThread::FILE); |
| 24 } |
| 25 event->Reset(); |
| 26 } |
| 27 |
| 28 void WaitableContentPump::Wait() { |
| 29 WaitableContentPump::WaitFor(&event_); |
| 30 } |
| 31 |
| 32 } // namespace blimp |
OLD | NEW |