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

Unified Diff: sql/connection_unittest.cc

Issue 901033002: Import SQLite 3.8.7.4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Chromium changes to support SQLite 3.8.7.4. Created 5 years, 10 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_unittest.cc
diff --git a/sql/connection_unittest.cc b/sql/connection_unittest.cc
index d79cba8d0298e1289a61198e95fb746e9865e3fe..07c9fa7c732c0714e4eb07a5799f0946ed7a1076 100644
--- a/sql/connection_unittest.cc
+++ b/sql/connection_unittest.cc
@@ -237,7 +237,10 @@ TEST_F(SQLConnectionTest, ErrorCallback) {
sql::ScopedErrorCallback sec(
&db(), base::Bind(&sql::CaptureErrorCallback, &error));
EXPECT_FALSE(db().Execute("INSERT INTO foo (id) VALUES (12)"));
- EXPECT_EQ(SQLITE_CONSTRAINT, error);
+
+ // Later versions of SQLite throw SQLITE_CONSTRAINT_UNIQUE. The specific
+ // sub-error isn't really important.
+ EXPECT_EQ(SQLITE_CONSTRAINT, (error&0xff));
}
// Callback is no longer in force due to reset.
@@ -448,12 +451,20 @@ TEST_F(SQLConnectionTest, RazeNOTADB) {
}
ASSERT_TRUE(base::PathExists(db_path()));
- // SQLite will successfully open the handle, but will fail with
- // SQLITE_IOERR_SHORT_READ on pragma statemenets which read the
- // header.
+ // SQLite will successfully open the handle, but fail when running PRAGMA
+ // statements that access the database.
{
sql::ScopedErrorIgnorer ignore_errors;
- ignore_errors.IgnoreError(SQLITE_IOERR_SHORT_READ);
+
+ // Earlier versions of Chromium compiled against SQLite 3.6.7.3, which
+ // returned SQLITE_IOERR_SHORT_READ in this case. Some platforms may still
+ // compile against an earlier SQLite via USE_SYSTEM_SQLITE.
+ if (ignore_errors.SQLiteLibVersionNumber() < 3008007) {
+ ignore_errors.IgnoreError(SQLITE_IOERR_SHORT_READ);
+ } else {
+ ignore_errors.IgnoreError(SQLITE_NOTADB);
+ }
+
EXPECT_TRUE(db().Open(db_path()));
ASSERT_TRUE(ignore_errors.CheckIgnoredErrors());
}
« no previous file with comments | « sql/BUILD.gn ('k') | sql/recovery.cc » ('j') | third_party/sqlite/src/src/os_unix.c » ('J')

Powered by Google App Engine
This is Rietveld 408576698