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

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: 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
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..65c3f9b9ded8e78d556a1879a6566cdafa83fa10 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);
+ // Stores the port number, which was retrieved asynchronously from
+ // BlimpEngineSession.
+ void set_engine_port(uint16_t port) { engine_port_ = port; }
Wez 2016/08/19 19:15:50 nit: This comment doesn't make clear why we need t
Kevin M 2016/08/19 21:43:33 Done.
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);
};

Powered by Google App Engine
This is Rietveld 408576698