OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <iterator> | 9 #include <iterator> |
10 #include <set> | 10 #include <set> |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 return false; | 528 return false; |
529 db->Preload(); | 529 db->Preload(); |
530 return true; | 530 return true; |
531 } | 531 } |
532 | 532 |
533 // Create V2 database and populate some data. | 533 // Create V2 database and populate some data. |
534 void CreateV2Database( | 534 void CreateV2Database( |
535 const base::FilePath& kDbFile, | 535 const base::FilePath& kDbFile, |
536 const QuotaTableEntry* entries, | 536 const QuotaTableEntry* entries, |
537 size_t entries_size) { | 537 size_t entries_size) { |
538 scoped_ptr<sql::Connection> db(new sql::Connection); | 538 std::unique_ptr<sql::Connection> db(new sql::Connection); |
539 scoped_ptr<sql::MetaTable> meta_table(new sql::MetaTable); | 539 std::unique_ptr<sql::MetaTable> meta_table(new sql::MetaTable); |
540 | 540 |
541 // V2 schema definitions. | 541 // V2 schema definitions. |
542 static const int kCurrentVersion = 2; | 542 static const int kCurrentVersion = 2; |
543 static const int kCompatibleVersion = 2; | 543 static const int kCompatibleVersion = 2; |
544 static const char kHostQuotaTable[] = "HostQuotaTable"; | 544 static const char kHostQuotaTable[] = "HostQuotaTable"; |
545 static const char kOriginLastAccessTable[] = "OriginLastAccessTable"; | 545 static const char kOriginLastAccessTable[] = "OriginLastAccessTable"; |
546 static const QuotaDatabase::TableSchema kTables[] = { | 546 static const QuotaDatabase::TableSchema kTables[] = { |
547 { kHostQuotaTable, | 547 { kHostQuotaTable, |
548 "(host TEXT NOT NULL," | 548 "(host TEXT NOT NULL," |
549 " type INTEGER NOT NULL," | 549 " type INTEGER NOT NULL," |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 const base::FilePath kDbFile = data_dir.path().AppendASCII(kDBFileName); | 687 const base::FilePath kDbFile = data_dir.path().AppendASCII(kDBFileName); |
688 LazyOpen(kDbFile); | 688 LazyOpen(kDbFile); |
689 ASSERT_TRUE(sql::test::CorruptSizeInHeader(kDbFile)); | 689 ASSERT_TRUE(sql::test::CorruptSizeInHeader(kDbFile)); |
690 sql::ScopedErrorIgnorer ignore_errors; | 690 sql::ScopedErrorIgnorer ignore_errors; |
691 ignore_errors.IgnoreError(SQLITE_CORRUPT); | 691 ignore_errors.IgnoreError(SQLITE_CORRUPT); |
692 Reopen(kDbFile); | 692 Reopen(kDbFile); |
693 EXPECT_TRUE(ignore_errors.CheckIgnoredErrors()); | 693 EXPECT_TRUE(ignore_errors.CheckIgnoredErrors()); |
694 } | 694 } |
695 | 695 |
696 } // namespace content | 696 } // namespace content |
OLD | NEW |