Index: sql/connection.h |
diff --git a/sql/connection.h b/sql/connection.h |
index 049d7cf5b4e2f9715ffc4b7f67dd2e89dc367bff..920143157afe004bf1605e75e2dbe04d207adef5 100644 |
--- a/sql/connection.h |
+++ b/sql/connection.h |
@@ -13,6 +13,7 @@ |
#include "base/basictypes.h" |
#include "base/callback.h" |
#include "base/compiler_specific.h" |
+#include "base/lazy_instance.h" |
#include "base/memory/ref_counted.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/threading/thread_restrictions.h" |
@@ -376,6 +377,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 +404,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 base::LazyInstance<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 |