| 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> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
| 15 #include "base/files/scoped_temp_dir.h" | 15 #include "base/files/scoped_temp_dir.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
| 18 #include "content/public/test/mock_special_storage_policy.h" | 18 #include "content/public/test/mock_special_storage_policy.h" |
| 19 #include "sql/connection.h" | 19 #include "sql/connection.h" |
| 20 #include "sql/meta_table.h" | 20 #include "sql/meta_table.h" |
| 21 #include "sql/statement.h" | 21 #include "sql/statement.h" |
| 22 #include "sql/test/scoped_error_ignorer.h" | 22 #include "sql/test/scoped_error_expecter.h" |
| 23 #include "sql/test/test_helpers.h" | 23 #include "sql/test/test_helpers.h" |
| 24 #include "storage/browser/quota/quota_database.h" | 24 #include "storage/browser/quota/quota_database.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 26 #include "url/gurl.h" | 26 #include "url/gurl.h" |
| 27 | 27 |
| 28 using storage::kStorageTypePersistent; | 28 using storage::kStorageTypePersistent; |
| 29 using storage::kStorageTypeTemporary; | 29 using storage::kStorageTypeTemporary; |
| 30 using storage::QuotaDatabase; | 30 using storage::QuotaDatabase; |
| 31 | 31 |
| 32 namespace content { | 32 namespace content { |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 TEST_F(QuotaDatabaseTest, GetOriginInfo) { | 680 TEST_F(QuotaDatabaseTest, GetOriginInfo) { |
| 681 GetOriginInfo(base::FilePath()); | 681 GetOriginInfo(base::FilePath()); |
| 682 } | 682 } |
| 683 | 683 |
| 684 TEST_F(QuotaDatabaseTest, OpenCorruptedDatabase) { | 684 TEST_F(QuotaDatabaseTest, OpenCorruptedDatabase) { |
| 685 base::ScopedTempDir data_dir; | 685 base::ScopedTempDir data_dir; |
| 686 ASSERT_TRUE(data_dir.CreateUniqueTempDir()); | 686 ASSERT_TRUE(data_dir.CreateUniqueTempDir()); |
| 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 { |
| 691 ignore_errors.IgnoreError(SQLITE_CORRUPT); | 691 sql::test::ScopedErrorExpecter expecter; |
| 692 Reopen(kDbFile); | 692 expecter.ExpectError(SQLITE_CORRUPT); |
| 693 EXPECT_TRUE(ignore_errors.CheckIgnoredErrors()); | 693 Reopen(kDbFile); |
| 694 EXPECT_TRUE(expecter.SawExpectedErrors()); |
| 695 } |
| 694 } | 696 } |
| 695 | 697 |
| 696 } // namespace content | 698 } // namespace content |
| OLD | NEW |