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

Unified Diff: sql/connection.h

Issue 1991503002: [sql] sql::ScopedErrorIgnorer rename to sql::test::ScopedErrorExpecter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restore file rename Created 4 years, 7 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: sql/connection.h
diff --git a/sql/connection.h b/sql/connection.h
index 8e8931f2e67d0dbc576987830015fa108b3797e4..5c955af8e27c6b11e077da500fbfd6d0bea7b7cb 100644
--- a/sql/connection.h
+++ b/sql/connection.h
@@ -39,6 +39,7 @@ class Statement;
// To allow some test classes to be friended.
namespace test {
class ScopedCommitHook;
+class ScopedErrorExpecter;
class ScopedScalarFunction;
class ScopedMockTimeSource;
}
@@ -474,15 +475,15 @@ class SQL_EXPORT Connection {
// SELECT type, name, tbl_name, sql FROM sqlite_master ORDER BY 1, 2, 3, 4;
std::string GetSchema() const;
- // Clients which provide an error_callback don't see the
- // error-handling at the end of OnSqliteError(). Expose to allow
- // those clients to work appropriately with ScopedErrorIgnorer in
- // tests.
- static bool ShouldIgnoreSqliteError(int error);
+ // Clients which provide an error_callback don't see the error-handling at the
+ // end of OnSqliteError(). Expose to allow those clients to work for tests
+ // using ScopedErrorExpecter. |true| if the error is expected.
Mark P 2016/05/23 19:53:27 I'm having trouble understanding this comment. I
Scott Hess - ex-Googler 2016/06/03 00:02:11 This is the same concern you had elsewhere about d
+ static bool IsExpectedSqliteError(int error);
- // Additionally ignores errors which are unlikely to be caused by problems
- // with the syntax of a SQL statement, or problems with the database schema.
- static bool ShouldIgnoreSqliteCompileError(int error);
+ // Return |true| in cases where Extend IsExpectedSqliteError() returns |true|,
Mark P 2016/05/23 19:53:27 Extend? Is this an errant word? If so, delete it.
Scott Hess - ex-Googler 2016/06/03 00:02:11 Done. Errant word.
+ // and also in cases which are likely to be caused by the state of the
+ // database, rather than the statement being compiled.
Mark P 2016/05/23 19:53:27 This comment is confusing. It's imply that this r
Scott Hess - ex-Googler 2016/06/03 00:02:11 I dug back into the history of this a bit. It loo
+ static bool IsExpectedSqliteCompileError(int error);
// Collect various diagnostic information and post a crash dump to aid
// debugging. Dump rate per database is limited to prevent overwhelming the
@@ -493,8 +494,8 @@ class SQL_EXPORT Connection {
// For recovery module.
friend class Recovery;
- // Allow test-support code to set/reset error ignorer.
- friend class ScopedErrorIgnorer;
+ // Allow test-support code to set/reset error expecter.
+ friend class test::ScopedErrorExpecter;
// Statement accesses StatementRef which we don't want to expose to everybody
// (they should go through Statement).
@@ -536,12 +537,12 @@ 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 void SetErrorIgnorer(ErrorIgnorerCallback* ignorer);
- static void ResetErrorIgnorer();
+ // Accessors for global error-expecter, for injecting behavior during tests.
+ // See test/scoped_error_expecter.h.
+ typedef base::Callback<bool(int)> ErrorExpecterCallback;
+ static ErrorExpecterCallback* current_expecter_cb_;
+ static void SetErrorExpecter(ErrorExpecterCallback* expecter);
+ static void ResetErrorExpecter();
// A StatementRef is a refcounted wrapper around a sqlite statement pointer.
// Refcounting allows us to give these statements out to sql::Statement
« no previous file with comments | « sql/BUILD.gn ('k') | sql/connection.cc » ('j') | sql/test/scoped_error_expecter.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698