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 #ifndef MEDIA_CAST_TEST_FAKE_TASK_RUNNER_H_
6 #define MEDIA_CAST_TEST_FAKE_TASK_RUNNER_H_
10 #include "base/basictypes.h"
11 #include "base/single_thread_task_runner.h"
12 #include "base/test/simple_test_tick_clock.h"
13 #include "base/test/test_pending_task.h"
19 typedef base::TestPendingTask PostedTask
;
21 class FakeSingleThreadTaskRunner
: public base::SingleThreadTaskRunner
{
23 explicit FakeSingleThreadTaskRunner(base::SimpleTestTickClock
* clock
);
27 // base::SingleThreadTaskRunner implementation.
28 virtual bool PostDelayedTask(const tracked_objects::Location
& from_here
,
29 const base::Closure
& task
,
30 base::TimeDelta delay
) OVERRIDE
;
32 virtual bool RunsTasksOnCurrentThread() const OVERRIDE
;
34 // This function is currently not used, and will return false.
35 virtual bool PostNonNestableDelayedTask(
36 const tracked_objects::Location
& from_here
,
37 const base::Closure
& task
,
38 base::TimeDelta delay
) OVERRIDE
;
41 virtual ~FakeSingleThreadTaskRunner();
44 base::SimpleTestTickClock
* const clock_
;
45 std::multimap
<base::TimeTicks
, PostedTask
> tasks_
;
47 DISALLOW_COPY_AND_ASSIGN(FakeSingleThreadTaskRunner
);
54 #endif // MEDIA_CAST_TEST_FAKE_TASK_RUNNER_H_