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

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

Issue 2032603002: Migrate WaitableEvent to enum-based constructor in base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@WEvent_enums
Patch Set: undo incorrect template change Created 4 years, 6 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_worker_thread.h" 5 #include "base/task_scheduler/scheduler_worker_thread.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 13 matching lines...) Expand all
24 namespace base { 24 namespace base {
25 namespace internal { 25 namespace internal {
26 namespace { 26 namespace {
27 27
28 const size_t kNumSequencesPerTest = 150; 28 const size_t kNumSequencesPerTest = 150;
29 29
30 // The test parameter is the number of Tasks per Sequence returned by GetWork(). 30 // The test parameter is the number of Tasks per Sequence returned by GetWork().
31 class TaskSchedulerWorkerThreadTest : public testing::TestWithParam<size_t> { 31 class TaskSchedulerWorkerThreadTest : public testing::TestWithParam<size_t> {
32 protected: 32 protected:
33 TaskSchedulerWorkerThreadTest() 33 TaskSchedulerWorkerThreadTest()
34 : main_entry_called_(true, false), 34 : main_entry_called_(WaitableEvent::ResetPolicy::MANUAL,
35 WaitableEvent::InitialState::NOT_SIGNALED),
35 num_get_work_cv_(lock_.CreateConditionVariable()), 36 num_get_work_cv_(lock_.CreateConditionVariable()),
36 worker_thread_set_(true, false) {} 37 worker_thread_set_(WaitableEvent::ResetPolicy::MANUAL,
38 WaitableEvent::InitialState::NOT_SIGNALED) {}
37 39
38 void SetUp() override { 40 void SetUp() override {
39 worker_thread_ = SchedulerWorkerThread::Create( 41 worker_thread_ = SchedulerWorkerThread::Create(
40 ThreadPriority::NORMAL, 42 ThreadPriority::NORMAL,
41 WrapUnique(new TestSchedulerWorkerThreadDelegate(this)), 43 WrapUnique(new TestSchedulerWorkerThreadDelegate(this)),
42 &task_tracker_); 44 &task_tracker_);
43 ASSERT_TRUE(worker_thread_); 45 ASSERT_TRUE(worker_thread_);
44 worker_thread_set_.Signal(); 46 worker_thread_set_.Signal();
45 main_entry_called_.Wait(); 47 main_entry_called_.Wait();
46 } 48 }
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 INSTANTIATE_TEST_CASE_P(OneTaskPerSequence, 282 INSTANTIATE_TEST_CASE_P(OneTaskPerSequence,
281 TaskSchedulerWorkerThreadTest, 283 TaskSchedulerWorkerThreadTest,
282 ::testing::Values(1)); 284 ::testing::Values(1));
283 INSTANTIATE_TEST_CASE_P(TwoTasksPerSequence, 285 INSTANTIATE_TEST_CASE_P(TwoTasksPerSequence,
284 TaskSchedulerWorkerThreadTest, 286 TaskSchedulerWorkerThreadTest,
285 ::testing::Values(2)); 287 ::testing::Values(2));
286 288
287 } // namespace 289 } // namespace
288 } // namespace internal 290 } // namespace internal
289 } // namespace base 291 } // namespace base
OLDNEW
« no previous file with comments | « base/task_scheduler/scheduler_worker_thread.cc ('k') | base/task_scheduler/task_scheduler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698