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/test/scoped_error_ignorer.cc

Issue 1991503002: [sql] sql::ScopedErrorIgnorer rename to sql::test::ScopedErrorExpecter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: typo Created 4 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 | « sql/test/scoped_error_ignorer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sql/test/scoped_error_ignorer.cc
diff --git a/sql/test/scoped_error_ignorer.cc b/sql/test/scoped_error_ignorer.cc
deleted file mode 100644
index 7e07cf126d2caef4bb3e93fb66dec55e0ce37a64..0000000000000000000000000000000000000000
--- a/sql/test/scoped_error_ignorer.cc
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "sql/test/scoped_error_ignorer.h"
-
-#include "base/bind.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace sql {
-
-// static
-int ScopedErrorIgnorer::SQLiteLibVersionNumber() {
- return sqlite3_libversion_number();
-}
-
-ScopedErrorIgnorer::ScopedErrorIgnorer()
- : checked_(false) {
- callback_ =
- base::Bind(&ScopedErrorIgnorer::ShouldIgnore, base::Unretained(this));
- Connection::SetErrorIgnorer(&callback_);
-}
-
-ScopedErrorIgnorer::~ScopedErrorIgnorer() {
- EXPECT_TRUE(checked_) << " Test must call CheckIgnoredErrors()";
- Connection::ResetErrorIgnorer();
-}
-
-void ScopedErrorIgnorer::IgnoreError(int err) {
- EXPECT_EQ(0u, ignore_errors_.count(err))
- << " Error " << err << " is already ignored";
- ignore_errors_.insert(err);
-}
-
-bool ScopedErrorIgnorer::CheckIgnoredErrors() {
- checked_ = true;
- return errors_ignored_ == ignore_errors_;
-}
-
-bool ScopedErrorIgnorer::ShouldIgnore(int err) {
- // Look for extended code.
- if (ignore_errors_.count(err) > 0) {
- // Record that the error was seen and ignore it.
- errors_ignored_.insert(err);
- return true;
- }
-
- // Trim extended codes and check again.
- int base_err = err & 0xff;
- if (ignore_errors_.count(base_err) > 0) {
- // Record that the error was seen and ignore it.
- errors_ignored_.insert(base_err);
- return true;
- }
-
- // Unexpected error.
- ADD_FAILURE() << " Unexpected SQLite error " << err;
-
- // TODO(shess): If it never makes sense to pass through an error
- // under the test harness, then perhaps the ignore callback
- // signature should be changed.
- return true;
-}
-
-} // namespace sql
« no previous file with comments | « sql/test/scoped_error_ignorer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698