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

Unified Diff: base/test/android/java_handler_thread_for_testing.h

Issue 2774363003: android: Java-based launcher thread (Closed)
Patch Set: gab review 2 Created 3 years, 9 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: base/test/android/java_handler_thread_for_testing.h
diff --git a/base/test/android/java_handler_thread_for_testing.h b/base/test/android/java_handler_thread_for_testing.h
index bb3bb98cfea945018e00d66d9e1546ea4a16073d..b4384c16454dc11d683062ea33686250334b07dd 100644
--- a/base/test/android/java_handler_thread_for_testing.h
+++ b/base/test/android/java_handler_thread_for_testing.h
@@ -5,6 +5,8 @@
#ifndef BASE_ANDROID_JAVA_HANDLER_THREAD_FOR_TESTING_H_
#define BASE_ANDROID_JAVA_HANDLER_THREAD_FOR_TESTING_H_
+#include <memory>
+
#include "base/android/java_handler_thread.h"
#include "base/android/java_message_handler_factory.h"
#include "base/message_loop/message_loop.h"
@@ -36,14 +38,24 @@ class TestJavaMessageHandlerFactory : public JavaMessageHandlerFactory {
// instead.
class JavaHandlerThreadForTesting : public JavaHandlerThread {
public:
- JavaHandlerThreadForTesting(const char* name,
- base::WaitableEvent* test_done_event);
~JavaHandlerThreadForTesting() override;
+ static std::unique_ptr<JavaHandlerThreadForTesting> Create(
+ const char* name,
+ base::WaitableEvent* test_done_event);
+ // Create the Java peer first and test that it works before connecting to the
+ // native object.
+ static std::unique_ptr<JavaHandlerThreadForTesting> CreateJavaFirst(
+ base::WaitableEvent* test_done_event);
+
void StartMessageLoop() override;
void StopMessageLoop() override;
private:
+ JavaHandlerThreadForTesting(const char* name,
+ base::WaitableEvent* test_done_event);
+ explicit JavaHandlerThreadForTesting(base::WaitableEvent* test_done_event);
+
std::unique_ptr<JavaMessageHandlerFactory> message_handler_factory_;
base::WaitableEvent* test_done_event_;
};

Powered by Google App Engine
This is Rietveld 408576698