summaryrefslogtreecommitdiff
path: root/chromium/sql/recovery_unittest.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-07-14 17:41:05 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2016-08-04 12:37:36 +0000
commit399c965b6064c440ddcf4015f5f8e9d131c7a0a6 (patch)
tree6b06b60ff365abef0e13b3503d593a0df48d20e8 /chromium/sql/recovery_unittest.cc
parent7366110654eec46f21b6824f302356426f48cd74 (diff)
downloadqtwebengine-chromium-399c965b6064c440ddcf4015f5f8e9d131c7a0a6.tar.gz
BASELINE: Update Chromium to 52.0.2743.76 and Ninja to 1.7.1
Change-Id: I382f51b959689505a60f8b707255ecb344f7d8b4 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/sql/recovery_unittest.cc')
-rw-r--r--chromium/sql/recovery_unittest.cc58
1 files changed, 39 insertions, 19 deletions
diff --git a/chromium/sql/recovery_unittest.cc b/chromium/sql/recovery_unittest.cc
index d3b04b1eb90..b215777560d 100644
--- a/chromium/sql/recovery_unittest.cc
+++ b/chromium/sql/recovery_unittest.cc
@@ -5,6 +5,8 @@
#include "sql/recovery.h"
#include <stddef.h>
+
+#include <memory>
#include <string>
#include <utility>
@@ -80,7 +82,8 @@ TEST_F(SQLRecoveryTest, RecoverBasic) {
// If the Recovery handle goes out of scope without being
// Recovered(), the database is razed.
{
- scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
+ std::unique_ptr<sql::Recovery> recovery =
+ sql::Recovery::Begin(&db(), db_path());
ASSERT_TRUE(recovery.get());
}
EXPECT_FALSE(db().is_open());
@@ -95,7 +98,8 @@ TEST_F(SQLRecoveryTest, RecoverBasic) {
// Unrecoverable() also razes.
{
- scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
+ std::unique_ptr<sql::Recovery> recovery =
+ sql::Recovery::Begin(&db(), db_path());
ASSERT_TRUE(recovery.get());
sql::Recovery::Unrecoverable(std::move(recovery));
@@ -108,7 +112,8 @@ TEST_F(SQLRecoveryTest, RecoverBasic) {
// Attempting to recover a previously-recovered handle fails early.
{
- scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
+ std::unique_ptr<sql::Recovery> recovery =
+ sql::Recovery::Begin(&db(), db_path());
ASSERT_TRUE(recovery.get());
recovery.reset();
@@ -128,7 +133,8 @@ TEST_F(SQLRecoveryTest, RecoverBasic) {
// Recovered() replaces the original with the "recovered" version.
{
- scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
+ std::unique_ptr<sql::Recovery> recovery =
+ sql::Recovery::Begin(&db(), db_path());
ASSERT_TRUE(recovery.get());
// Create the new version of the table.
@@ -155,7 +161,8 @@ TEST_F(SQLRecoveryTest, RecoverBasic) {
// Rollback() discards recovery progress and leaves the database as it was.
{
- scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
+ std::unique_ptr<sql::Recovery> recovery =
+ sql::Recovery::Begin(&db(), db_path());
ASSERT_TRUE(recovery.get());
ASSERT_TRUE(recovery->db()->Execute(kCreateSql));
@@ -181,7 +188,8 @@ TEST_F(SQLRecoveryTest, VirtualTable) {
// Successfully recover the database.
{
- scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
+ std::unique_ptr<sql::Recovery> recovery =
+ sql::Recovery::Begin(&db(), db_path());
// Tables to recover original DB, now at [corrupt].
const char kRecoveryCreateSql[] =
@@ -221,7 +229,7 @@ void RecoveryCallback(sql::Connection* db, const base::FilePath& db_path,
// Clear the error callback to prevent reentrancy.
db->reset_error_callback();
- scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(db, db_path);
+ std::unique_ptr<sql::Recovery> recovery = sql::Recovery::Begin(db, db_path);
ASSERT_TRUE(recovery.get());
ASSERT_TRUE(recovery->db()->Execute(create_table));
@@ -386,7 +394,8 @@ TEST_F(SQLRecoveryTest, Meta) {
// Test expected case where everything works.
{
- scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
+ std::unique_ptr<sql::Recovery> recovery =
+ sql::Recovery::Begin(&db(), db_path());
EXPECT_TRUE(recovery->SetupMeta());
int version = 0;
EXPECT_TRUE(recovery->GetMetaVersionNumber(&version));
@@ -399,7 +408,8 @@ TEST_F(SQLRecoveryTest, Meta) {
// Test version row missing.
EXPECT_TRUE(db().Execute("DELETE FROM meta WHERE key = 'version'"));
{
- scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
+ std::unique_ptr<sql::Recovery> recovery =
+ sql::Recovery::Begin(&db(), db_path());
EXPECT_TRUE(recovery->SetupMeta());
int version = 0;
EXPECT_FALSE(recovery->GetMetaVersionNumber(&version));
@@ -414,7 +424,8 @@ TEST_F(SQLRecoveryTest, Meta) {
{
sql::ScopedErrorIgnorer ignore_errors;
ignore_errors.IgnoreError(SQLITE_CORRUPT); // From virtual table.
- scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
+ std::unique_ptr<sql::Recovery> recovery =
+ sql::Recovery::Begin(&db(), db_path());
EXPECT_FALSE(recovery->SetupMeta());
ASSERT_TRUE(ignore_errors.CheckIgnoredErrors());
}
@@ -439,7 +450,8 @@ TEST_F(SQLRecoveryTest, AutoRecoverTable) {
ASSERT_NE(orig_schema, GetSchema(&db()));
{
- scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
+ std::unique_ptr<sql::Recovery> recovery =
+ sql::Recovery::Begin(&db(), db_path());
ASSERT_TRUE(recovery->db()->Execute(kCreateSql));
// Save a copy of the temp db's schema before recovering the table.
@@ -466,7 +478,8 @@ TEST_F(SQLRecoveryTest, AutoRecoverTable) {
// Recovery fails if the target table doesn't exist.
{
- scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
+ std::unique_ptr<sql::Recovery> recovery =
+ sql::Recovery::Begin(&db(), db_path());
ASSERT_TRUE(recovery->db()->Execute(kCreateSql));
// TODO(shess): Should this failure implicitly lead to Raze()?
@@ -523,7 +536,8 @@ TEST_F(SQLRecoveryTest, AutoRecoverTableWithDefault) {
}
{
- scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
+ std::unique_ptr<sql::Recovery> recovery =
+ sql::Recovery::Begin(&db(), db_path());
// Different default to detect which table provides the default.
ASSERT_TRUE(recovery->db()->Execute(final_schema.c_str()));
@@ -560,7 +574,8 @@ TEST_F(SQLRecoveryTest, AutoRecoverTableNullFilter) {
ASSERT_NE(kOrigSchema, GetSchema(&db()));
{
- scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
+ std::unique_ptr<sql::Recovery> recovery =
+ sql::Recovery::Begin(&db(), db_path());
ASSERT_TRUE(recovery->db()->Execute(kFinalSchema));
size_t rows = 0;
@@ -599,7 +614,8 @@ TEST_F(SQLRecoveryTest, AutoRecoverTableWithRowid) {
ASSERT_NE(orig_schema, GetSchema(&db()));
{
- scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
+ std::unique_ptr<sql::Recovery> recovery =
+ sql::Recovery::Begin(&db(), db_path());
ASSERT_TRUE(recovery->db()->Execute(kCreateSql));
size_t rows = 0;
@@ -644,7 +660,8 @@ TEST_F(SQLRecoveryTest, AutoRecoverTableWithCompoundKey) {
ASSERT_NE(orig_schema, GetSchema(&db()));
{
- scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
+ std::unique_ptr<sql::Recovery> recovery =
+ sql::Recovery::Begin(&db(), db_path());
ASSERT_TRUE(recovery->db()->Execute(kCreateSql));
size_t rows = 0;
@@ -690,7 +707,8 @@ TEST_F(SQLRecoveryTest, AutoRecoverTableMissingColumns) {
// Recover the previous version of the table into the altered version.
{
- scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
+ std::unique_ptr<sql::Recovery> recovery =
+ sql::Recovery::Begin(&db(), db_path());
ASSERT_TRUE(recovery->db()->Execute(kCreateSql));
ASSERT_TRUE(recovery->db()->Execute(kAlterSql));
size_t rows = 0;
@@ -718,7 +736,8 @@ TEST_F(SQLRecoveryTest, Bug387868) {
ASSERT_TRUE(Reopen());
{
- scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
+ std::unique_ptr<sql::Recovery> recovery =
+ sql::Recovery::Begin(&db(), db_path());
ASSERT_TRUE(recovery.get());
// Create the new version of the table.
@@ -738,7 +757,8 @@ TEST_F(SQLRecoveryTest, Bug387868) {
// Memory-mapped I/O interacts poorly with I/O errors. Make sure the recovery
// database doesn't accidentally enable it.
TEST_F(SQLRecoveryTest, NoMmap) {
- scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
+ std::unique_ptr<sql::Recovery> recovery =
+ sql::Recovery::Begin(&db(), db_path());
ASSERT_TRUE(recovery.get());
// In the current implementation, the PRAGMA successfully runs with no result