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

Side by Side Diff: base/task_scheduler/task_scheduler_impl_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: 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/task_scheduler_impl.h" 5 #include "base/task_scheduler/task_scheduler_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 return params; 152 return params;
153 } 153 }
154 154
155 } // namespace 155 } // namespace
156 156
157 // Verifies that a Task posted via PostTaskWithTraits with parameterized 157 // Verifies that a Task posted via PostTaskWithTraits with parameterized
158 // TaskTraits runs on a thread with the expected priority and I/O restrictions. 158 // TaskTraits runs on a thread with the expected priority and I/O restrictions.
159 // The ExecutionMode parameter is ignored by this test. 159 // The ExecutionMode parameter is ignored by this test.
160 TEST_P(TaskSchedulerImplTest, PostTaskWithTraits) { 160 TEST_P(TaskSchedulerImplTest, PostTaskWithTraits) {
161 WaitableEvent task_ran(true, false); 161 WaitableEvent task_ran(WaitableEvent::ResetPolicy::MANUAL,
162 WaitableEvent::InitialState::NOT_SIGNALED);
162 scheduler_->PostTaskWithTraits( 163 scheduler_->PostTaskWithTraits(
163 FROM_HERE, GetParam().traits, 164 FROM_HERE, GetParam().traits,
164 Bind(&VerifyTaskEnvironementAndSignalEvent, GetParam().traits, 165 Bind(&VerifyTaskEnvironementAndSignalEvent, GetParam().traits,
165 Unretained(&task_ran))); 166 Unretained(&task_ran)));
166 task_ran.Wait(); 167 task_ran.Wait();
167 } 168 }
168 169
169 // Verifies that Tasks posted via a TaskRunner with parameterized TaskTraits and 170 // Verifies that Tasks posted via a TaskRunner with parameterized TaskTraits and
170 // ExecutionMode run on a thread with the expected priority and I/O restrictions 171 // ExecutionMode run on a thread with the expected priority and I/O restrictions
171 // and respect the characteristics of their ExecutionMode. 172 // and respect the characteristics of their ExecutionMode.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 } 211 }
211 212
212 scheduler->JoinForTesting(); 213 scheduler->JoinForTesting();
213 } 214 }
214 215
215 // TODO(fdoray): Add tests with Sequences that move around thread pools once 216 // TODO(fdoray): Add tests with Sequences that move around thread pools once
216 // child TaskRunners are supported. 217 // child TaskRunners are supported.
217 218
218 } // namespace internal 219 } // namespace internal
219 } // namespace base 220 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698