summaryrefslogtreecommitdiff
path: root/chromium/sql
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-11-20 15:06:40 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-11-22 11:48:58 +0000
commitdaa093eea7c773db06799a13bd7e4e2e2a9f8f14 (patch)
tree96cc5e7b9194c1b29eab927730bfa419e7111c25 /chromium/sql
parentbe59a35641616a4cf23c4a13fa0632624b021c1b (diff)
downloadqtwebengine-chromium-daa093eea7c773db06799a13bd7e4e2e2a9f8f14.tar.gz
BASELINE: Update Chromium to 63.0.3239.58
Change-Id: Ia93b322a00ba4dd4004f3bcf1254063ba90e1605 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/sql')
-rw-r--r--chromium/sql/BUILD.gn12
-rw-r--r--chromium/sql/connection.cc79
-rw-r--r--chromium/sql/connection.h5
-rw-r--r--chromium/sql/connection_unittest.cc29
-rw-r--r--chromium/sql/correct_sql_test_base.h27
-rw-r--r--chromium/sql/meta_table.h40
-rw-r--r--chromium/sql/sqlite_features_unittest.cc11
-rw-r--r--chromium/sql/statement.cc2
-rw-r--r--chromium/sql/statement_unittest.cc2
-rw-r--r--chromium/sql/transaction_unittest.cc4
10 files changed, 76 insertions, 135 deletions
diff --git a/chromium/sql/BUILD.gn b/chromium/sql/BUILD.gn
index 42fa3de8359..e5278d0a2d2 100644
--- a/chromium/sql/BUILD.gn
+++ b/chromium/sql/BUILD.gn
@@ -69,17 +69,6 @@ static_library("test_support") {
]
}
-source_set("redirection_header") {
- # This target exists because we need a way to switch between
- # "test/sql_test_base.h" and "mojo/sql_test_base.h" at compile time, to allow
- # us to switch out the gtest vs mojo:apptest frameworks.
- check_includes = false
-
- sources = [
- "correct_sql_test_base.h",
- ]
-}
-
bundle_data("sql_unittests_bundle_data") {
testonly = true
sources = [
@@ -117,7 +106,6 @@ test("sql_unittests") {
configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
deps = [
- ":redirection_header",
":sql",
":sql_unittests_bundle_data",
":test_support",
diff --git a/chromium/sql/connection.cc b/chromium/sql/connection.cc
index 453d380a705..22259912c46 100644
--- a/chromium/sql/connection.cc
+++ b/chromium/sql/connection.cc
@@ -97,7 +97,7 @@ int BackupDatabase(sqlite3* src, sqlite3* dst, const char* db_name) {
if (!backup) {
// Since this call only sets things up, this indicates a gross
// error in SQLite.
- DLOG(FATAL) << "Unable to start sqlite3_backup(): " << sqlite3_errmsg(dst);
+ DLOG(DCHECK) << "Unable to start sqlite3_backup(): " << sqlite3_errmsg(dst);
return sqlite3_errcode(dst);
}
@@ -466,7 +466,7 @@ void Connection::CloseInternal(bool forced) {
int rc = sqlite3_close(db_);
if (rc != SQLITE_OK) {
UMA_HISTOGRAM_SPARSE_SLOWLY("Sqlite.CloseFailure", rc);
- DLOG(FATAL) << "sqlite3_close failed: " << GetErrorMessage();
+ DLOG(DCHECK) << "sqlite3_close failed: " << GetErrorMessage();
}
}
db_ = NULL;
@@ -488,7 +488,7 @@ void Connection::Preload() {
AssertIOAllowed();
if (!db_) {
- DLOG_IF(FATAL, !poisoned_) << "Cannot preload null db";
+ DCHECK(poisoned_) << "Cannot preload null db";
return;
}
@@ -565,7 +565,7 @@ void Connection::ReleaseCacheMemoryIfNeeded(bool implicit_change_performed) {
// The database could have been closed during a transaction as part of error
// recovery.
if (!db_) {
- DLOG_IF(FATAL, !poisoned_) << "Illegal use of connection without a db";
+ DCHECK(poisoned_) << "Illegal use of connection without a db";
return;
}
@@ -1054,18 +1054,18 @@ bool Connection::Raze() {
AssertIOAllowed();
if (!db_) {
- DLOG_IF(FATAL, !poisoned_) << "Cannot raze null db";
+ DCHECK(poisoned_) << "Cannot raze null db";
return false;
}
if (transaction_nesting_ > 0) {
- DLOG(FATAL) << "Cannot raze within a transaction";
+ DLOG(DCHECK) << "Cannot raze within a transaction";
return false;
}
sql::Connection null_db;
if (!null_db.OpenInMemory()) {
- DLOG(FATAL) << "Unable to open in-memory database.";
+ DLOG(DCHECK) << "Unable to open in-memory database.";
return false;
}
@@ -1141,49 +1141,33 @@ bool Connection::Raze() {
sqlite3_file* file = NULL;
rc = GetSqlite3File(db_, &file);
if (rc != SQLITE_OK) {
- DLOG(FATAL) << "Failure getting file handle.";
+ DLOG(DCHECK) << "Failure getting file handle.";
return false;
}
rc = file->pMethods->xTruncate(file, 0);
if (rc != SQLITE_OK) {
UMA_HISTOGRAM_SPARSE_SLOWLY("Sqlite.RazeDatabaseTruncate",rc);
- DLOG(FATAL) << "Failed to truncate file.";
+ DLOG(DCHECK) << "Failed to truncate file.";
return false;
}
rc = BackupDatabase(null_db.db_, db_, kMain);
UMA_HISTOGRAM_SPARSE_SLOWLY("Sqlite.RazeDatabase2",rc);
- if (rc != SQLITE_DONE) {
- DLOG(FATAL) << "Failed retrying Raze().";
- }
+ DCHECK_EQ(rc, SQLITE_DONE) << "Failed retrying Raze().";
}
- // The entire database should have been backed up.
- if (rc != SQLITE_DONE) {
- // TODO(shess): Figure out which other cases can happen.
- DLOG(FATAL) << "Unable to copy entire null database.";
- return false;
- }
-
- return true;
-}
-
-bool Connection::RazeWithTimout(base::TimeDelta timeout) {
- if (!db_) {
- DLOG_IF(FATAL, !poisoned_) << "Cannot raze null db";
- return false;
- }
+ // TODO(shess): Figure out which other cases can happen.
+ DCHECK_EQ(rc, SQLITE_DONE) << "Unable to copy entire null database.";
- ScopedBusyTimeout busy_timeout(db_);
- busy_timeout.SetTimeout(timeout);
- return Raze();
+ // The entire database should have been backed up.
+ return rc == SQLITE_DONE;
}
bool Connection::RazeAndClose() {
if (!db_) {
- DLOG_IF(FATAL, !poisoned_) << "Cannot raze null db";
+ DCHECK(poisoned_) << "Cannot raze null db";
return false;
}
@@ -1204,7 +1188,7 @@ bool Connection::RazeAndClose() {
void Connection::Poison() {
if (!db_) {
- DLOG_IF(FATAL, !poisoned_) << "Cannot poison null db";
+ DCHECK(poisoned_) << "Cannot poison null db";
return;
}
@@ -1295,7 +1279,7 @@ bool Connection::BeginTransaction() {
void Connection::RollbackTransaction() {
if (!transaction_nesting_) {
- DLOG_IF(FATAL, !poisoned_) << "Rolling back a nonexistent transaction";
+ DCHECK(poisoned_) << "Rolling back a nonexistent transaction";
return;
}
@@ -1312,7 +1296,7 @@ void Connection::RollbackTransaction() {
bool Connection::CommitTransaction() {
if (!transaction_nesting_) {
- DLOG_IF(FATAL, !poisoned_) << "Committing a nonexistent transaction";
+ DCHECK(poisoned_) << "Committing a nonexistent transaction";
return false;
}
transaction_nesting_--;
@@ -1379,7 +1363,7 @@ bool Connection::DetachDatabase(const char* attachment_point) {
int Connection::ExecuteAndReturnErrorCode(const char* sql) {
AssertIOAllowed();
if (!db_) {
- DLOG_IF(FATAL, !poisoned_) << "Illegal use of connection without a db";
+ DCHECK(poisoned_) << "Illegal use of connection without a db";
return SQLITE_ERROR;
}
DCHECK(sql);
@@ -1442,7 +1426,7 @@ int Connection::ExecuteAndReturnErrorCode(const char* sql) {
bool Connection::Execute(const char* sql) {
if (!db_) {
- DLOG_IF(FATAL, !poisoned_) << "Illegal use of connection without a db";
+ DCHECK(poisoned_) << "Illegal use of connection without a db";
return false;
}
@@ -1454,14 +1438,14 @@ bool Connection::Execute(const char* sql) {
// that there's a malformed SQL statement. This can arise in development if
// a change alters the schema but not all queries adjust. This can happen
// in production if the schema is corrupted.
- if (error == SQLITE_ERROR)
- DLOG(FATAL) << "SQL Error in " << sql << ", " << GetErrorMessage();
+ DCHECK_NE(error, SQLITE_ERROR)
+ << "SQL Error in " << sql << ", " << GetErrorMessage();
return error == SQLITE_OK;
}
bool Connection::ExecuteWithTimeout(const char* sql, base::TimeDelta timeout) {
if (!db_) {
- DLOG_IF(FATAL, !poisoned_) << "Illegal use of connection without a db";
+ DCHECK(poisoned_) << "Illegal use of connection without a db";
return false;
}
@@ -1513,8 +1497,7 @@ scoped_refptr<Connection::StatementRef> Connection::GetStatementImpl(
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 (rc == SQLITE_ERROR)
- DLOG(FATAL) << "SQL compile error " << GetErrorMessage();
+ DCHECK_NE(rc, SQLITE_ERROR) << "SQL compile error " << GetErrorMessage();
// It could also be database corruption.
OnSqliteError(rc, NULL, sql);
@@ -1554,7 +1537,7 @@ std::string Connection::GetSchema() const {
bool Connection::IsSQLValid(const char* sql) {
AssertIOAllowed();
if (!db_) {
- DLOG_IF(FATAL, !poisoned_) << "Illegal use of connection without a db";
+ DCHECK(poisoned_) << "Illegal use of connection without a db";
return false;
}
@@ -1618,7 +1601,7 @@ bool Connection::DoesColumnExist(const char* table_name,
int64_t Connection::GetLastInsertRowId() const {
if (!db_) {
- DLOG_IF(FATAL, !poisoned_) << "Illegal use of connection without a db";
+ DCHECK(poisoned_) << "Illegal use of connection without a db";
return 0;
}
return sqlite3_last_insert_rowid(db_);
@@ -1626,7 +1609,7 @@ int64_t Connection::GetLastInsertRowId() const {
int Connection::GetLastChangeCount() const {
if (!db_) {
- DLOG_IF(FATAL, !poisoned_) << "Illegal use of connection without a db";
+ DCHECK(poisoned_) << "Illegal use of connection without a db";
return 0;
}
return sqlite3_changes(db_);
@@ -1660,7 +1643,7 @@ bool Connection::OpenInternal(const std::string& file_name,
AssertIOAllowed();
if (db_) {
- DLOG(FATAL) << "sql::Connection is already open.";
+ DLOG(DCHECK) << "sql::Connection is already open.";
return false;
}
@@ -1699,7 +1682,7 @@ bool Connection::OpenInternal(const std::string& file_name,
// only considers the sqlite3 handle's state.
// TODO(shess): Revise is_open() to consider poisoned_, and review
// to see if any non-testing code even depends on it.
- DLOG_IF(FATAL, poisoned_) << "sql::Connection is already open.";
+ DCHECK(!poisoned_) << "sql::Connection is already open.";
poisoned_ = false;
// Custom memory-mapping VFS which reads pages using regular I/O on first hit.
@@ -1919,7 +1902,7 @@ void Connection::StatementRefCreated(StatementRef* ref) {
void Connection::StatementRefDeleted(StatementRef* ref) {
StatementRefSet::iterator i = open_statements_.find(ref);
if (i == open_statements_.end())
- DLOG(FATAL) << "Could not find statement";
+ DLOG(DCHECK) << "Could not find statement";
else
open_statements_.erase(i);
}
@@ -1976,7 +1959,7 @@ int Connection::OnSqliteError(
// The default handling is to assert on debug and to ignore on release.
if (!IsExpectedSqliteError(err))
- DLOG(FATAL) << GetErrorMessage();
+ DLOG(DCHECK) << GetErrorMessage();
return err;
}
diff --git a/chromium/sql/connection.h b/chromium/sql/connection.h
index 8b9640785e9..e643680bfad 100644
--- a/chromium/sql/connection.h
+++ b/chromium/sql/connection.h
@@ -310,7 +310,7 @@ class SQL_EXPORT Connection {
// was razed.
//
// false is returned if the database is locked by some other
- // process. RazeWithTimeout() may be used if appropriate.
+ // process.
//
// NOTE(shess): Raze() will DCHECK in the following situations:
// - database is not open.
@@ -334,7 +334,6 @@ class SQL_EXPORT Connection {
// TODO(shess): Bake auto_vacuum into Connection's API so it can
// just pick up the default.
bool Raze();
- bool RazeWithTimout(base::TimeDelta timeout);
// Breaks all outstanding transactions (as initiated by
// BeginTransaction()), closes the SQLite database, and poisons the
@@ -498,7 +497,7 @@ class SQL_EXPORT Connection {
// Returns |true| if there is an error expecter (see SetErrorExpecter), and
// that expecter returns |true| when passed |error|. Clients which provide an
// |error_callback| should use IsExpectedSqliteError() to check for unexpected
- // errors; if one is detected, DLOG(FATAL) is generally appropriate (see
+ // errors; if one is detected, DLOG(DCHECK) is generally appropriate (see
// OnSqliteError implementation).
static bool IsExpectedSqliteError(int error);
diff --git a/chromium/sql/connection_unittest.cc b/chromium/sql/connection_unittest.cc
index 4ee8b0288a3..4a41d6c322d 100644
--- a/chromium/sql/connection_unittest.cc
+++ b/chromium/sql/connection_unittest.cc
@@ -14,13 +14,14 @@
#include "base/strings/string_number_conversions.h"
#include "base/test/histogram_tester.h"
#include "base/trace_event/process_memory_dump.h"
+#include "build/build_config.h"
#include "sql/connection.h"
#include "sql/connection_memory_dump_provider.h"
-#include "sql/correct_sql_test_base.h"
#include "sql/meta_table.h"
#include "sql/statement.h"
#include "sql/test/error_callback_support.h"
#include "sql/test/scoped_error_expecter.h"
+#include "sql/test/sql_test_base.h"
#include "sql/test/test_helpers.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/sqlite/sqlite3.h"
@@ -606,8 +607,6 @@ TEST_F(SQLConnectionTest, RazeMultiple) {
ASSERT_EQ(0, SqliteMasterCount(&other_db));
}
-// TODO(erg): Enable this in the next patch once I add locking.
-#if !defined(MOJO_APPTEST_IMPL)
TEST_F(SQLConnectionTest, RazeLocked) {
const char* kCreateSql = "CREATE TABLE foo (id INTEGER PRIMARY KEY, value)";
ASSERT_TRUE(db().Execute(kCreateSql));
@@ -642,7 +641,6 @@ TEST_F(SQLConnectionTest, RazeLocked) {
ASSERT_FALSE(s.Step());
ASSERT_TRUE(db().Raze());
}
-#endif
// Verify that Raze() can handle an empty file. SQLite should treat
// this as an empty database.
@@ -837,8 +835,8 @@ TEST_F(SQLConnectionTest, RazeAndCloseDiagnostics) {
// Close normally to reset the poisoned flag.
db().Close();
- // DEATH tests not supported on Android or iOS.
-#if !defined(OS_ANDROID) && !defined(OS_IOS)
+ // DEATH tests not supported on Android, iOS, or Fuchsia.
+#if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_FUCHSIA)
// Once the real Close() has been called, various calls enforce API
// usage by becoming fatal in debug mode. Since DEATH tests are
// expensive, just test one of them.
@@ -918,9 +916,8 @@ TEST_F(SQLConnectionTest, Delete) {
EXPECT_FALSE(GetPathExists(journal));
}
-// This test manually sets on disk permissions; this doesn't apply to the mojo
-// fork.
-#if defined(OS_POSIX) && !defined(MOJO_APPTEST_IMPL)
+// This test manually sets on disk permissions, these don't exist on Fuchsia.
+#if defined(OS_POSIX) && !defined(OS_FUCHSIA)
// Test that set_restrict_to_user() trims database permissions so that
// only the owner (and root) can read.
TEST_F(SQLConnectionTest, UserPermission) {
@@ -984,7 +981,7 @@ TEST_F(SQLConnectionTest, UserPermission) {
EXPECT_TRUE(base::GetPosixFilePermissions(journal, &mode));
ASSERT_EQ((mode & base::FILE_PERMISSION_USER_MASK), mode);
}
-#endif // defined(OS_POSIX)
+#endif // defined(OS_POSIX) && !defined(OS_FUCHSIA)
// Test that errors start happening once Poison() is called.
TEST_F(SQLConnectionTest, Poison) {
@@ -1421,13 +1418,9 @@ TEST_F(SQLConnectionTest, OnMemoryDump) {
// Test that the functions to collect diagnostic data run to completion, without
// worrying too much about what they generate (since that will change).
TEST_F(SQLConnectionTest, CollectDiagnosticInfo) {
- // NOTE(shess): Mojo doesn't support everything CollectCorruptionInfo() uses,
- // but it's not really clear if adding support would be useful.
-#if !defined(MOJO_APPTEST_IMPL)
const std::string corruption_info = db().CollectCorruptionInfo();
EXPECT_NE(std::string::npos, corruption_info.find("SQLITE_CORRUPT"));
EXPECT_NE(std::string::npos, corruption_info.find("integrity_check"));
-#endif
// A statement to see in the results.
const char* kSimpleSql = "SELECT 'mountain'";
@@ -1455,7 +1448,6 @@ TEST_F(SQLConnectionTest, CollectDiagnosticInfo) {
EXPECT_NE(std::string::npos, error_info.find("version: 4"));
}
-#if !defined(MOJO_APPTEST_IMPL)
TEST_F(SQLConnectionTest, RegisterIntentToUpload) {
base::FilePath breadcrumb_path(
db_path().DirName().Append(FILE_PATH_LITERAL("sqlite-diag")));
@@ -1489,7 +1481,6 @@ TEST_F(SQLConnectionTest, RegisterIntentToUpload) {
ASSERT_TRUE(db().Open(db_path()));
EXPECT_FALSE(db().RegisterIntentToUpload());
}
-#endif // !defined(MOJO_APPTEST_IMPL)
// Test that a fresh database has mmap enabled by default, if mmap'ed I/O is
// enabled by SQLite.
@@ -1654,11 +1645,11 @@ TEST_F(SQLConnectionTest, GetAppropriateMmapSizeAltStatus) {
}
// To prevent invalid SQL from accidentally shipping to production, prepared
-// statements which fail to compile with SQLITE_ERROR call DLOG(FATAL). This
+// statements which fail to compile with SQLITE_ERROR call DLOG(DCHECK). This
// case cannot be suppressed with an error callback.
TEST_F(SQLConnectionTest, CompileError) {
- // DEATH tests not supported on Android or iOS.
-#if !defined(OS_ANDROID) && !defined(OS_IOS)
+ // DEATH tests not supported on Android, iOS, or Fuchsia.
+#if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_FUCHSIA)
if (DLOG_IS_ON(FATAL)) {
db().set_error_callback(base::Bind(&IgnoreErrorCallback));
ASSERT_DEATH({
diff --git a/chromium/sql/correct_sql_test_base.h b/chromium/sql/correct_sql_test_base.h
deleted file mode 100644
index 7056dea19ab..00000000000
--- a/chromium/sql/correct_sql_test_base.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2015 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.
-
-#ifndef SQL_CORRECT_SQL_TEST_BASE_H_
-#define SQL_CORRECT_SQL_TEST_BASE_H_
-
-// This header exists to get around gn check. We want to use the same testing
-// code in both the sql_unittests target (which uses gtest and targets the
-// filesystem directly) and sql_apptests.mojo (which uses mojo:apptest and
-// proxies the additional filesystem access to mojo:filesystem). Both of these
-// files define a class named sql::SQLTestBase and have the same interface.
-//
-// Unfortunately, gn check does not understand preprocessor directives. If it
-// did, the following code would be gn check clean, but since it isn't, we
-// stuff this redirection header in its own file, give it its own source_set
-// target, and then set check_includes to false.
-//
-// This work around was suggested by brettw@.
-#if defined(MOJO_APPTEST_IMPL)
-#include "sql/mojo/sql_test_base.h"
-#else
-#include "sql/test/sql_test_base.h"
-#endif
-
-#endif // SQL_CORRECT_SQL_TEST_BASE_H_
-
diff --git a/chromium/sql/meta_table.h b/chromium/sql/meta_table.h
index afa6e880406..8a5dd5959e0 100644
--- a/chromium/sql/meta_table.h
+++ b/chromium/sql/meta_table.h
@@ -16,12 +16,18 @@ namespace sql {
class Connection;
class Statement;
+// Creates and manages a table to store generic metadata. The features provided
+// are:
+// * An interface for storing multi-typed key-value data.
+// * Helper methods to assist in database schema version control.
+// * Historical data on past attempts to mmap the database to make it possible
+// to avoid unconditionally retrying to load broken databases.
class SQL_EXPORT MetaTable {
public:
MetaTable();
~MetaTable();
- // Values for Get/SetMmapStatus(). |kMmapFailure| indicates that there was at
+ // Values for Get/SetMmapStatus(). |kMmapFailure| indicates that there was at
// some point a read error and the database should not be memory-mapped, while
// |kMmapSuccess| indicates that the entire file was read at some point and
// can be memory-mapped without constraint.
@@ -32,31 +38,31 @@ class SQL_EXPORT MetaTable {
static bool DoesTableExist(Connection* db);
// If the current version of the database is less than or equal to
- // |deprecated_version|, raze the database. Must be called outside
- // of a transaction.
- // TODO(shess): At this time the database is razed IFF meta exists
- // and contains a version row with value <= deprecated_version. It
- // may make sense to also raze if meta exists but has no version
- // row, or if meta doesn't exist. In those cases if the database is
- // not already empty, it probably resulted from a broken
- // initialization.
+ // |deprecated_version|, raze the database. Must be called outside of a
+ // transaction.
+ // TODO(shess): At this time the database is razed IFF meta exists and
+ // contains a version row with value <= deprecated_version. It may make sense
+ // to also raze if meta exists but has no version row, or if meta doesn't
+ // exist. In those cases if the database is not already empty, it probably
+ // resulted from a broken initialization.
// TODO(shess): Folding this into Init() would allow enforcing
- // |deprecated_version|<|version|. But Init() is often called in a
+ // |deprecated_version|<|version|. But Init() is often called in a
// transaction.
static void RazeIfDeprecated(Connection* db, int deprecated_version);
- // Used to tuck some data into the meta table about mmap status. The value
+ // Used to tuck some data into the meta table about mmap status. The value
// represents how much data in bytes has successfully been read from the
// database, or |kMmapFailure| or |kMmapSuccess|.
static bool GetMmapStatus(Connection* db, int64_t* status);
static bool SetMmapStatus(Connection* db, int64_t status);
- // Initializes the MetaTableHelper, creating the meta table if necessary. For
- // new tables, it will initialize the version number to |version| and the
- // compatible version number to |compatible_version|. Versions must be
- // greater than 0 to distinguish missing versions (see GetVersionNumber()).
- // If there was no meta table (proxy for a fresh database), mmap status is set
- // to |kMmapSuccess|.
+ // Initializes the MetaTableHelper, providing the |Connection| pointer and
+ // creating the meta table if necessary. Must be called before any other
+ // non-static methods. For new tables, it will initialize the version number
+ // to |version| and the compatible version number to |compatible_version|.
+ // Versions must be greater than 0 to distinguish missing versions (see
+ // GetVersionNumber()). If there was no meta table (proxy for a fresh
+ // database), mmap status is set to |kMmapSuccess|.
bool Init(Connection* db, int version, int compatible_version);
// Resets this MetaTable object, making another call to Init() possible.
diff --git a/chromium/sql/sqlite_features_unittest.cc b/chromium/sql/sqlite_features_unittest.cc
index 88f7802fc02..5d5fd660181 100644
--- a/chromium/sql/sqlite_features_unittest.cc
+++ b/chromium/sql/sqlite_features_unittest.cc
@@ -11,6 +11,7 @@
#include "base/files/file_util.h"
#include "base/files/memory_mapped_file.h"
#include "base/files/scoped_temp_dir.h"
+#include "build/build_config.h"
#include "sql/connection.h"
#include "sql/statement.h"
#include "sql/test/sql_test_base.h"
@@ -163,7 +164,7 @@ TEST_F(SQLiteFeaturesTest, ForeignKeySupport) {
EXPECT_EQ("", ExecuteWithResult(&db(), kSelectChildren));
}
-#if defined(MOJO_APPTEST_IMPL) || defined(OS_IOS)
+#if defined(OS_IOS) || defined(OS_FUCHSIA)
// If the platform cannot support SQLite mmap'ed I/O, make sure SQLite isn't
// offering to support it.
TEST_F(SQLiteFeaturesTest, NoMmap) {
@@ -189,9 +190,9 @@ TEST_F(SQLiteFeaturesTest, NoMmap) {
sql::Statement s(db().GetUniqueStatement("PRAGMA mmap_size"));
ASSERT_TRUE(!s.Step() || !s.ColumnInt64(0));
}
-#endif
+#endif // defined(OS_IOS) || defined(OS_FUCHSIA)
-#if !defined(MOJO_APPTEST_IMPL)
+#if !defined(OS_FUCHSIA)
// Verify that OS file writes are reflected in the memory mapping of a
// memory-mapped file. Normally SQLite writes to memory-mapped files using
// memcpy(), which should stay consistent. Our SQLite is slightly patched to
@@ -280,7 +281,7 @@ TEST_F(SQLiteFeaturesTest, Mmap) {
ASSERT_EQ('4', m.data()[kOffset]);
}
}
-#endif
+#endif // !defined(OS_FUCHSIA)
// Verify that http://crbug.com/248608 is fixed. In this bug, the
// compiled regular expression is effectively cached with the prepared
@@ -457,7 +458,7 @@ TEST_F(SQLiteFeaturesTest, SmartAutoVacuum) {
}
#endif // !defined(USE_SYSTEM_SQLITE)
-#if !defined(USE_SYSTEM_SQLITE)
+#if !defined(USE_SYSTEM_SQLITE) && !defined(OS_FUCHSIA)
// SQLite WAL mode defaults to checkpointing the WAL on close. This would push
// additional work into Chromium shutdown. Verify that SQLite supports a config
// option to not checkpoint on close.
diff --git a/chromium/sql/statement.cc b/chromium/sql/statement.cc
index 5778fd0d7da..12a7b8623e5 100644
--- a/chromium/sql/statement.cc
+++ b/chromium/sql/statement.cc
@@ -351,7 +351,7 @@ bool Statement::CheckOk(int err) const {
// TODO(gbillock,shess): make this invalidate the statement so it
// can't wreak havoc.
if (err == SQLITE_RANGE)
- DLOG(FATAL) << "Bind value out of range";
+ DLOG(DCHECK) << "Bind value out of range";
return err == SQLITE_OK;
}
diff --git a/chromium/sql/statement_unittest.cc b/chromium/sql/statement_unittest.cc
index 75adf63c52c..654629ecfa5 100644
--- a/chromium/sql/statement_unittest.cc
+++ b/chromium/sql/statement_unittest.cc
@@ -8,10 +8,10 @@
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "sql/connection.h"
-#include "sql/correct_sql_test_base.h"
#include "sql/statement.h"
#include "sql/test/error_callback_support.h"
#include "sql/test/scoped_error_expecter.h"
+#include "sql/test/sql_test_base.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/sqlite/sqlite3.h"
diff --git a/chromium/sql/transaction_unittest.cc b/chromium/sql/transaction_unittest.cc
index 179adcf3e55..168da85196f 100644
--- a/chromium/sql/transaction_unittest.cc
+++ b/chromium/sql/transaction_unittest.cc
@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "sql/transaction.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "sql/connection.h"
-#include "sql/correct_sql_test_base.h"
#include "sql/statement.h"
-#include "sql/transaction.h"
+#include "sql/test/sql_test_base.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/sqlite/sqlite3.h"