| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/callback.h" | 6 #include "base/callback.h" |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "base/sequence_checker_impl.h" | 12 #include "base/sequence_checker_impl.h" |
| 13 #include "base/sequenced_task_runner.h" | 13 #include "base/sequenced_task_runner.h" |
| 14 #include "base/synchronization/waitable_event.h" | 14 #include "base/synchronization/waitable_event.h" |
| 15 #include "base/test/sequenced_worker_pool_owner.h" | 15 #include "base/test/sequenced_worker_pool_owner.h" |
| 16 #include "base/threading/sequenced_task_runner_handle.h" | 16 #include "base/threading/sequenced_task_runner_handle.h" |
| 17 #include "base/threading/sequenced_worker_pool.h" | 17 #include "base/threading/sequenced_worker_pool.h" |
| 18 #include "base/threading/simple_thread.h" | 18 #include "base/threading/simple_thread.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/googletest/include/gtest/gtest.h" |
| 20 | 20 |
| 21 namespace base { | 21 namespace base { |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 class SequencedTaskRunnerHandleTest : public ::testing::Test { | 24 class SequencedTaskRunnerHandleTest : public ::testing::Test { |
| 25 protected: | 25 protected: |
| 26 static void GetTaskRunner(const Closure& callback) { | 26 static void GetTaskRunner(const Closure& callback) { |
| 27 // Use SequenceCheckerImpl to make sure it's not a no-op in Release builds. | 27 // Use SequenceCheckerImpl to make sure it's not a no-op in Release builds. |
| 28 scoped_ptr<SequenceCheckerImpl> sequence_checker(new SequenceCheckerImpl); | 28 scoped_ptr<SequenceCheckerImpl> sequence_checker(new SequenceCheckerImpl); |
| 29 ASSERT_TRUE(SequencedTaskRunnerHandle::IsSet()); | 29 ASSERT_TRUE(SequencedTaskRunnerHandle::IsSet()); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 TEST_F(SequencedTaskRunnerHandleTest, FromSimpleThread) { | 77 TEST_F(SequencedTaskRunnerHandleTest, FromSimpleThread) { |
| 78 ThreadRunner thread_runner; | 78 ThreadRunner thread_runner; |
| 79 DelegateSimpleThread thread(&thread_runner, "Background thread"); | 79 DelegateSimpleThread thread(&thread_runner, "Background thread"); |
| 80 thread.Start(); | 80 thread.Start(); |
| 81 thread.Join(); | 81 thread.Join(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 } // namespace | 84 } // namespace |
| 85 } // namespace base | 85 } // namespace base |
| OLD | NEW |