blob: 2cde880f58a611e6ca7bcbf35702c855d407cfab [file] [log] [blame]
akalin@chromium.org4fb2deb2012-12-28 04:58:00 +09001// Copyright (c) 2012 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 "base/basictypes.h"
6#include "base/compiler_specific.h"
7#include "base/single_thread_task_runner.h"
8
9namespace base {
10
11// Helper class for tests that need to provide an implementation of a
12// *TaskRunner class but don't actually care about tasks being run.
13
14class NullTaskRunner : public base::SingleThreadTaskRunner {
15 public:
16 NullTaskRunner();
17
dcheng7dc8df52014-10-21 19:54:51 +090018 bool PostDelayedTask(const tracked_objects::Location& from_here,
19 const base::Closure& task,
20 base::TimeDelta delay) override;
21 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here,
22 const base::Closure& task,
23 base::TimeDelta delay) override;
akalin@chromium.org4fb2deb2012-12-28 04:58:00 +090024 // Always returns true to avoid triggering DCHECKs.
dcheng7dc8df52014-10-21 19:54:51 +090025 bool RunsTasksOnCurrentThread() const override;
akalin@chromium.org4fb2deb2012-12-28 04:58:00 +090026
27 protected:
dcheng7dc8df52014-10-21 19:54:51 +090028 ~NullTaskRunner() override;
akalin@chromium.org4fb2deb2012-12-28 04:58:00 +090029
30 DISALLOW_COPY_AND_ASSIGN(NullTaskRunner);
31};
32
33} // namespace