Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: sql/recovery_unittest.cc

Issue 1414563010: [sql] Disable memory-mapping under sql::Recovery. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« sql/connection.cc ('K') | « sql/recovery.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« sql/connection.cc ('K') | « sql/recovery.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698