blob: c11ab6b0c6c094d60c0e16c74b8c2bd2f3d744dc [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
danakj0393da32015-03-10 09:31:16 +09005#ifndef BASE_TEST_NULL_TASK_RUNNER_H_
6#define BASE_TEST_NULL_TASK_RUNNER_H_
7
tzik622d59e2017-03-29 14:28:12 +09008#include "base/callback.h"
akalin@chromium.org4fb2deb2012-12-28 04:58:00 +09009#include "base/compiler_specific.h"
avif09d5392015-12-24 12:28:02 +090010#include "base/macros.h"
akalin@chromium.org4fb2deb2012-12-28 04:58:00 +090011#include "base/single_thread_task_runner.h"
12
13namespace base {
14
15// Helper class for tests that need to provide an implementation of a
16// *TaskRunner class but don't actually care about tasks being run.
17
18class NullTaskRunner : public base::SingleThreadTaskRunner {
19 public:
20 NullTaskRunner();
21
Brett Wilson89388db2017-09-12 14:22:16 +090022 bool PostDelayedTask(const Location& from_here,
tzik8f0ce102017-04-05 19:13:21 +090023 base::OnceClosure task,
dcheng7dc8df52014-10-21 19:54:51 +090024 base::TimeDelta delay) override;
Brett Wilson89388db2017-09-12 14:22:16 +090025 bool PostNonNestableDelayedTask(const Location& from_here,
tzik8f0ce102017-04-05 19:13:21 +090026 base::OnceClosure task,
dcheng7dc8df52014-10-21 19:54:51 +090027 base::TimeDelta delay) override;
akalin@chromium.org4fb2deb2012-12-28 04:58:00 +090028 // Always returns true to avoid triggering DCHECKs.
peary2a22cfdb2017-05-09 12:55:48 +090029 bool RunsTasksInCurrentSequence() const override;
akalin@chromium.org4fb2deb2012-12-28 04:58:00 +090030
31 protected:
dcheng7dc8df52014-10-21 19:54:51 +090032 ~NullTaskRunner() override;
akalin@chromium.org4fb2deb2012-12-28 04:58:00 +090033
34 DISALLOW_COPY_AND_ASSIGN(NullTaskRunner);
35};
36
danakj651c3e22015-03-07 10:51:42 +090037} // namespace base
danakj0393da32015-03-10 09:31:16 +090038
39#endif // BASE_TEST_NULL_TASK_RUNNER_H_