1 // Copyright 2015 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 CONTENT_RENDERER_SCHEDULER_TASK_RUNNER_DELEGATE_FOR_TEST_H_
6 #define CONTENT_RENDERER_SCHEDULER_TASK_RUNNER_DELEGATE_FOR_TEST_H_
8 #include "components/scheduler/child/scheduler_task_runner_delegate.h"
12 class NestableTaskRunnerForTest
;
14 class SchedulerTaskRunnerDelegateForTest
: public SchedulerTaskRunnerDelegate
{
16 static scoped_refptr
<SchedulerTaskRunnerDelegateForTest
> Create(
17 scoped_refptr
<base::SingleThreadTaskRunner
> task_runner
);
19 // SchedulerTaskRunnerDelegate implementation
20 void SetDefaultTaskRunner(
21 scoped_refptr
<base::SingleThreadTaskRunner
> task_runner
) override
;
22 void RestoreDefaultTaskRunner() override
;
23 bool PostDelayedTask(const tracked_objects::Location
& from_here
,
24 const base::Closure
& task
,
25 base::TimeDelta delay
) override
;
26 bool PostNonNestableDelayedTask(const tracked_objects::Location
& from_here
,
27 const base::Closure
& task
,
28 base::TimeDelta delay
) override
;
29 bool RunsTasksOnCurrentThread() const override
;
30 bool IsNested() const override
;
32 base::SingleThreadTaskRunner
* default_task_runner() const {
33 return default_task_runner_
.get();
37 ~SchedulerTaskRunnerDelegateForTest() override
;
40 explicit SchedulerTaskRunnerDelegateForTest(
41 scoped_refptr
<base::SingleThreadTaskRunner
> task_runner
);
43 scoped_refptr
<base::SingleThreadTaskRunner
> default_task_runner_
;
45 scoped_refptr
<NestableTaskRunnerForTest
> task_runner_
;
47 DISALLOW_COPY_AND_ASSIGN(SchedulerTaskRunnerDelegateForTest
);
50 } // namespace scheduler
52 #endif // CONTENT_RENDERER_SCHEDULER_SCHEDULER_TASK_RUNNER_DELEGATE_FOR_TEST_H_