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

Unified Diff: components/history/core/browser/thumbnail_database_unittest.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
Index: components/history/core/browser/thumbnail_database_unittest.cc
diff --git a/components/history/core/browser/thumbnail_database_unittest.cc b/components/history/core/browser/thumbnail_database_unittest.cc
index 73c532a1406a7b1d8eb66be733ab69fa6276e728..09c3d2377ebf20b09ab04c17321c7c8e1c8a4a57 100644
--- a/components/history/core/browser/thumbnail_database_unittest.cc
+++ b/components/history/core/browser/thumbnail_database_unittest.cc
@@ -16,7 +16,7 @@
#include "components/history/core/test/database_test_utils.h"
#include "sql/connection.h"
#include "sql/recovery.h"
-#include "sql/test/scoped_error_ignorer.h"
+#include "sql/test/scoped_error_expecter.h"
#include "sql/test/test_helpers.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/sqlite/sqlite3.h"
@@ -800,8 +800,8 @@ TEST_F(ThumbnailDatabaseTest, Recovery) {
// Open the database and access the corrupt index.
{
- sql::ScopedErrorIgnorer ignore_errors;
- ignore_errors.IgnoreError(SQLITE_CORRUPT);
+ sql::test::ScopedErrorExpecter expecter;
+ expecter.ExpectError(SQLITE_CORRUPT);
ThumbnailDatabase db(NULL);
ASSERT_EQ(sql::INIT_OK, db.Init(file_name_));
@@ -811,7 +811,7 @@ TEST_F(ThumbnailDatabaseTest, Recovery) {
// fails.
EXPECT_FALSE(db.GetIconMappingsForPageURL(kPageUrl2, NULL));
- ASSERT_TRUE(ignore_errors.CheckIgnoredErrors());
+ ASSERT_TRUE(expecter.SawExpectedErrors());
}
// Check that the database is recovered at the SQLite level.
@@ -847,18 +847,18 @@ TEST_F(ThumbnailDatabaseTest, Recovery) {
// Database is unusable at the SQLite level.
{
- sql::ScopedErrorIgnorer ignore_errors;
- ignore_errors.IgnoreError(SQLITE_CORRUPT);
+ sql::test::ScopedErrorExpecter expecter;
+ expecter.ExpectError(SQLITE_CORRUPT);
sql::Connection raw_db;
EXPECT_TRUE(raw_db.Open(file_name_));
EXPECT_FALSE(raw_db.IsSQLValid("PRAGMA integrity_check"));
- ASSERT_TRUE(ignore_errors.CheckIgnoredErrors());
+ ASSERT_TRUE(expecter.SawExpectedErrors());
}
// Database should be recovered during open.
{
- sql::ScopedErrorIgnorer ignore_errors;
- ignore_errors.IgnoreError(SQLITE_CORRUPT);
+ sql::test::ScopedErrorExpecter expecter;
+ expecter.ExpectError(SQLITE_CORRUPT);
ThumbnailDatabase db(NULL);
ASSERT_EQ(sql::INIT_OK, db.Init(file_name_));
@@ -871,7 +871,7 @@ TEST_F(ThumbnailDatabaseTest, Recovery) {
sizeof(kBlob1),
kBlob1));
- ASSERT_TRUE(ignore_errors.CheckIgnoredErrors());
+ ASSERT_TRUE(expecter.SawExpectedErrors());
}
}
@@ -912,8 +912,8 @@ TEST_F(ThumbnailDatabaseTest, Recovery7) {
// Open the database and access the corrupt index. Note that this upgrades
// the database.
{
- sql::ScopedErrorIgnorer ignore_errors;
- ignore_errors.IgnoreError(SQLITE_CORRUPT);
+ sql::test::ScopedErrorExpecter expecter;
+ expecter.ExpectError(SQLITE_CORRUPT);
ThumbnailDatabase db(NULL);
ASSERT_EQ(sql::INIT_OK, db.Init(file_name_));
@@ -923,7 +923,7 @@ TEST_F(ThumbnailDatabaseTest, Recovery7) {
// fails.
EXPECT_FALSE(db.GetIconMappingsForPageURL(kPageUrl2, NULL));
- ASSERT_TRUE(ignore_errors.CheckIgnoredErrors());
+ ASSERT_TRUE(expecter.SawExpectedErrors());
}
// Check that the database is recovered at the SQLite level.
@@ -959,18 +959,18 @@ TEST_F(ThumbnailDatabaseTest, Recovery7) {
// Database is unusable at the SQLite level.
{
- sql::ScopedErrorIgnorer ignore_errors;
- ignore_errors.IgnoreError(SQLITE_CORRUPT);
+ sql::test::ScopedErrorExpecter expecter;
+ expecter.ExpectError(SQLITE_CORRUPT);
sql::Connection raw_db;
EXPECT_TRUE(raw_db.Open(file_name_));
EXPECT_FALSE(raw_db.IsSQLValid("PRAGMA integrity_check"));
- ASSERT_TRUE(ignore_errors.CheckIgnoredErrors());
+ ASSERT_TRUE(expecter.SawExpectedErrors());
}
// Database should be recovered during open.
{
- sql::ScopedErrorIgnorer ignore_errors;
- ignore_errors.IgnoreError(SQLITE_CORRUPT);
+ sql::test::ScopedErrorExpecter expecter;
+ expecter.ExpectError(SQLITE_CORRUPT);
ThumbnailDatabase db(NULL);
ASSERT_EQ(sql::INIT_OK, db.Init(file_name_));
@@ -983,7 +983,7 @@ TEST_F(ThumbnailDatabaseTest, Recovery7) {
sizeof(kBlob1),
kBlob1));
- ASSERT_TRUE(ignore_errors.CheckIgnoredErrors());
+ ASSERT_TRUE(expecter.SawExpectedErrors());
}
}
@@ -1003,21 +1003,21 @@ TEST_F(ThumbnailDatabaseTest, Recovery6) {
// Database is unusable at the SQLite level.
{
- sql::ScopedErrorIgnorer ignore_errors;
- ignore_errors.IgnoreError(SQLITE_CORRUPT);
+ sql::test::ScopedErrorExpecter expecter;
+ expecter.ExpectError(SQLITE_CORRUPT);
sql::Connection raw_db;
EXPECT_TRUE(raw_db.Open(file_name_));
EXPECT_FALSE(raw_db.IsSQLValid("PRAGMA integrity_check"));
- ASSERT_TRUE(ignore_errors.CheckIgnoredErrors());
+ ASSERT_TRUE(expecter.SawExpectedErrors());
}
// Database open should succeed.
{
- sql::ScopedErrorIgnorer ignore_errors;
- ignore_errors.IgnoreError(SQLITE_CORRUPT);
+ sql::test::ScopedErrorExpecter expecter;
+ expecter.ExpectError(SQLITE_CORRUPT);
ThumbnailDatabase db(NULL);
ASSERT_EQ(sql::INIT_OK, db.Init(file_name_));
- ASSERT_TRUE(ignore_errors.CheckIgnoredErrors());
+ ASSERT_TRUE(expecter.SawExpectedErrors());
}
// The database should be usable at the SQLite level, with a current schema
@@ -1051,21 +1051,21 @@ TEST_F(ThumbnailDatabaseTest, Recovery5) {
// Database is unusable at the SQLite level.
{
- sql::ScopedErrorIgnorer ignore_errors;
- ignore_errors.IgnoreError(SQLITE_CORRUPT);
+ sql::test::ScopedErrorExpecter expecter;
+ expecter.ExpectError(SQLITE_CORRUPT);
sql::Connection raw_db;
EXPECT_TRUE(raw_db.Open(file_name_));
EXPECT_FALSE(raw_db.IsSQLValid("PRAGMA integrity_check"));
- ASSERT_TRUE(ignore_errors.CheckIgnoredErrors());
+ ASSERT_TRUE(expecter.SawExpectedErrors());
}
// Database open should succeed.
{
- sql::ScopedErrorIgnorer ignore_errors;
- ignore_errors.IgnoreError(SQLITE_CORRUPT);
+ sql::test::ScopedErrorExpecter expecter;
+ expecter.ExpectError(SQLITE_CORRUPT);
ThumbnailDatabase db(NULL);
ASSERT_EQ(sql::INIT_OK, db.Init(file_name_));
- ASSERT_TRUE(ignore_errors.CheckIgnoredErrors());
+ ASSERT_TRUE(expecter.SawExpectedErrors());
}
// The database should be usable at the SQLite level, with a current schema
« no previous file with comments | « components/history/core/browser/thumbnail_database.cc ('k') | components/history/core/browser/top_sites_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698