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

Side by Side Diff: base/test/scoped_async_task_scheduler.h

Issue 2796403002: Add base::test::ScopedTaskEnvironment. (Closed)
Patch Set: self-review 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 #ifndef BASE_TEST_SCOPED_ASYNC_TASK_SCHEDULER_H_ 5 #ifndef BASE_TEST_SCOPED_ASYNC_TASK_SCHEDULER_H_
6 #define BASE_TEST_SCOPED_ASYNC_TASK_SCHEDULER_H_ 6 #define BASE_TEST_SCOPED_ASYNC_TASK_SCHEDULER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 9
10 namespace base { 10 namespace base {
11 11
12 class TaskScheduler; 12 class TaskScheduler;
13 13
14 namespace test { 14 namespace test {
15 15
16 // Allows usage of the base/task_scheduler/post_task.h API within its scope. 16 // Allows usage of the base/task_scheduler/post_task.h API within its scope.
17 // 17 //
18 // To wait until all tasks posted without a delay have run, use 18 // To wait until all tasks posted without a delay have run, use
19 // TaskScheduler::GetInstance()->FlushForTesting(). 19 // TaskScheduler::GetInstance()->FlushForTesting().
20 //
21 // Deprecated. Use ScopedTaskEnvironment instead. https://crbug.com/708584
gab 2017/04/05 20:44:24 TODO(fdoray): Replace ScopedAsyncTaskScheduler ins
fdoray 2017/04/06 14:00:22 Done.
20 class ScopedAsyncTaskScheduler { 22 class ScopedAsyncTaskScheduler {
21 public: 23 public:
22 // Registers a single-threaded TaskScheduler. 24 // Registers a single-threaded TaskScheduler.
23 ScopedAsyncTaskScheduler(); 25 ScopedAsyncTaskScheduler();
24 26
25 // Shuts down and unregisters the TaskScheduler. 27 // Shuts down and unregisters the TaskScheduler.
26 // 28 //
27 // It is guaranteed that all BLOCK_SHUTDOWN tasks have run when this returns. 29 // It is guaranteed that all BLOCK_SHUTDOWN tasks have run when this returns.
28 ~ScopedAsyncTaskScheduler(); 30 ~ScopedAsyncTaskScheduler();
29 31
30 private: 32 private:
31 const TaskScheduler* task_scheduler_ = nullptr; 33 const TaskScheduler* task_scheduler_ = nullptr;
32 34
33 DISALLOW_COPY_AND_ASSIGN(ScopedAsyncTaskScheduler); 35 DISALLOW_COPY_AND_ASSIGN(ScopedAsyncTaskScheduler);
34 }; 36 };
35 37
36 } // namespace test 38 } // namespace test
37 } // namespace base 39 } // namespace base
38 40
39 #endif // BASE_TEST_SCOPED_ASYNC_TASK_SCHEDULER_H_ 41 #endif // BASE_TEST_SCOPED_ASYNC_TASK_SCHEDULER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698