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

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: final gyp cleanup. 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') | no next file with comments »
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 8db794dd2fd22f7f75e88bd2086a1dbcf0573863..91139cedc638ee9eb5e31db38dffe08392100f13 100644
--- a/sql/connection.h
+++ b/sql/connection.h
@@ -335,6 +335,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;
@@ -359,6 +362,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(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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698