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

Unified Diff: sql/connection.cc

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.cc
diff --git a/sql/connection.cc b/sql/connection.cc
index f4da99ef76b4c3048eec6b4c2798803f775bbb59..4e4873134829ff42d4a7d928ff1eaec88398c03c 100644
--- a/sql/connection.cc
+++ b/sql/connection.cc
@@ -228,19 +228,19 @@ std::string AsUTF8ForSQL(const base::FilePath& path) {
namespace sql {
// static
-Connection::ErrorIgnorerCallback* Connection::current_ignorer_cb_ = NULL;
+Connection::ErrorExpecterCallback* Connection::current_expecter_cb_ = NULL;
// static
-bool Connection::ShouldIgnoreSqliteError(int error) {
- if (!current_ignorer_cb_)
+bool Connection::IsExpectedSqliteError(int error) {
+ if (!current_expecter_cb_)
return false;
- return current_ignorer_cb_->Run(error);
+ return current_expecter_cb_->Run(error);
}
// static
-bool Connection::ShouldIgnoreSqliteCompileError(int error) {
+bool Connection::IsExpectedSqliteCompileError(int error) {
// Put this first in case tests need to see that the check happened.
- if (ShouldIgnoreSqliteError(error))
+ if (IsExpectedSqliteError(error))
return true;
// Trim extended error codes.
@@ -283,15 +283,15 @@ void Connection::ReportDiagnosticInfo(int extended_error, Statement* stmt) {
}
// static
-void Connection::SetErrorIgnorer(Connection::ErrorIgnorerCallback* cb) {
- CHECK(current_ignorer_cb_ == NULL);
- current_ignorer_cb_ = cb;
+void Connection::SetErrorExpecter(Connection::ErrorExpecterCallback* cb) {
+ CHECK(current_expecter_cb_ == NULL);
+ current_expecter_cb_ = cb;
}
// static
-void Connection::ResetErrorIgnorer() {
- CHECK(current_ignorer_cb_);
- current_ignorer_cb_ = NULL;
+void Connection::ResetErrorExpecter() {
+ CHECK(current_expecter_cb_);
+ current_expecter_cb_ = NULL;
}
bool StatementID::operator<(const StatementID& other) const {
@@ -1470,7 +1470,7 @@ scoped_refptr<Connection::StatementRef> Connection::GetUniqueStatement(
int rc = sqlite3_prepare_v2(db_, sql, -1, &stmt, NULL);
if (rc != SQLITE_OK) {
// This is evidence of a syntax error in the incoming SQL.
- if (!ShouldIgnoreSqliteCompileError(rc))
+ if (!IsExpectedSqliteCompileError(rc))
DLOG(FATAL) << "SQL compile error " << GetErrorMessage();
// It could also be database corruption.
@@ -1492,7 +1492,7 @@ scoped_refptr<Connection::StatementRef> Connection::GetUntrackedStatement(
int rc = sqlite3_prepare_v2(db_, sql, -1, &stmt, NULL);
if (rc != SQLITE_OK) {
// This is evidence of a syntax error in the incoming SQL.
- if (!ShouldIgnoreSqliteCompileError(rc))
+ if (!IsExpectedSqliteCompileError(rc))
DLOG(FATAL) << "SQL compile error " << GetErrorMessage();
return new StatementRef(NULL, NULL, false);
}
@@ -1551,8 +1551,8 @@ bool Connection::DoesTableOrIndexExist(
"SELECT name FROM sqlite_master WHERE type=? AND name=? COLLATE NOCASE";
Statement statement(GetUntrackedStatement(kSql));
- // This can happen if the database is corrupt and the error is being ignored
- // for testing purposes.
+ // This can happen if the database is corrupt and the error is a test
+ // expectation.
if (!statement.is_valid())
return false;
@@ -1570,8 +1570,8 @@ bool Connection::DoesColumnExist(const char* table_name,
Statement statement(GetUntrackedStatement(sql.c_str()));
- // This can happen if the database is corrupt and the error is being ignored
- // for testing purposes.
+ // This can happen if the database is corrupt and the error is a test
+ // expectation.
if (!statement.is_valid())
return false;
@@ -1923,7 +1923,7 @@ int Connection::OnSqliteError(int err, sql::Statement *stmt, const char* sql) {
}
// The default handling is to assert on debug and to ignore on release.
- if (!ShouldIgnoreSqliteError(err))
+ if (!IsExpectedSqliteError(err))
DLOG(FATAL) << GetErrorMessage();
return err;
}

Powered by Google App Engine
This is Rietveld 408576698