| 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());
|
| }
|
|
|