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

Unified Diff: blimp/engine/browser_tests/waitable_content_pump.h

Issue 2320923002: Add a full Blimp integration test. (Closed)
Patch Set: Fix build break with chrome embedder Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « blimp/engine/browser_tests/integration_test.cc ('k') | blimp/engine/browser_tests/waitable_content_pump.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/engine/browser_tests/waitable_content_pump.h
diff --git a/blimp/engine/browser_tests/waitable_content_pump.h b/blimp/engine/browser_tests/waitable_content_pump.h
new file mode 100644
index 0000000000000000000000000000000000000000..f17acd7d59e164000f25459ebffcd5d19d246db8
--- /dev/null
+++ b/blimp/engine/browser_tests/waitable_content_pump.h
@@ -0,0 +1,43 @@
+// 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.
+
+#ifndef BLIMP_ENGINE_BROWSER_TESTS_WAITABLE_CONTENT_PUMP_H_
+#define BLIMP_ENGINE_BROWSER_TESTS_WAITABLE_CONTENT_PUMP_H_
+
+#include "base/macros.h"
+#include "base/synchronization/waitable_event.h"
+
+namespace blimp {
+
+// A helper class to suspend execution on the current stack and still allow all
+// content message loops to run until a WaitableEvent is signaled. This
+// currently only pumps the UI, IO, and FILE threads. The typical use case
+// would look like:
+//
+// WaitableContentPump waiter;
+// GiveEventToSomeoneToEventuallySignal(waiter.event());
+// waiter.Wait();
+class WaitableContentPump {
+ public:
+ WaitableContentPump();
+ virtual ~WaitableContentPump();
+
+ // Pumps content message loops until |event| is signaled. This will reset
+ // |event| afterwards.
+ static void WaitFor(base::WaitableEvent* event);
+
+ // Helper methods to use the WaitableContentPump without needing to build a
+ // WaitableEvent.
+ base::WaitableEvent* event() { return &event_; }
+ void Wait();
+
+ private:
+ base::WaitableEvent event_;
+
+ DISALLOW_COPY_AND_ASSIGN(WaitableContentPump);
+};
+
+} // namespace blimp
+
+#endif // BLIMP_ENGINE_BROWSER_TESTS_WAITABLE_CONTENT_PUMP_H_
« no previous file with comments | « blimp/engine/browser_tests/integration_test.cc ('k') | blimp/engine/browser_tests/waitable_content_pump.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698