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"
15 SkewedSingleThreadTaskRunner::SkewedSingleThreadTaskRunner(
16 const scoped_refptr
<base::SingleThreadTaskRunner
>& task_runner
) :
18 task_runner_(task_runner
) {
21 SkewedSingleThreadTaskRunner::~SkewedSingleThreadTaskRunner() {}
23 void SkewedSingleThreadTaskRunner::SetSkew(double 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(
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(
48 base::TimeDelta::FromMicroseconds(delay
.InMicroseconds() * skew_
));