OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/threading/sequenced_worker_pool.h" | 5 #include "base/threading/sequenced_worker_pool.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 } | 721 } |
722 | 722 |
723 // Verify correctness of the IsRunningSequenceOnCurrentThread method. | 723 // Verify correctness of the IsRunningSequenceOnCurrentThread method. |
724 TEST_F(SequencedWorkerPoolTest, IsRunningOnCurrentThread) { | 724 TEST_F(SequencedWorkerPoolTest, IsRunningOnCurrentThread) { |
725 SequencedWorkerPool::SequenceToken token1 = pool()->GetSequenceToken(); | 725 SequencedWorkerPool::SequenceToken token1 = pool()->GetSequenceToken(); |
726 SequencedWorkerPool::SequenceToken token2 = pool()->GetSequenceToken(); | 726 SequencedWorkerPool::SequenceToken token2 = pool()->GetSequenceToken(); |
727 SequencedWorkerPool::SequenceToken unsequenced_token; | 727 SequencedWorkerPool::SequenceToken unsequenced_token; |
728 | 728 |
729 scoped_refptr<SequencedWorkerPool> unused_pool = | 729 scoped_refptr<SequencedWorkerPool> unused_pool = |
730 new SequencedWorkerPool(2, "unused_pool"); | 730 new SequencedWorkerPool(2, "unused_pool"); |
| 731 EXPECT_TRUE(token1.Equals(unused_pool->GetSequenceToken())); |
| 732 EXPECT_TRUE(token2.Equals(unused_pool->GetSequenceToken())); |
731 | 733 |
732 EXPECT_FALSE(pool()->RunsTasksOnCurrentThread()); | 734 EXPECT_FALSE(pool()->RunsTasksOnCurrentThread()); |
733 EXPECT_FALSE(pool()->IsRunningSequenceOnCurrentThread(token1)); | 735 EXPECT_FALSE(pool()->IsRunningSequenceOnCurrentThread(token1)); |
734 EXPECT_FALSE(pool()->IsRunningSequenceOnCurrentThread(token2)); | 736 EXPECT_FALSE(pool()->IsRunningSequenceOnCurrentThread(token2)); |
735 EXPECT_FALSE(pool()->IsRunningSequenceOnCurrentThread(unsequenced_token)); | 737 EXPECT_FALSE(pool()->IsRunningSequenceOnCurrentThread(unsequenced_token)); |
736 EXPECT_FALSE(unused_pool->RunsTasksOnCurrentThread()); | 738 EXPECT_FALSE(unused_pool->RunsTasksOnCurrentThread()); |
737 EXPECT_FALSE(unused_pool->IsRunningSequenceOnCurrentThread(token1)); | 739 EXPECT_FALSE(unused_pool->IsRunningSequenceOnCurrentThread(token1)); |
738 EXPECT_FALSE(unused_pool->IsRunningSequenceOnCurrentThread(token2)); | 740 EXPECT_FALSE(unused_pool->IsRunningSequenceOnCurrentThread(token2)); |
739 EXPECT_FALSE( | 741 EXPECT_FALSE( |
740 unused_pool->IsRunningSequenceOnCurrentThread(unsequenced_token)); | 742 unused_pool->IsRunningSequenceOnCurrentThread(unsequenced_token)); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 SequencedWorkerPoolSequencedTaskRunner, TaskRunnerTest, | 929 SequencedWorkerPoolSequencedTaskRunner, TaskRunnerTest, |
928 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); | 930 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); |
929 | 931 |
930 INSTANTIATE_TYPED_TEST_CASE_P( | 932 INSTANTIATE_TYPED_TEST_CASE_P( |
931 SequencedWorkerPoolSequencedTaskRunner, SequencedTaskRunnerTest, | 933 SequencedWorkerPoolSequencedTaskRunner, SequencedTaskRunnerTest, |
932 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); | 934 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); |
933 | 935 |
934 } // namespace | 936 } // namespace |
935 | 937 |
936 } // namespace base | 938 } // namespace base |
OLD | NEW |