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..e456ee1582ac5e0b563ed00b54ea63a6973269da 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,35 @@ class PreloadCheckRunner { |
DISALLOW_COPY_AND_ASSIGN(PreloadCheckRunner); |
}; |
+// Stub for a PreloadCheck that returns the desired error(s). |
+class PreloadCheckStub : public PreloadCheck { |
+ public: |
+ PreloadCheckStub(); |
+ ~PreloadCheckStub() override; |
+ |
+ void AddError(Error error); |
+ void set_error_message(const base::string16& message) { message_ = message; } |
+ |
+ bool is_async() const { return is_async_; } |
+ void set_is_async(bool is_async) { is_async_ = is_async; } |
+ |
+ // PreloadCheck: |
+ void Start(ResultCallback callback) override; |
+ base::string16 GetErrorMessage() const override; |
+ |
+ private: |
+ void RunCallback(ResultCallback callback); |
+ |
+ // Defaults to false. |
Devlin
2017/03/24 16:21:48
optional: if you use c++11 fanciness and inline th
michaelpg
2017/03/24 21:48:28
Cool! Done in a couple other places.
|
+ 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_ |