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

Unified Diff: webkit/fileapi/file_system_database_test_helper.cc

Issue 13946004: FileAPI: Run database recovery on IOError. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: +comment, +test for other db files Created 7 years, 8 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 | « webkit/fileapi/file_system_database_test_helper.h ('k') | webkit/fileapi/file_system_directory_database.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/fileapi/file_system_database_test_helper.cc
diff --git a/webkit/fileapi/file_system_database_test_helper.cc b/webkit/fileapi/file_system_database_test_helper.cc
index da1a5e13a28135a79a57caac5220f18e5a4913dc..a8da1a757f63ad49a5d8315d0492ef1aaea0b985 100644
--- a/webkit/fileapi/file_system_database_test_helper.cc
+++ b/webkit/fileapi/file_system_database_test_helper.cc
@@ -79,4 +79,23 @@ void CorruptDatabase(const base::FilePath& db_path,
base::ClosePlatformFile(file);
}
+void DeleteDatabaseFile(const base::FilePath& db_path,
+ leveldb::FileType type) {
+ file_util::FileEnumerator file_enum(db_path, false /* not recursive */,
+ file_util::FileEnumerator::DIRECTORIES |
+ file_util::FileEnumerator::FILES);
+ base::FilePath file_path;
+ while (!(file_path = file_enum.Next()).empty()) {
+ uint64 number = kuint64max;
+ leveldb::FileType file_type;
+ EXPECT_TRUE(leveldb::ParseFileName(FilePathToString(file_path.BaseName()),
+ &number, &file_type));
+ if (file_type == type) {
+ file_util::Delete(file_path, false);
+ // We may have multiple files for the same type, so don't break here.
+ }
+ }
+
+}
+
} // namespace fileapi
« no previous file with comments | « webkit/fileapi/file_system_database_test_helper.h ('k') | webkit/fileapi/file_system_directory_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698