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

Unified Diff: sql/connection_unittest.cc

Issue 10829062: Upstream sqlite gyp changes for Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added assert Created 8 years, 4 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 | « sql/connection.cc ('k') | third_party/sqlite/sqlite.gyp » ('j') | 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 565c12fb9ab113c781de7ebe4e29bd3edb530f8a..e50043fa940e731b9fe9dde503f5757cc60a2642 100644
--- a/sql/connection_unittest.cc
+++ b/sql/connection_unittest.cc
@@ -142,10 +142,21 @@ TEST_F(SQLConnectionTest, Raze) {
ASSERT_TRUE(db().Execute(kCreateSql));
ASSERT_TRUE(db().Execute("INSERT INTO foo (value) VALUES (12)"));
+ int pragma_auto_vacuum = 0;
+ {
+ sql::Statement s(db().GetUniqueStatement("PRAGMA auto_vacuum"));
+ ASSERT_TRUE(s.Step());
+ pragma_auto_vacuum = s.ColumnInt(0);
+ ASSERT_TRUE(pragma_auto_vacuum == 0 || pragma_auto_vacuum == 1);
+ }
+
+ // If auto_vacuum is set, there's an extra page to maintain a freelist.
+ const int kExpectedPageCount = 2 + pragma_auto_vacuum;
+
{
sql::Statement s(db().GetUniqueStatement("PRAGMA page_count"));
ASSERT_TRUE(s.Step());
- EXPECT_EQ(2, s.ColumnInt(0));
+ EXPECT_EQ(kExpectedPageCount, s.ColumnInt(0));
}
{
@@ -154,7 +165,8 @@ TEST_F(SQLConnectionTest, Raze) {
EXPECT_EQ("table", s.ColumnString(0));
EXPECT_EQ("foo", s.ColumnString(1));
EXPECT_EQ("foo", s.ColumnString(2));
- EXPECT_EQ(2, s.ColumnInt(3));
+ // Table "foo" is stored in the last page of the file.
+ EXPECT_EQ(kExpectedPageCount, s.ColumnInt(3));
EXPECT_EQ(kCreateSql, s.ColumnString(4));
}
@@ -170,6 +182,13 @@ TEST_F(SQLConnectionTest, Raze) {
sql::Statement s(db().GetUniqueStatement("SELECT * FROM sqlite_master"));
ASSERT_FALSE(s.Step());
}
+
+ {
+ sql::Statement s(db().GetUniqueStatement("PRAGMA auto_vacuum"));
+ ASSERT_TRUE(s.Step());
+ // auto_vacuum must be preserved across a Raze.
+ EXPECT_EQ(pragma_auto_vacuum, s.ColumnInt(0));
+ }
}
// Test that Raze() maintains page_size.
« no previous file with comments | « sql/connection.cc ('k') | third_party/sqlite/sqlite.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698