Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Unified Diff: extensions/browser/preload_check_test_util.h

Issue 2768723002: Update ExtensionInstallChecker to use PreloadCheck classes (Closed)
Patch Set: remove redundant DCHECKs that fail in tests Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..3ef1fd99de47f1f895b8304a5689e819924c6475 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,34 @@ 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);
+
+ bool is_async_ = false;
+ 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_
« no previous file with comments | « chrome/browser/extensions/extension_install_checker_unittest.cc ('k') | extensions/browser/preload_check_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698