Updating XTBs based on .GRDs from branch master
[chromium-blink-merge.git] / media / cast / test / skewed_single_thread_task_runner.cc
blobfda7dfbfcad16575447c6975538d76c5915e8281
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "media/cast/test/skewed_single_thread_task_runner.h"
7 #include "base/logging.h"
8 #include "base/time/tick_clock.h"
9 #include "testing/gtest/include/gtest/gtest.h"
11 namespace media {
12 namespace cast {
13 namespace test {
15 SkewedSingleThreadTaskRunner::SkewedSingleThreadTaskRunner(
16 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) :
17 skew_(1.0),
18 task_runner_(task_runner) {
21 SkewedSingleThreadTaskRunner::~SkewedSingleThreadTaskRunner() {}
23 void SkewedSingleThreadTaskRunner::SetSkew(double skew) {
24 skew_ = skew;
27 bool SkewedSingleThreadTaskRunner::PostDelayedTask(
28 const tracked_objects::Location& from_here,
29 const base::Closure& task,
30 base::TimeDelta delay) {
31 return task_runner_->PostDelayedTask(
32 from_here,
33 task,
34 base::TimeDelta::FromMicroseconds(delay.InMicroseconds() * skew_));
37 bool SkewedSingleThreadTaskRunner::RunsTasksOnCurrentThread() const {
38 return task_runner_->RunsTasksOnCurrentThread();
41 bool SkewedSingleThreadTaskRunner::PostNonNestableDelayedTask(
42 const tracked_objects::Location& from_here,
43 const base::Closure& task,
44 base::TimeDelta delay) {
45 return task_runner_->PostNonNestableDelayedTask(
46 from_here,
47 task,
48 base::TimeDelta::FromMicroseconds(delay.InMicroseconds() * skew_));
51 } // namespace test
52 } // namespace cast
53 } // namespace media