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

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

Issue 308713005: Cast: Synthetic benchmark tool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge + minor fix Created 6 years, 6 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/cast_benchmarks.cc ('k') | media/cast/test/utility/test_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 "media/cast/test/fake_single_thread_task_runner.h" 5 #include "media/cast/test/fake_single_thread_task_runner.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/time/tick_clock.h" 8 #include "base/time/tick_clock.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace media { 11 namespace media {
12 namespace cast { 12 namespace cast {
13 namespace test { 13 namespace test {
14 14
15 FakeSingleThreadTaskRunner::FakeSingleThreadTaskRunner( 15 FakeSingleThreadTaskRunner::FakeSingleThreadTaskRunner(
16 base::SimpleTestTickClock* clock) 16 base::SimpleTestTickClock* clock)
17 : clock_(clock), 17 : clock_(clock),
18 fail_on_next_task_(false) {} 18 fail_on_next_task_(false) {}
19 19
20 FakeSingleThreadTaskRunner::~FakeSingleThreadTaskRunner() {} 20 FakeSingleThreadTaskRunner::~FakeSingleThreadTaskRunner() {}
21 21
22 bool FakeSingleThreadTaskRunner::PostDelayedTask( 22 bool FakeSingleThreadTaskRunner::PostDelayedTask(
23 const tracked_objects::Location& from_here, 23 const tracked_objects::Location& from_here,
24 const base::Closure& task, 24 const base::Closure& task,
25 base::TimeDelta delay) { 25 base::TimeDelta delay) {
26 if (fail_on_next_task_) { 26 if (fail_on_next_task_) {
27 LOG(FATAL) << "Infinite task-add loop detected."; 27 LOG(FATAL) << "Infinite task-add loop detected.";
28 } 28 }
29 CHECK(delay >= base::TimeDelta());
29 EXPECT_GE(delay, base::TimeDelta()); 30 EXPECT_GE(delay, base::TimeDelta());
30 PostedTask posed_task(from_here, 31 PostedTask posed_task(from_here,
31 task, 32 task,
32 clock_->NowTicks(), 33 clock_->NowTicks(),
33 delay, 34 delay,
34 base::TestPendingTask::NESTABLE); 35 base::TestPendingTask::NESTABLE);
35 36
36 tasks_.insert(std::make_pair(posed_task.GetTimeToRun(), posed_task)); 37 tasks_.insert(std::make_pair(posed_task.GetTimeToRun(), posed_task));
37 return false; 38 return false;
38 } 39 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 const tracked_objects::Location& from_here, 94 const tracked_objects::Location& from_here,
94 const base::Closure& task, 95 const base::Closure& task,
95 base::TimeDelta delay) { 96 base::TimeDelta delay) {
96 NOTIMPLEMENTED(); 97 NOTIMPLEMENTED();
97 return false; 98 return false;
98 } 99 }
99 100
100 } // namespace test 101 } // namespace test
101 } // namespace cast 102 } // namespace cast
102 } // namespace media 103 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/test/cast_benchmarks.cc ('k') | media/cast/test/utility/test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698