OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 size_t rows = 0; | 685 size_t rows = 0; |
686 EXPECT_TRUE(recovery->AutoRecoverTable("x", 0, &rows)); | 686 EXPECT_TRUE(recovery->AutoRecoverTable("x", 0, &rows)); |
687 EXPECT_EQ(43u, rows); | 687 EXPECT_EQ(43u, rows); |
688 | 688 |
689 // Successfully recovered. | 689 // Successfully recovered. |
690 EXPECT_TRUE(sql::Recovery::Recovered(recovery.Pass())); | 690 EXPECT_TRUE(sql::Recovery::Recovered(recovery.Pass())); |
691 } | 691 } |
692 } | 692 } |
693 #endif // !defined(USE_SYSTEM_SQLITE) | 693 #endif // !defined(USE_SYSTEM_SQLITE) |
694 | 694 |
| 695 // Memory-mapped I/O interacts poorly with I/O errors. Make sure the recovery |
| 696 // database doesn't accidentally enable it. |
| 697 TEST_F(SQLRecoveryTest, NoMmap) { |
| 698 scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path()); |
| 699 ASSERT_TRUE(recovery.get()); |
| 700 |
| 701 // In the current implementation, the PRAGMA successfully runs with no result |
| 702 // rows. Running with a single result of |0| is also acceptable. |
| 703 sql::Statement s(recovery->db()->GetUniqueStatement("PRAGMA mmap_size")); |
| 704 EXPECT_TRUE(!s.Step() || !s.ColumnInt64(0)); |
| 705 } |
| 706 |
695 } // namespace | 707 } // namespace |
OLD | NEW |