| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BASE_TEST_THREAD_TEST_HELPER_H_ | 5 #ifndef BASE_TEST_THREAD_TEST_HELPER_H_ |
| 6 #define BASE_TEST_THREAD_TEST_HELPER_H_ | 6 #define BASE_TEST_THREAD_TEST_HELPER_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 10 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 11 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
| 12 | 13 |
| 13 namespace base { | 14 namespace base { |
| 14 | 15 |
| 15 // Helper class that executes code on a given thread while blocking on the | 16 // Helper class that executes code on a given thread while blocking on the |
| 16 // invoking thread. To use, derive from this class and overwrite RunTest. An | 17 // invoking thread. To use, derive from this class and overwrite RunTest. An |
| 17 // alternative use of this class is to use it directly. It will then block | 18 // alternative use of this class is to use it directly. It will then block |
| 18 // until all pending tasks on a given thread have been executed. | 19 // until all pending tasks on a given thread have been executed. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 40 bool test_result_; | 41 bool test_result_; |
| 41 scoped_refptr<SingleThreadTaskRunner> target_thread_; | 42 scoped_refptr<SingleThreadTaskRunner> target_thread_; |
| 42 WaitableEvent done_event_; | 43 WaitableEvent done_event_; |
| 43 | 44 |
| 44 DISALLOW_COPY_AND_ASSIGN(ThreadTestHelper); | 45 DISALLOW_COPY_AND_ASSIGN(ThreadTestHelper); |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 } // namespace base | 48 } // namespace base |
| 48 | 49 |
| 49 #endif // BASE_TEST_THREAD_TEST_HELPER_H_ | 50 #endif // BASE_TEST_THREAD_TEST_HELPER_H_ |
| OLD | NEW |