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

Unified Diff: cc/test/ordered_simple_task_runner.h

Issue 387493002: Fixing and enhancing OrderedSimpleTaskRunner to allow 100% deterministic tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Lots of changes. Created 6 years, 5 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
Index: cc/test/ordered_simple_task_runner.h
diff --git a/cc/test/ordered_simple_task_runner.h b/cc/test/ordered_simple_task_runner.h
index 8850a760bf88de7fb7f7df663324271809d3e8c2..18d701cec7988b65dfba5c0fe76797d37a8b1615 100644
--- a/cc/test/ordered_simple_task_runner.h
+++ b/cc/test/ordered_simple_task_runner.h
@@ -7,6 +7,7 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/logging.h"
#include "base/test/test_simple_task_runner.h"
namespace cc {
@@ -16,14 +17,32 @@ namespace cc {
// which don't have a delay even though it is queued early.
class OrderedSimpleTaskRunner : public base::TestSimpleTaskRunner {
public:
- OrderedSimpleTaskRunner();
-
+ OrderedSimpleTaskRunner(bool advance_now = true);
+
+ virtual bool PostDelayedTask(const tracked_objects::Location& from_here,
+ const base::Closure& task,
+ base::TimeDelta delay) OVERRIDE;
+ virtual bool PostNonNestableDelayedTask(
+ const tracked_objects::Location& from_here,
+ const base::Closure& task,
+ base::TimeDelta delay) OVERRIDE;
virtual void RunPendingTasks() OVERRIDE;
+ base::TimeTicks Now();
+ base::TimeDelta DelayToNextPendingTask();
+ void SetAutoAdvanceNowToPendingTasks(bool advance_now);
+ void SetNow(base::TimeTicks time);
+
protected:
virtual ~OrderedSimpleTaskRunner();
+ static void SortTasks(std::deque<base::TestPendingTask>& tasks);
+
private:
+ bool advance_now_;
+ base::TimeTicks now_;
+ bool inside_run_pending_tasks_;
+
DISALLOW_COPY_AND_ASSIGN(OrderedSimpleTaskRunner);
};

Powered by Google App Engine
This is Rietveld 408576698