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

Side by Side Diff: base/threading/sequenced_worker_pool_unittest.cc

Issue 18650006: base: Make SequencedWorkerPool issue globally unique SequenceTokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: base: SequencedWorkerPool Globally Unique Tokens with unused-variable fix. Created 7 years, 5 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 unified diff | Download patch
« no previous file with comments | « base/threading/sequenced_worker_pool.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « base/threading/sequenced_worker_pool.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698