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

Side by Side Diff: media/cast/test/skewed_single_thread_task_runner.cc

Issue 289083002: Cast: Add tests for clocks being slow/fast (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 6 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
« no previous file with comments | « media/cast/test/skewed_single_thread_task_runner.h ('k') | media/cast/test/skewed_tick_clock.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #include "media/cast/test/skewed_single_thread_task_runner.h"
6
7 #include "base/logging.h"
8 #include "base/time/tick_clock.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 namespace media {
12 namespace cast {
13 namespace test {
14
15 SkewedSingleThreadTaskRunner::SkewedSingleThreadTaskRunner(
16 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) :
17 skew_(1.0),
18 task_runner_(task_runner) {
19 }
20
21 SkewedSingleThreadTaskRunner::~SkewedSingleThreadTaskRunner() {}
22
23 void SkewedSingleThreadTaskRunner::SetSkew(double skew) {
24 skew_ = skew;
25 }
26
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_));
35 }
36
37 bool SkewedSingleThreadTaskRunner::RunsTasksOnCurrentThread() const {
38 return task_runner_->RunsTasksOnCurrentThread();
39 }
40
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_));
49 }
50
51 } // namespace test
52 } // namespace cast
53 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/test/skewed_single_thread_task_runner.h ('k') | media/cast/test/skewed_tick_clock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698