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

Unified Diff: mojo/edk/test/simple_test_thread.h

Issue 1361143004: EDK: Add a mojo::test::SimpleTestThread (and use it). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 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 | « mojo/edk/test/BUILD.gn ('k') | mojo/edk/test/simple_test_thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/test/simple_test_thread.h
diff --git a/mojo/edk/test/simple_test_thread.h b/mojo/edk/test/simple_test_thread.h
new file mode 100644
index 0000000000000000000000000000000000000000..36ec7cde81679b4ec58e0676f5de5585e599ff76
--- /dev/null
+++ b/mojo/edk/test/simple_test_thread.h
@@ -0,0 +1,40 @@
+// Copyright 2015 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 MOJO_EDK_TEST_SIMPLE_TEST_THREAD_
+#define MOJO_EDK_TEST_SIMPLE_TEST_THREAD_
+
+#include "base/threading/simple_thread.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace test {
+
+// Class to help simple threads (with no message loops) in tests.
+class SimpleTestThread : public base::DelegateSimpleThread::Delegate {
+ public:
+ SimpleTestThread();
+ ~SimpleTestThread() override;
+
+ // Starts the thread.
+ void Start();
+
+ // Joins the thread; this must be called if the thread was started.
+ void Join();
+
+ // Note: Subclasses must implement:
vardhan 2015/09/23 23:36:22 Could this note be above the class?
viettrungluu 2015/09/23 23:37:13 It could be, but it's sitting there as a placehold
+ // virtual void Run() = 0;
+ // TODO(vtl): When we stop using |base::DelegateSimpleThread|, this will
+ // directly become part of our interface.
+
+ private:
+ base::DelegateSimpleThread thread_;
+
+ MOJO_DISALLOW_COPY_AND_ASSIGN(SimpleTestThread);
+};
+
+} // namespace test
+} // namespace mojo
+
+#endif // MOJO_EDK_TEST_SIMPLE_TEST_THREAD_
« no previous file with comments | « mojo/edk/test/BUILD.gn ('k') | mojo/edk/test/simple_test_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698