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

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

Issue 994903002: Add ability to clear pending tasks of TestMockTimeTaskRunner without running the tasks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | base/test/test_mock_time_task_runner.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_TEST_MOCK_TIME_TASK_RUNNER_H_ 5 #ifndef BASE_TEST_TEST_MOCK_TIME_TASK_RUNNER_H_
6 #define BASE_TEST_TEST_MOCK_TIME_TASK_RUNNER_H_ 6 #define BASE_TEST_TEST_MOCK_TIME_TASK_RUNNER_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 void FastForwardBy(TimeDelta delta); 54 void FastForwardBy(TimeDelta delta);
55 55
56 // Fast-forwards virtual time just until all tasks are executed. 56 // Fast-forwards virtual time just until all tasks are executed.
57 void FastForwardUntilNoTasksRemain(); 57 void FastForwardUntilNoTasksRemain();
58 58
59 // Executes all tasks that have no remaining delay. Tasks with a remaining 59 // Executes all tasks that have no remaining delay. Tasks with a remaining
60 // delay greater than zero will remain enqueued, and no virtual time will 60 // delay greater than zero will remain enqueued, and no virtual time will
61 // elapse. 61 // elapse.
62 void RunUntilIdle(); 62 void RunUntilIdle();
63 63
64 // Clears the queue of pending tasks without running them.
65 void ClearPendingTasks();
66
64 // Returns the current virtual time (initially starting at the Unix epoch). 67 // Returns the current virtual time (initially starting at the Unix epoch).
65 Time Now() const; 68 Time Now() const;
66 69
67 // Returns the current virtual tick time (initially starting at 0). 70 // Returns the current virtual tick time (initially starting at 0).
68 TimeTicks NowTicks() const; 71 TimeTicks NowTicks() const;
69 72
70 // Returns a Clock that uses the virtual time of |this| as its time source. 73 // Returns a Clock that uses the virtual time of |this| as its time source.
71 // The returned Clock will hold a reference to |this|. 74 // The returned Clock will hold a reference to |this|.
72 scoped_ptr<Clock> GetMockClock() const; 75 scoped_ptr<Clock> GetMockClock() const;
73 76
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 // |tasks_lock_| is held. 144 // |tasks_lock_| is held.
142 TaskPriorityQueue tasks_; 145 TaskPriorityQueue tasks_;
143 Lock tasks_lock_; 146 Lock tasks_lock_;
144 147
145 DISALLOW_COPY_AND_ASSIGN(TestMockTimeTaskRunner); 148 DISALLOW_COPY_AND_ASSIGN(TestMockTimeTaskRunner);
146 }; 149 };
147 150
148 } // namespace base 151 } // namespace base
149 152
150 #endif // BASE_TEST_TEST_MOCK_TIME_TASK_RUNNER_H_ 153 #endif // BASE_TEST_TEST_MOCK_TIME_TASK_RUNNER_H_
OLDNEW
« no previous file with comments | « no previous file | base/test/test_mock_time_task_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698