Remove INJECT_EVENTS permissions from test APKs.
[chromium-blink-merge.git] / media / cast / test / fake_single_thread_task_runner.h
blobc6fb02e4be45e45ae37e1c0bc00b7a23fbaa9bc2
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_
8 #include <map>
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"
15 namespace media {
16 namespace cast {
17 namespace test {
19 typedef base::TestPendingTask PostedTask;
21 class FakeSingleThreadTaskRunner : public base::SingleThreadTaskRunner {
22 public:
23 explicit FakeSingleThreadTaskRunner(base::SimpleTestTickClock* clock);
25 void RunTasks();
27 // Note: Advances |clock_|.
28 void Sleep(base::TimeDelta t);
30 // base::SingleThreadTaskRunner implementation.
31 bool PostDelayedTask(const tracked_objects::Location& from_here,
32 const base::Closure& task,
33 base::TimeDelta delay) final;
35 bool RunsTasksOnCurrentThread() const final;
37 // This function is currently not used, and will return false.
38 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here,
39 const base::Closure& task,
40 base::TimeDelta delay) final;
42 protected:
43 ~FakeSingleThreadTaskRunner() final;
45 private:
46 base::SimpleTestTickClock* const clock_;
47 std::multimap<base::TimeTicks, PostedTask> tasks_;
48 bool fail_on_next_task_;
50 DISALLOW_COPY_AND_ASSIGN(FakeSingleThreadTaskRunner);
53 } // namespace test
54 } // namespace cast
55 } // namespace media
57 #endif // MEDIA_CAST_TEST_FAKE_TASK_RUNNER_H_