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())); | |
733 | 731 |
734 EXPECT_FALSE(pool()->RunsTasksOnCurrentThread()); | 732 EXPECT_FALSE(pool()->RunsTasksOnCurrentThread()); |
735 EXPECT_FALSE(pool()->IsRunningSequenceOnCurrentThread(token1)); | 733 EXPECT_FALSE(pool()->IsRunningSequenceOnCurrentThread(token1)); |
736 EXPECT_FALSE(pool()->IsRunningSequenceOnCurrentThread(token2)); | 734 EXPECT_FALSE(pool()->IsRunningSequenceOnCurrentThread(token2)); |
737 EXPECT_FALSE(pool()->IsRunningSequenceOnCurrentThread(unsequenced_token)); | 735 EXPECT_FALSE(pool()->IsRunningSequenceOnCurrentThread(unsequenced_token)); |
738 EXPECT_FALSE(unused_pool->RunsTasksOnCurrentThread()); | 736 EXPECT_FALSE(unused_pool->RunsTasksOnCurrentThread()); |
739 EXPECT_FALSE(unused_pool->IsRunningSequenceOnCurrentThread(token1)); | 737 EXPECT_FALSE(unused_pool->IsRunningSequenceOnCurrentThread(token1)); |
740 EXPECT_FALSE(unused_pool->IsRunningSequenceOnCurrentThread(token2)); | 738 EXPECT_FALSE(unused_pool->IsRunningSequenceOnCurrentThread(token2)); |
741 EXPECT_FALSE( | 739 EXPECT_FALSE( |
742 unused_pool->IsRunningSequenceOnCurrentThread(unsequenced_token)); | 740 unused_pool->IsRunningSequenceOnCurrentThread(unsequenced_token)); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 SequencedWorkerPoolSequencedTaskRunner, TaskRunnerTest, | 927 SequencedWorkerPoolSequencedTaskRunner, TaskRunnerTest, |
930 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); | 928 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); |
931 | 929 |
932 INSTANTIATE_TYPED_TEST_CASE_P( | 930 INSTANTIATE_TYPED_TEST_CASE_P( |
933 SequencedWorkerPoolSequencedTaskRunner, SequencedTaskRunnerTest, | 931 SequencedWorkerPoolSequencedTaskRunner, SequencedTaskRunnerTest, |
934 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); | 932 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); |
935 | 933 |
936 } // namespace | 934 } // namespace |
937 | 935 |
938 } // namespace base | 936 } // namespace base |
OLD | NEW |