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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sql/connection.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/files/scoped_temp_dir.h" 6 #include "base/files/scoped_temp_dir.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "sql/connection.h" 8 #include "sql/connection.h"
9 #include "sql/meta_table.h" 9 #include "sql/meta_table.h"
10 #include "sql/statement.h" 10 #include "sql/statement.h"
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 390
391 sql::MetaTable meta_table; 391 sql::MetaTable meta_table;
392 // Below call needs a temporary directory in sqlite3 392 // Below call needs a temporary directory in sqlite3
393 // On Android, it can pass only when the temporary directory is set. 393 // On Android, it can pass only when the temporary directory is set.
394 // Otherwise, sqlite3 doesn't find the correct directory to store 394 // Otherwise, sqlite3 doesn't find the correct directory to store
395 // temporary files and will report the error 'unable to open 395 // temporary files and will report the error 'unable to open
396 // database file'. 396 // database file'.
397 ASSERT_TRUE(meta_table.Init(&db(), 4, 4)); 397 ASSERT_TRUE(meta_table.Init(&db(), 4, 4));
398 } 398 }
399 #endif 399 #endif
400
401 TEST_F(SQLConnectionTest, Delete) {
402 EXPECT_TRUE(db().Execute("CREATE TABLE x (x)"));
403 db().Close();
404
405 // Should have both a main database file and a journal file because
406 // of journal_mode PERSIST.
407 base::FilePath journal(db_path().value() + FILE_PATH_LITERAL("-journal"));
408 ASSERT_TRUE(file_util::PathExists(db_path()));
409 ASSERT_TRUE(file_util::PathExists(journal));
410
411 sql::Connection::Delete(db_path());
412 EXPECT_FALSE(file_util::PathExists(db_path()));
413 EXPECT_FALSE(file_util::PathExists(journal));
414 }
OLDNEW
« 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