diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2021-06-21 14:29:34 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2021-06-21 14:29:34 +0000 |
commit | 89fed0e42389e6b3291e9f2e8b1165858b6c4b4f (patch) | |
tree | 0f4d08540c8e5fa16bcd0c99cd413fe815560e4b /base/test/null_task_runner.h | |
parent | b4233fd961752b80d42ae68e8b42acfb3e99be57 (diff) | |
parent | 33a56a4450406ed97f7289fe0b6a0a20482f0a01 (diff) | |
download | libchrome-89fed0e42389e6b3291e9f2e8b1165858b6c4b4f.tar.gz |
Snap for 7478028 from 33a56a4450406ed97f7289fe0b6a0a20482f0a01 to mainline-documentsui-releaseandroid-mainline-12.0.0_r26android-mainline-12.0.0_r2aml_doc_310851020android12-mainline-documentsui-release
Change-Id: Ie15f13b179f0ad841e4dfd95fcfdce5f01a17f29
Diffstat (limited to 'base/test/null_task_runner.h')
-rw-r--r-- | base/test/null_task_runner.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/base/test/null_task_runner.h b/base/test/null_task_runner.h new file mode 100644 index 0000000000..c11ab6b0c6 --- /dev/null +++ b/base/test/null_task_runner.h @@ -0,0 +1,39 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef BASE_TEST_NULL_TASK_RUNNER_H_ +#define BASE_TEST_NULL_TASK_RUNNER_H_ + +#include "base/callback.h" +#include "base/compiler_specific.h" +#include "base/macros.h" +#include "base/single_thread_task_runner.h" + +namespace base { + +// Helper class for tests that need to provide an implementation of a +// *TaskRunner class but don't actually care about tasks being run. + +class NullTaskRunner : public base::SingleThreadTaskRunner { + public: + NullTaskRunner(); + + bool PostDelayedTask(const Location& from_here, + base::OnceClosure task, + base::TimeDelta delay) override; + bool PostNonNestableDelayedTask(const Location& from_here, + base::OnceClosure task, + base::TimeDelta delay) override; + // Always returns true to avoid triggering DCHECKs. + bool RunsTasksInCurrentSequence() const override; + + protected: + ~NullTaskRunner() override; + + DISALLOW_COPY_AND_ASSIGN(NullTaskRunner); +}; + +} // namespace base + +#endif // BASE_TEST_NULL_TASK_RUNNER_H_ |