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

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

Issue 2256363003: Clean up thread handling in Blimp browser tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wez feedback Created 4 years, 4 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/app/blimp_browser_main_parts.cc ('k') | blimp/engine/browser_tests/blimp_browser_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/engine/browser_tests/blimp_browser_test.h
diff --git a/blimp/engine/browser_tests/blimp_browser_test.h b/blimp/engine/browser_tests/blimp_browser_test.h
index 820ec27e9fbd7fa285924664af12d0d1818812fd..a2990aa7210ee70867b00327d1d216bbd05c7ce0 100644
--- a/blimp/engine/browser_tests/blimp_browser_test.h
+++ b/blimp/engine/browser_tests/blimp_browser_test.h
@@ -7,6 +7,7 @@
#include <memory>
+#include "base/synchronization/waitable_event.h"
#include "content/public/test/browser_test_base.h"
namespace base {
@@ -33,13 +34,17 @@ class BlimpBrowserTest : public content::BrowserTestBase {
// exit.
void QuitRunLoop();
+ // Tells RunUntilCompletion() to break and discontinue processing UI & IO
+ // thread MessageLoops.
+ void SignalCompletion();
+
protected:
BlimpBrowserTest();
~BlimpBrowserTest() override;
- // Run an asynchronous test in a nested run loop. The caller should call
- // QuitRunLoop() to notify that the test should finish.
- void RunUntilQuit();
+ // Processes tasks in the UI and IO thread until SignalCompletion() is
+ // called.
+ void RunUntilCompletion();
engine::BlimpEngineSession* GetEngineSession();
@@ -50,15 +55,20 @@ class BlimpBrowserTest : public content::BrowserTestBase {
// content::BrowserTestBase implementation.
void RunTestOnMainThreadLoop() override;
+ void SetUpCommandLine(base::CommandLine* command_line) override;
void SetUpOnMainThread() override;
void TearDownOnMainThread() override;
- void SetUpCommandLine(base::CommandLine* command_line) override;
private:
- void OnGetEnginePort(uint16_t port);
+ // Receives the port number from an asynchronously connected socket.
+ // Calls SignalCompletion() when set.
+ void OnGetEnginePortCompletion(uint16_t port);
uint16_t engine_port_;
- std::unique_ptr<base::RunLoop> run_loop_;
+
+ // Used to signal the completion of asynchronous processing to
+ // RunUntilCompletion().
+ base::WaitableEvent completion_event_;
DISALLOW_COPY_AND_ASSIGN(BlimpBrowserTest);
};
« no previous file with comments | « blimp/engine/app/blimp_browser_main_parts.cc ('k') | blimp/engine/browser_tests/blimp_browser_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698