Chromium Code Reviews| Index: sql/connection.h |
| diff --git a/sql/connection.h b/sql/connection.h |
| index 959a1b1848110161aa353abaaeab2099a2b246e0..4e26b6a1fbd0d35f91ef339d15c3050059088108 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,11 +475,10 @@ 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/06/15 04:39:44
I still don't like this comment. I'd prefer somet
Scott Hess - ex-Googler
2016/06/21 00:18:26
Done.
|
| + static bool IsExpectedSqliteError(int error); |
| // Collect various diagnostic information and post a crash dump to aid |
| // debugging. Dump rate per database is limited to prevent overwhelming the |
| @@ -489,8 +489,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). |
| @@ -532,12 +532,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 |