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

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

Issue 2876513002: Use WTF::TimeDelta to specify delays on WebTaskRunner (Closed)
Patch Set: mac fix Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/scheduler/test/fake_web_task_runner.h" 5 #include "platform/scheduler/test/fake_web_task_runner.h"
6 6
7 #include <deque> 7 #include <deque>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 scoped_refptr<BaseTaskRunner> base_task_runner) 75 scoped_refptr<BaseTaskRunner> base_task_runner)
76 : data_(std::move(data)), base_task_runner_(std::move(base_task_runner)) {} 76 : data_(std::move(data)), base_task_runner_(std::move(base_task_runner)) {}
77 77
78 FakeWebTaskRunner::~FakeWebTaskRunner() { 78 FakeWebTaskRunner::~FakeWebTaskRunner() {
79 } 79 }
80 80
81 void FakeWebTaskRunner::SetTime(double new_time) { 81 void FakeWebTaskRunner::SetTime(double new_time) {
82 data_->time_ = new_time; 82 data_->time_ = new_time;
83 } 83 }
84 84
85 void FakeWebTaskRunner::PostDelayedTask(const WebTraceLocation&,
86 base::OnceClosure closure,
87 double delay_ms) {
88 data_->PostTask(std::move(closure),
89 base::TimeDelta::FromMillisecondsD(delay_ms));
90 }
91
92 bool FakeWebTaskRunner::RunsTasksInCurrentSequence() { 85 bool FakeWebTaskRunner::RunsTasksInCurrentSequence() {
93 return true; 86 return true;
94 } 87 }
95 88
96 double FakeWebTaskRunner::VirtualTimeSeconds() const { 89 double FakeWebTaskRunner::VirtualTimeSeconds() const {
97 return data_->time_; 90 return data_->time_;
98 } 91 }
99 92
100 double FakeWebTaskRunner::MonotonicallyIncreasingVirtualTimeSeconds() const { 93 double FakeWebTaskRunner::MonotonicallyIncreasingVirtualTimeSeconds() const {
101 return data_->time_; 94 return data_->time_;
(...skipping 23 matching lines...) Expand all
125 } 118 }
126 } 119 }
127 120
128 std::deque<std::pair<base::OnceClosure, double>> 121 std::deque<std::pair<base::OnceClosure, double>>
129 FakeWebTaskRunner::TakePendingTasksForTesting() { 122 FakeWebTaskRunner::TakePendingTasksForTesting() {
130 return std::move(data_->task_queue_); 123 return std::move(data_->task_queue_);
131 } 124 }
132 125
133 } // namespace scheduler 126 } // namespace scheduler
134 } // namespace blink 127 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698