Chromium Code Reviews| Index: sql/connection_unittest.cc |
| diff --git a/sql/connection_unittest.cc b/sql/connection_unittest.cc |
| index a08456e36a86eeb62330761ed2dad06dc80aa949..09324772ed326ce50648d6a429c61fbd237e6d8f 100644 |
| --- a/sql/connection_unittest.cc |
| +++ b/sql/connection_unittest.cc |
| @@ -1546,6 +1546,12 @@ TEST_F(SQLConnectionTest, GetAppropriateMmapSize) { |
| ASSERT_TRUE(MetaTable::GetMmapStatus(&db(), &mmap_status)); |
| ASSERT_EQ(MetaTable::kMmapSuccess, mmap_status); |
| + // Preload with partial progress of one page. Should map everything. |
| + ASSERT_TRUE(db().Execute("REPLACE INTO meta VALUES ('mmap_status', 1)")); |
| + ASSERT_GT(db().GetAppropriateMmapSize(), kMmapAlot); |
| + ASSERT_TRUE(MetaTable::GetMmapStatus(&db(), &mmap_status)); |
| + ASSERT_EQ(MetaTable::kMmapSuccess, mmap_status); |
| + |
| // Failure status maps nothing. |
| ASSERT_TRUE(db().Execute("REPLACE INTO meta VALUES ('mmap_status', -2)")); |
| ASSERT_EQ(0UL, db().GetAppropriateMmapSize()); |
| @@ -1593,9 +1599,16 @@ TEST_F(SQLConnectionTest, GetAppropriateMmapSizeAltStatus) { |
| EXPECT_EQ(base::IntToString(MetaTable::kMmapSuccess), |
| ExecuteWithResult(&db(), "SELECT * FROM MmapStatus")); |
| - // Also maps everything when kMmapSuccess is in the view. |
| + // Also maps everything when kMmapSuccess is already in the view. |
| ASSERT_GT(db().GetAppropriateMmapSize(), kMmapAlot); |
| + // Preload with partial progress of one page. Should map everything. |
| + ASSERT_TRUE(db().Execute("DROP VIEW MmapStatus")); |
| + ASSERT_TRUE(db().Execute("CREATE VIEW MmapStatus AS SELECT 1")); |
|
pavely
2017/03/17 23:21:35
nit: When Connection::SetMmapAltStatus creates vie
Scott Hess - ex-Googler
2017/03/19 23:47:15
Good point. I'm changing the variant a few lines
|
| + ASSERT_GT(db().GetAppropriateMmapSize(), kMmapAlot); |
| + EXPECT_EQ(base::IntToString(MetaTable::kMmapSuccess), |
| + ExecuteWithResult(&db(), "SELECT * FROM MmapStatus")); |
| + |
| // Failure status leads to nothing being mapped. |
| ASSERT_TRUE(db().Execute("DROP VIEW MmapStatus")); |
| ASSERT_TRUE(db().Execute("CREATE VIEW MmapStatus AS SELECT -2")); |