Index: sql/connection.h |
diff --git a/sql/connection.h b/sql/connection.h |
index 049d7cf5b4e2f9715ffc4b7f67dd2e89dc367bff..f65d492588e6271b425a74a79cdc60c2eb2caa2f 100644 |
--- a/sql/connection.h |
+++ b/sql/connection.h |
@@ -376,6 +376,9 @@ class SQL_EXPORT Connection { |
const char* GetErrorMessage() const; |
private: |
+ // Allow test-support code to set/reset error ignorer. |
+ friend class ScopedErrorIgnorer; |
+ |
// Statement accesses StatementRef which we don't want to expose to everybody |
// (they should go through Statement). |
friend class Statement; |
@@ -400,6 +403,14 @@ class SQL_EXPORT Connection { |
// Internal helper for DoesTableExist and DoesIndexExist. |
bool DoesTableOrIndexExist(const char* name, const char* type) const; |
+ // Accessors for global error-ignorer, for injecting behavior during tests. |
+ // See test/scoped_error_ignorer.h. |
+ typedef base::Callback<bool(int)> ErrorIgnorerCallback; |
+ static ErrorIgnorerCallback current_ignorer_cb_; |
+ static bool ShouldIgnore(int error); |
+ static void SetErrorIgnorer(const ErrorIgnorerCallback& ignorer); |
+ static void ResetErrorIgnorer(); |
+ |
// A StatementRef is a refcounted wrapper around a sqlite statement pointer. |
// Refcounting allows us to give these statements out to sql::Statement |
// objects while also optionally maintaining a cache of compiled statements |