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

Unified Diff: sql/connection_unittest.cc

Issue 2756843003: [sql] Tests for updates to mmap state. (Closed)
Patch Set: CREATE VIEW should match the one in connection.cc. 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..6ac4f8bc12d3d2739c865abf5edb59fb0167c0c0 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,12 +1599,19 @@ 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 (value) AS SELECT 1"));
+ 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"));
+ ASSERT_TRUE(db().Execute("CREATE VIEW MmapStatus (value) AS SELECT -2"));
ASSERT_EQ(0UL, db().GetAppropriateMmapSize());
EXPECT_EQ(base::IntToString(MetaTable::kMmapFailure),
ExecuteWithResult(&db(), "SELECT * FROM MmapStatus"));
« 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