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

Unified Diff: base/test/test_mock_time_task_runner.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/test/test_mock_time_task_runner.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/test_mock_time_task_runner.cc
diff --git a/base/test/test_mock_time_task_runner.cc b/base/test/test_mock_time_task_runner.cc
index 8e65ccf632ce9ef99c642b4532901ccae4782daf..6bcab8b91f3a52ee535fe5be8195134a16bd1a91 100644
--- a/base/test/test_mock_time_task_runner.cc
+++ b/base/test/test_mock_time_task_runner.cc
@@ -100,6 +100,13 @@ void TestMockTimeTaskRunner::FastForwardUntilNoTasksRemain() {
ProcessAllTasksNoLaterThan(TimeDelta::Max());
}
+void TestMockTimeTaskRunner::ClearPendingTasks() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ AutoLock scoped_lock(tasks_lock_);
+ while (!tasks_.empty())
+ tasks_.pop();
+}
+
Time TestMockTimeTaskRunner::Now() const {
DCHECK(thread_checker_.CalledOnValidThread());
return now_;
« no previous file with comments | « base/test/test_mock_time_task_runner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698