Chromium Code Reviews| 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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d3b18f20d0fbc87625189a7503b7cda8f84f3c7b |
| --- /dev/null |
| +++ b/base/test/android/java_handler_thread_for_testing.h |
| @@ -0,0 +1,42 @@ |
| +// 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 BASE_ANDROID_JAVA_HANDLER_THREAD_FOR_TESTING_H_ |
| +#define BASE_ANDROID_JAVA_HANDLER_THREAD_FOR_TESTING_H_ |
| + |
| +#include "base/android/java_handler_thread.h" |
| +#include "base/android/java_message_handler_factory.h" |
| +#include "base/message_loop/message_loop.h" |
| +#include "base/test/android/test_system_message_handler_link_android.h" |
| + |
| +namespace base { |
| + |
| +namespace android { |
| + |
| +class TestJavaMessageHandlerFactory : public JavaMessageHandlerFactory { |
|
nyquist
2016/08/18 15:50:03
Nit: Could you explain why this class exists?
gsennton
2016/08/18 18:56:54
Done.
|
| + base::android::ScopedJavaLocalRef<jobject> CreateMessageHandler( |
| + JNIEnv* env, |
| + base::MessagePump::Delegate* delegate, |
| + MessagePumpForUI* message_pump, |
| + WaitableEvent* test_done_event) override; |
| +}; |
| + |
| +class JavaHandlerThreadForTesting : public JavaHandlerThread { |
|
nyquist
2016/08/18 15:50:02
Nit: Could you add a comment as to what's special
gsennton
2016/08/18 18:56:54
Done.
|
| + public: |
| + JavaHandlerThreadForTesting(const char* name, |
| + base::WaitableEvent* test_done_event); |
| + virtual ~JavaHandlerThreadForTesting(); |
| + |
| + void StartMessageLoop() override; |
| + void StopMessageLoop() override; |
| + |
| + private: |
| + std::unique_ptr<JavaMessageHandlerFactory> message_handler_factory_; |
| + base::WaitableEvent* test_done_event_; |
| +}; |
| + |
| +} // namespace android |
| +} // namespace base |
| + |
| +#endif // BASE_ANDROID_JAVA_HANDLER_THREAD_FOR_TESTING_H_ |