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

Unified Diff: sql/connection.h

Issue 16664005: [sql] Framework for allowing tests to handle errors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refactor along lines of comment #4. Created 7 years, 6 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
« no previous file with comments | « no previous file | sql/connection.cc » ('j') | sql/connection.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | sql/connection.cc » ('j') | sql/connection.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698