OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/scoped_temp_dir.h" | 6 #include "base/scoped_temp_dir.h" |
7 #include "sql/connection.h" | 7 #include "sql/connection.h" |
8 #include "sql/statement.h" | 8 #include "sql/statement.h" |
9 #include "sql/meta_table.h" | 9 #include "sql/meta_table.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 } | 179 } |
180 | 180 |
181 { | 181 { |
182 sql::Statement s(db().GetUniqueStatement("SELECT * FROM sqlite_master")); | 182 sql::Statement s(db().GetUniqueStatement("SELECT * FROM sqlite_master")); |
183 ASSERT_FALSE(s.Step()); | 183 ASSERT_FALSE(s.Step()); |
184 } | 184 } |
185 | 185 |
186 { | 186 { |
187 sql::Statement s(db().GetUniqueStatement("PRAGMA auto_vacuum")); | 187 sql::Statement s(db().GetUniqueStatement("PRAGMA auto_vacuum")); |
188 ASSERT_TRUE(s.Step()); | 188 ASSERT_TRUE(s.Step()); |
189 // auto_vacuum must be preserved across a Raze. | 189 // The new database has the same auto_vacuum as a fresh database. |
190 EXPECT_EQ(pragma_auto_vacuum, s.ColumnInt(0)); | 190 EXPECT_EQ(pragma_auto_vacuum, s.ColumnInt(0)); |
191 } | 191 } |
192 } | 192 } |
193 | 193 |
194 // Test that Raze() maintains page_size. | 194 // Test that Raze() maintains page_size. |
195 TEST_F(SQLConnectionTest, RazePageSize) { | 195 TEST_F(SQLConnectionTest, RazePageSize) { |
196 // Fetch the default page size and double it for use in this test. | 196 // Fetch the default page size and double it for use in this test. |
197 // Scoped to release statement before Close(). | 197 // Scoped to release statement before Close(). |
198 int default_page_size = 0; | 198 int default_page_size = 0; |
199 { | 199 { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 // Otherwise, sqlite3 doesn't find the correct directory to store | 288 // Otherwise, sqlite3 doesn't find the correct directory to store |
289 // temporary files and will report the error 'unable to open | 289 // temporary files and will report the error 'unable to open |
290 // database file'. | 290 // database file'. |
291 ASSERT_TRUE(meta_table.Init(&db(), 4, 4)); | 291 ASSERT_TRUE(meta_table.Init(&db(), 4, 4)); |
292 } | 292 } |
293 #endif | 293 #endif |
294 | 294 |
295 // TODO(shess): Spin up a background thread to hold other_db, to more | 295 // TODO(shess): Spin up a background thread to hold other_db, to more |
296 // closely match real life. That would also allow testing | 296 // closely match real life. That would also allow testing |
297 // RazeWithTimeout(). | 297 // RazeWithTimeout(). |
OLD | NEW |