summaryrefslogtreecommitdiff
path: root/chromium/sql/recovery_unittest.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-10-24 11:30:15 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-10-30 12:56:19 +0000
commit6036726eb981b6c4b42047513b9d3f4ac865daac (patch)
tree673593e70678e7789766d1f732eb51f613a2703b /chromium/sql/recovery_unittest.cc
parent466052c4e7c052268fd931888cd58961da94c586 (diff)
downloadqtwebengine-chromium-6036726eb981b6c4b42047513b9d3f4ac865daac.tar.gz
BASELINE: Update Chromium to 70.0.3538.78
Change-Id: Ie634710bf039e26c1957f4ae45e101bd4c434ae7 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/sql/recovery_unittest.cc')
-rw-r--r--chromium/sql/recovery_unittest.cc34
1 files changed, 20 insertions, 14 deletions
diff --git a/chromium/sql/recovery_unittest.cc b/chromium/sql/recovery_unittest.cc
index 59bcaa4085d..7e65bf7beac 100644
--- a/chromium/sql/recovery_unittest.cc
+++ b/chromium/sql/recovery_unittest.cc
@@ -17,7 +17,7 @@
#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/metrics/histogram_tester.h"
-#include "sql/connection.h"
+#include "sql/database.h"
#include "sql/meta_table.h"
#include "sql/statement.h"
#include "sql/test/paths.h"
@@ -36,7 +36,7 @@ using sql::test::ExecuteWithResult;
// schema. For tables or indices, this will contain the sql command
// to create the table or index. For certain automatic SQLite
// structures with no sql, the name is used.
-std::string GetSchema(sql::Connection* db) {
+std::string GetSchema(sql::Database* db) {
static const char kSql[] =
"SELECT COALESCE(sql, name) FROM sqlite_master ORDER BY 1";
return ExecuteWithResults(db, kSql, "|", "\n");
@@ -195,9 +195,13 @@ TEST_F(SQLRecoveryTest, VirtualTable) {
ExecuteWithResults(&db(), kXSql, "|", "\n"));
}
-void RecoveryCallback(sql::Connection* db, const base::FilePath& db_path,
- const char* create_table, const char* create_index,
- int* record_error, int error, sql::Statement* stmt) {
+void RecoveryCallback(sql::Database* db,
+ const base::FilePath& db_path,
+ const char* create_table,
+ const char* create_index,
+ int* record_error,
+ int error,
+ sql::Statement* stmt) {
*record_error = error;
// Clear the error callback to prevent reentrancy.
@@ -938,8 +942,8 @@ void TestPageSize(const base::FilePath& db_prefix,
const base::FilePath db_path = db_prefix.InsertBeforeExtensionASCII(
base::IntToString(initial_page_size));
- sql::Connection::Delete(db_path);
- sql::Connection db;
+ sql::Database::Delete(db_path);
+ sql::Database db;
db.set_page_size(initial_page_size);
ASSERT_TRUE(db.Open(db_path));
ASSERT_TRUE(db.Execute(kCreateSql));
@@ -957,7 +961,7 @@ void TestPageSize(const base::FilePath& db_prefix,
db.Close();
// Make sure the page size is read from the file.
- db.set_page_size(0);
+ db.set_page_size(sql::Database::kDefaultPageSize);
ASSERT_TRUE(db.Open(db_path));
ASSERT_EQ(expected_final_page_size,
ExecuteWithResult(&db, "PRAGMA page_size"));
@@ -972,11 +976,12 @@ TEST_F(SQLRecoveryTest, PageSize) {
const std::string default_page_size =
ExecuteWithResult(&db(), "PRAGMA page_size");
- // The database should have the default page size after recovery.
- EXPECT_NO_FATAL_FAILURE(
- TestPageSize(db_path(), 0, default_page_size, 0, default_page_size));
+ // Check the default page size first.
+ EXPECT_NO_FATAL_FAILURE(TestPageSize(
+ db_path(), sql::Database::kDefaultPageSize, default_page_size,
+ sql::Database::kDefaultPageSize, default_page_size));
- // Sync user 32k pages.
+ // Sync uses 32k pages.
EXPECT_NO_FATAL_FAILURE(
TestPageSize(db_path(), 32768, "32768", 32768, "32768"));
@@ -989,8 +994,9 @@ TEST_F(SQLRecoveryTest, PageSize) {
// Databases with no page size specified should recover with the new default
// page size. 2k has never been the default page size.
ASSERT_NE("2048", default_page_size);
- EXPECT_NO_FATAL_FAILURE(
- TestPageSize(db_path(), 2048, "2048", 0, default_page_size));
+ EXPECT_NO_FATAL_FAILURE(TestPageSize(db_path(), 2048, "2048",
+ sql::Database::kDefaultPageSize,
+ default_page_size));
}
} // namespace