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

Unified Diff: sql/connection_unittest.cc

Issue 2756843003: [sql] Tests for updates to mmap state. (Closed)
Patch Set: Created 3 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698