Chromium Code Reviews| Index: extensions/browser/preload_check_test_util.h |
| diff --git a/extensions/browser/preload_check_test_util.h b/extensions/browser/preload_check_test_util.h |
| index 7da768af493ab4e0dccc8d0457ed6db558f801a8..d96a514ba77600553195746fa776e579d153c5bd 100644 |
| --- a/extensions/browser/preload_check_test_util.h |
| +++ b/extensions/browser/preload_check_test_util.h |
| @@ -7,6 +7,9 @@ |
| #include <memory> |
| +#include "base/macros.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "base/strings/string16.h" |
| #include "extensions/browser/preload_check.h" |
| namespace base { |
| @@ -51,6 +54,31 @@ class PreloadCheckRunner { |
| DISALLOW_COPY_AND_ASSIGN(PreloadCheckRunner); |
| }; |
| +// Stub for a PreloadCheck that returns the desired error(s). |
| +class PreloadCheckStub : public PreloadCheck { |
| + public: |
| + explicit PreloadCheckStub(bool is_async = false); |
|
Devlin
2017/03/22 15:08:46
Maybe an enum, SYNCHRONOUS and ASYNCHRONOUS? Make
michaelpg
2017/03/24 02:34:17
I'll add set_is_async to mirror ExtensionInstallCh
|
| + ~PreloadCheckStub() override; |
| + |
| + void AddError(Error error); |
| + void set_error_message(const base::string16& message) { message_ = message; } |
| + |
| + // PreloadCheck: |
| + void Start(ResultCallback callback) override; |
| + base::string16 GetErrorMessage() const override; |
| + |
| + private: |
| + void StartInternal(ResultCallback callback); |
| + |
| + bool is_async_; |
| + Errors errors_; |
| + base::string16 message_; |
| + |
| + base::WeakPtrFactory<PreloadCheckStub> weak_ptr_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(PreloadCheckStub); |
| +}; |
| + |
| } // namespace extensions |
| #endif // EXTENSIONS_BROWSER_PRELOAD_CHECK_TEST_UTIL_H_ |