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

Unified Diff: base/threading/sequenced_worker_pool_unittest.cc

Issue 9522009: Move tsan suppression for SequencedWorkerPool to benign section (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/valgrind/tsan/suppressions.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/sequenced_worker_pool_unittest.cc
diff --git a/base/threading/sequenced_worker_pool_unittest.cc b/base/threading/sequenced_worker_pool_unittest.cc
index a7e9e93f86a0b6553b501cabcc80520f3411e332..d5882fd82de1ca8a1a6fd61ec1d5106ae2e46e27 100644
--- a/base/threading/sequenced_worker_pool_unittest.cc
+++ b/base/threading/sequenced_worker_pool_unittest.cc
@@ -268,6 +268,33 @@ TEST_F(SequencedWorkerPoolTest, LotsOfTasks) {
EXPECT_EQ(kNumTasks, result.size());
}
+// Tests that posting a bunch of tasks (many more than the number of
+// worker threads) to two pools simultaneously runs them all twice.
+// This test is meant to shake out any concurrency issues between
+// pools (like histograms).
+TEST_F(SequencedWorkerPoolTest, LotsOfTasksTwoPools) {
+ scoped_refptr<SequencedWorkerPool> pool1(
+ new SequencedWorkerPool(kNumWorkerThreads, "test1"));
+ scoped_refptr<SequencedWorkerPool> pool2(
+ new SequencedWorkerPool(kNumWorkerThreads, "test2"));
+
+ base::Closure slow_task = base::Bind(&TestTracker::SlowTask, tracker(), 0);
+ pool1->PostWorkerTask(FROM_HERE, slow_task);
+ pool2->PostWorkerTask(FROM_HERE, slow_task);
+
+ const size_t kNumTasks = 20;
+ for (size_t i = 1; i < kNumTasks; i++) {
+ base::Closure fast_task =
+ base::Bind(&TestTracker::FastTask, tracker(), i);
+ pool1->PostWorkerTask(FROM_HERE, fast_task);
+ pool2->PostWorkerTask(FROM_HERE, fast_task);
+ }
+
+ std::vector<int> result =
+ tracker()->WaitUntilTasksComplete(2*kNumTasks);
+ EXPECT_EQ(2*kNumTasks, result.size());
+}
+
// Test that tasks with the same sequence token are executed in order but don't
// affect other tasks.
TEST_F(SequencedWorkerPoolTest, Sequence) {
« no previous file with comments | « no previous file | tools/valgrind/tsan/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698