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

Unified Diff: sql/connection_unittest.cc

Issue 17058004: [sql] Static helper to delete database and all associated files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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') | 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 2aaeb27b33371d8249a70c85dd31d6a6e885266e..e0ea6a21f89e7ec5ff90f55897456ddc6e7dcb6a 100644
--- a/sql/connection_unittest.cc
+++ b/sql/connection_unittest.cc
@@ -397,3 +397,18 @@ TEST_F(SQLConnectionTest, SetTempDirForSQL) {
ASSERT_TRUE(meta_table.Init(&db(), 4, 4));
}
#endif
+
+TEST_F(SQLConnectionTest, Delete) {
+ EXPECT_TRUE(db().Execute("CREATE TABLE x (x)"));
+ db().Close();
+
+ // Should have both a main database file and a journal file because
+ // of journal_mode PERSIST.
+ base::FilePath journal(db_path().value() + FILE_PATH_LITERAL("-journal"));
+ ASSERT_TRUE(file_util::PathExists(db_path()));
+ ASSERT_TRUE(file_util::PathExists(journal));
+
+ sql::Connection::Delete(db_path());
+ EXPECT_FALSE(file_util::PathExists(db_path()));
+ EXPECT_FALSE(file_util::PathExists(journal));
+}
« no previous file with comments | « sql/connection.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698