Chromium Code Reviews| Index: blimp/engine/browser_tests/waitable_content_pump.cc |
| diff --git a/blimp/engine/browser_tests/waitable_content_pump.cc b/blimp/engine/browser_tests/waitable_content_pump.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b56e500f92369263ed4abf7c13f756e4e9a4432d |
| --- /dev/null |
| +++ b/blimp/engine/browser_tests/waitable_content_pump.cc |
| @@ -0,0 +1,31 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "blimp/engine/browser_tests/waitable_content_pump.h" |
| + |
| +#include "content/public/browser/browser_thread.h" |
| +#include "content/public/test/test_utils.h" |
| + |
| +namespace blimp { |
| + |
| +WaitableContentPump::WaitableContentPump() |
| + : event_(base::WaitableEvent::ResetPolicy::MANUAL, |
| + base::WaitableEvent::InitialState::NOT_SIGNALED) {} |
| + |
| +WaitableContentPump::~WaitableContentPump() = default; |
| + |
| +void WaitableContentPump::Wait() { |
| + WaitFor(event()); |
|
Khushal
2016/09/13 23:47:10
just &event_ here.
David Trainor- moved to gerrit
2016/09/14 00:31:09
Done.
|
| +} |
| + |
| +void WaitableContentPump::WaitFor(base::WaitableEvent* event) { |
| + while (!event->IsSignaled()) { |
| + content::RunAllPendingInMessageLoop(content::BrowserThread::UI); |
| + content::RunAllPendingInMessageLoop(content::BrowserThread::IO); |
| + content::RunAllPendingInMessageLoop(content::BrowserThread::FILE); |
| + } |
| + event->Reset(); |
| +} |
| + |
| +} // namespace blimp |