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

Side by Side Diff: base/task_scheduler/scheduler_thread_pool_impl_unittest.cc

Issue 1876363004: TaskScheduler [11] Support ExecutionMode::SINGLE_THREADED. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@8_delayed
Patch Set: rebase Created 4 years, 8 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/task_scheduler/scheduler_thread_pool_impl.h" 5 #include "base/task_scheduler/scheduler_thread_pool_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <unordered_set> 10 #include <unordered_set>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/bind_helpers.h" 14 #include "base/bind_helpers.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
17 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
18 #include "base/synchronization/condition_variable.h" 18 #include "base/synchronization/condition_variable.h"
19 #include "base/synchronization/lock.h" 19 #include "base/synchronization/lock.h"
20 #include "base/synchronization/waitable_event.h" 20 #include "base/synchronization/waitable_event.h"
21 #include "base/task_runner.h" 21 #include "base/task_runner.h"
22 #include "base/task_scheduler/delayed_task_manager.h" 22 #include "base/task_scheduler/delayed_task_manager.h"
23 #include "base/task_scheduler/sequence.h" 23 #include "base/task_scheduler/sequence.h"
24 #include "base/task_scheduler/sequence_sort_key.h" 24 #include "base/task_scheduler/sequence_sort_key.h"
25 #include "base/task_scheduler/task_tracker.h" 25 #include "base/task_scheduler/task_tracker.h"
26 #include "base/task_scheduler/test_task_factory.h" 26 #include "base/task_scheduler/test_task_factory.h"
27 #include "base/threading/platform_thread.h" 27 #include "base/threading/platform_thread.h"
28 #include "base/threading/simple_thread.h" 28 #include "base/threading/simple_thread.h"
29 #include "base/threading/thread_checker_impl.h"
gab 2016/04/25 21:00:20 Unused?
fdoray 2016/04/25 22:34:44 Done.
29 #include "testing/gtest/include/gtest/gtest.h" 30 #include "testing/gtest/include/gtest/gtest.h"
30 31
31 namespace base { 32 namespace base {
32 namespace internal { 33 namespace internal {
33 namespace { 34 namespace {
34 35
35 const size_t kNumThreadsInThreadPool = 4; 36 const size_t kNumThreadsInThreadPool = 4;
36 const size_t kNumThreadsPostingTasks = 4; 37 const size_t kNumThreadsPostingTasks = 4;
37 const size_t kNumTasksPostedPerThread = 150; 38 const size_t kNumTasksPostedPerThread = 150;
38 39
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 // The task should run. 308 // The task should run.
308 task_ran.Wait(); 309 task_ran.Wait();
309 } 310 }
310 311
311 INSTANTIATE_TEST_CASE_P(Parallel, 312 INSTANTIATE_TEST_CASE_P(Parallel,
312 TaskSchedulerThreadPoolImplTest, 313 TaskSchedulerThreadPoolImplTest,
313 ::testing::Values(ExecutionMode::PARALLEL)); 314 ::testing::Values(ExecutionMode::PARALLEL));
314 INSTANTIATE_TEST_CASE_P(Sequenced, 315 INSTANTIATE_TEST_CASE_P(Sequenced,
315 TaskSchedulerThreadPoolImplTest, 316 TaskSchedulerThreadPoolImplTest,
316 ::testing::Values(ExecutionMode::SEQUENCED)); 317 ::testing::Values(ExecutionMode::SEQUENCED));
318 INSTANTIATE_TEST_CASE_P(SingleThreaded,
319 TaskSchedulerThreadPoolImplTest,
320 ::testing::Values(ExecutionMode::SINGLE_THREADED));
gab 2016/04/25 21:00:20 Seeing no other modification then this to this tes
fdoray 2016/04/25 22:34:44 TestTaskFactory verifies that all tasks run on the
gab 2016/04/26 11:46:27 Ah I had missed that the extracted TestTaskFactory
317 321
318 } // namespace internal 322 } // namespace internal
319 } // namespace base 323 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698