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

Unified Diff: base/test/test_mock_time_task_runner.h

Issue 1051873003: Make TestMockTimeTaskRunner run tasks with the same delay in the order they were posted. (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 | « no previous file | base/test/test_mock_time_task_runner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/test_mock_time_task_runner.h
diff --git a/base/test/test_mock_time_task_runner.h b/base/test/test_mock_time_task_runner.h
index 705af103bbdf4e3eba64799646837f45c1f93214..6319e0cb18456af40f35405149dbca1326d9f701 100644
--- a/base/test/test_mock_time_task_runner.h
+++ b/base/test/test_mock_time_task_runner.h
@@ -112,15 +112,17 @@ class TestMockTimeTaskRunner : public SingleThreadTaskRunner {
virtual void OnAfterTaskRun();
private:
+ struct TestOrderedPendingTask;
+
// Predicate that defines a strict weak temporal ordering of tasks.
class TemporalOrder {
public:
- bool operator()(const TestPendingTask& first_task,
- const TestPendingTask& second_task) const;
+ bool operator()(const TestOrderedPendingTask& first_task,
+ const TestOrderedPendingTask& second_task) const;
};
- typedef std::priority_queue<TestPendingTask,
- std::vector<TestPendingTask>,
+ typedef std::priority_queue<TestOrderedPendingTask,
+ std::vector<TestOrderedPendingTask>,
TemporalOrder> TaskPriorityQueue;
// Core of the implementation for all flavors of fast-forward methods. Given a
@@ -148,6 +150,11 @@ class TestMockTimeTaskRunner : public SingleThreadTaskRunner {
// Temporally ordered heap of pending tasks. Must only be accessed while the
// |tasks_lock_| is held.
TaskPriorityQueue tasks_;
+
+ // The ordinal to use for the next task. Must only be accessed while the
+ // |tasks_lock_| is held.
+ size_t next_task_ordinal_;
+
Lock tasks_lock_;
DISALLOW_COPY_AND_ASSIGN(TestMockTimeTaskRunner);
« 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