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

Side by Side Diff: base/test/scoped_task_scheduler.cc

Issue 2750823002: Flush TaskScheduler in content::RunAllBlockingPoolTasksUntilIdle(). (Closed)
Patch Set: fix test error Created 3 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
« no previous file with comments | « no previous file | content/public/test/test_utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/test/scoped_task_scheduler.h" 5 #include "base/test/scoped_task_scheduler.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 void TestTaskScheduler::Shutdown() { 215 void TestTaskScheduler::Shutdown() {
216 // Prevent SKIP_ON_SHUTDOWN and CONTINUE_ON_SHUTDOWN tasks from running from 216 // Prevent SKIP_ON_SHUTDOWN and CONTINUE_ON_SHUTDOWN tasks from running from
217 // now on. 217 // now on.
218 task_tracker_.SetHasShutdownStartedForTesting(); 218 task_tracker_.SetHasShutdownStartedForTesting();
219 219
220 // Run pending BLOCK_SHUTDOWN tasks. 220 // Run pending BLOCK_SHUTDOWN tasks.
221 RunLoop().RunUntilIdle(); 221 RunLoop().RunUntilIdle();
222 } 222 }
223 223
224 void TestTaskScheduler::FlushForTesting() { 224 void TestTaskScheduler::FlushForTesting() {
225 NOTREACHED(); 225 RunLoop().RunUntilIdle();
226 } 226 }
227 227
228 void TestTaskScheduler::JoinForTesting() { 228 void TestTaskScheduler::JoinForTesting() {
229 // TestTaskScheduler doesn't create threads so this does nothing. 229 // TestTaskScheduler doesn't create threads so this does nothing.
230 } 230 }
231 231
232 bool TestTaskScheduler::PostTask(std::unique_ptr<internal::Task> task, 232 bool TestTaskScheduler::PostTask(std::unique_ptr<internal::Task> task,
233 const SequenceToken& sequence_token) { 233 const SequenceToken& sequence_token) {
234 DCHECK(task); 234 DCHECK(task);
235 if (!task_tracker_.WillPostTask(task.get())) 235 if (!task_tracker_.WillPostTask(task.get()))
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 DCHECK_EQ(task_scheduler_, TaskScheduler::GetInstance()); 322 DCHECK_EQ(task_scheduler_, TaskScheduler::GetInstance());
323 323
324 // Per contract, call JoinForTesting() before deleting the TaskScheduler. 324 // Per contract, call JoinForTesting() before deleting the TaskScheduler.
325 TaskScheduler::GetInstance()->JoinForTesting(); 325 TaskScheduler::GetInstance()->JoinForTesting();
326 326
327 TaskScheduler::SetInstance(nullptr); 327 TaskScheduler::SetInstance(nullptr);
328 } 328 }
329 329
330 } // namespace test 330 } // namespace test
331 } // namespace base 331 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | content/public/test/test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698