Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / base / test / null_task_runner.h
blobd6390e5202014740a93f3a1edcad45d21246c846
1 // 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.
5 #include "base/basictypes.h"
6 #include "base/compiler_specific.h"
7 #include "base/single_thread_task_runner.h"
9 namespace base {
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.
14 class NullTaskRunner : public base::SingleThreadTaskRunner {
15 public:
16 NullTaskRunner();
18 virtual bool PostDelayedTask(const tracked_objects::Location& from_here,
19 const base::Closure& task,
20 base::TimeDelta delay) OVERRIDE;
21 virtual bool PostNonNestableDelayedTask(
22 const tracked_objects::Location& from_here,
23 const base::Closure& task,
24 base::TimeDelta delay) OVERRIDE;
25 // Always returns true to avoid triggering DCHECKs.
26 virtual bool RunsTasksOnCurrentThread() const OVERRIDE;
28 protected:
29 virtual ~NullTaskRunner();
31 DISALLOW_COPY_AND_ASSIGN(NullTaskRunner);
34 } // namespace