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

Unified Diff: third_party/WebKit/Source/platform/scheduler/test/fake_web_task_runner.cc

Issue 2266443002: Optimize posting of WTF::Closure and improve scheduler test mocks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cut back to just the WTF::Closure fix plus the scheduler test mock refactor. Created 4 years, 4 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: third_party/WebKit/Source/platform/scheduler/test/fake_web_task_runner.cc
diff --git a/third_party/WebKit/Source/platform/scheduler/test/fake_web_task_runner.cc b/third_party/WebKit/Source/platform/scheduler/test/fake_web_task_runner.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0798352018e2df58d5075e78aea71a1f1f37c306
--- /dev/null
+++ b/third_party/WebKit/Source/platform/scheduler/test/fake_web_task_runner.cc
@@ -0,0 +1,47 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "platform/scheduler/test/fake_web_task_runner.h"
+
+namespace blink {
+namespace scheduler {
+
+FakeWebTaskRunner::FakeWebTaskRunner() : time_(0.0) {}
+
+FakeWebTaskRunner::~FakeWebTaskRunner() {}
+
+void FakeWebTaskRunner::setTime(double new_time) {
+ time_ = new_time;
+}
+
+void FakeWebTaskRunner::postTask(const WebTraceLocation&, Task*) {}
+
+void FakeWebTaskRunner::postDelayedTask(const WebTraceLocation&,
+ Task* task,
+ double) {
+ task_.reset(task);
+}
+
+bool FakeWebTaskRunner::runsTasksOnCurrentThread() {
+ return true;
+}
+
+std::unique_ptr<WebTaskRunner> FakeWebTaskRunner::clone() {
+ return nullptr;
+}
+
+double FakeWebTaskRunner::virtualTimeSeconds() const {
+ return time_;
+}
+
+double FakeWebTaskRunner::monotonicallyIncreasingVirtualTimeSeconds() const {
+ return time_;
+}
+
+SingleThreadTaskRunner* FakeWebTaskRunner::toSingleThreadTaskRunner() {
+ return nullptr;
+}
+
+} // namespace scheduler
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698