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

Unified Diff: cc/test/scheduler_test_common.cc

Issue 387493002: Fixing and enhancing OrderedSimpleTaskRunner to allow 100% deterministic tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes for Brian's comments. Created 6 years, 3 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 | « cc/test/scheduler_test_common.h ('k') | cc/test/test_now_source.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/scheduler_test_common.cc
diff --git a/cc/test/scheduler_test_common.cc b/cc/test/scheduler_test_common.cc
index 3b35a54a9b713423dd91c55b428dc6997937f01c..7001b59ddeadd00e0c4563aa4acdb5f4fceed335 100644
--- a/cc/test/scheduler_test_common.cc
+++ b/cc/test/scheduler_test_common.cc
@@ -4,6 +4,8 @@
#include "cc/test/scheduler_test_common.h"
+#include <string>
+
#include "base/logging.h"
namespace cc {
@@ -14,4 +16,50 @@ void FakeTimeSourceClient::OnTimerTick() {
base::TimeTicks FakeDelayBasedTimeSource::Now() const { return now_; }
+TestDelayBasedTimeSource::TestDelayBasedTimeSource(
+ scoped_refptr<TestNowSource> now_src,
+ base::TimeDelta interval,
+ OrderedSimpleTaskRunner* task_runner)
+ : DelayBasedTimeSource(interval, task_runner), now_src_(now_src) {
+}
+
+base::TimeTicks TestDelayBasedTimeSource::Now() const {
+ return now_src_->Now();
+}
+
+std::string TestDelayBasedTimeSource::TypeString() const {
+ return "TestDelayBasedTimeSource";
+}
+
+TestDelayBasedTimeSource::~TestDelayBasedTimeSource() {
+}
+
+TestScheduler::TestScheduler(
+ scoped_refptr<TestNowSource> now_src,
+ SchedulerClient* client,
+ const SchedulerSettings& scheduler_settings,
+ int layer_tree_host_id,
+ const scoped_refptr<OrderedSimpleTaskRunner>& test_task_runner)
+ : Scheduler(client,
+ scheduler_settings,
+ layer_tree_host_id,
+ test_task_runner),
+ now_src_(now_src),
+ test_task_runner_(test_task_runner.get()) {
+ if (!settings_.begin_frame_scheduling_enabled) {
+ scoped_refptr<DelayBasedTimeSource> time_source =
+ TestDelayBasedTimeSource::Create(
+ now_src, VSyncInterval(), test_task_runner_);
+ synthetic_begin_frame_source_.reset(
+ new SyntheticBeginFrameSource(this, time_source));
+ }
+}
+
+base::TimeTicks TestScheduler::Now() const {
+ return now_src_->Now();
+}
+
+TestScheduler::~TestScheduler() {
+}
+
} // namespace cc
« no previous file with comments | « cc/test/scheduler_test_common.h ('k') | cc/test/test_now_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698