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

Unified Diff: content/public/test/test_file_error_injector.cc

Issue 11366121: Split DownloadFile::Rename into RenameAndUniquify and RenameAndAnnotate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync to LKGR. Created 8 years, 1 month 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 | « content/public/test/test_file_error_injector.h ('k') | content/shell/shell_download_manager_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/test_file_error_injector.cc
diff --git a/content/public/test/test_file_error_injector.cc b/content/public/test/test_file_error_injector.cc
index 321390596d79f06db5f804f6dbd795189f259956..30206bd1c9d0bea184d7085d71a424d9db8081b8 100644
--- a/content/public/test/test_file_error_injector.cc
+++ b/content/public/test/test_file_error_injector.cc
@@ -49,9 +49,12 @@ class DownloadFileWithErrors: public DownloadFileImpl {
// DownloadFile interface.
virtual DownloadInterruptReason AppendDataToFile(
const char* data, size_t data_len) OVERRIDE;
- virtual void Rename(const FilePath& full_path,
- bool overwrite_existing_file,
- const RenameCompletionCallback& callback) OVERRIDE;
+ virtual void RenameAndUniquify(
+ const FilePath& full_path,
+ const RenameCompletionCallback& callback) OVERRIDE;
+ virtual void RenameAndAnnotate(
+ const FilePath& full_path,
+ const RenameCompletionCallback& callback) OVERRIDE;
private:
// Error generating helper.
@@ -150,22 +153,38 @@ DownloadInterruptReason DownloadFileWithErrors::AppendDataToFile(
DownloadFileImpl::AppendDataToFile(data, data_len));
}
-void DownloadFileWithErrors::Rename(
+void DownloadFileWithErrors::RenameAndUniquify(
const FilePath& full_path,
- bool overwrite_existing_file,
const RenameCompletionCallback& callback) {
DownloadInterruptReason error_to_return = DOWNLOAD_INTERRUPT_REASON_NONE;
RenameCompletionCallback callback_to_use = callback;
// Replace callback if the error needs to be overwritten.
if (OverwriteError(
- TestFileErrorInjector::FILE_OPERATION_RENAME,
+ TestFileErrorInjector::FILE_OPERATION_RENAME_UNIQUIFY,
&error_to_return)) {
callback_to_use = base::Bind(&RenameErrorCallback, callback,
error_to_return);
}
- DownloadFileImpl::Rename(full_path, overwrite_existing_file, callback_to_use);
+ DownloadFileImpl::RenameAndUniquify(full_path, callback_to_use);
+}
+
+void DownloadFileWithErrors::RenameAndAnnotate(
+ const FilePath& full_path,
+ const RenameCompletionCallback& callback) {
+ DownloadInterruptReason error_to_return = DOWNLOAD_INTERRUPT_REASON_NONE;
+ RenameCompletionCallback callback_to_use = callback;
+
+ // Replace callback if the error needs to be overwritten.
+ if (OverwriteError(
+ TestFileErrorInjector::FILE_OPERATION_RENAME_ANNOTATE,
+ &error_to_return)) {
+ callback_to_use = base::Bind(&RenameErrorCallback, callback,
+ error_to_return);
+ }
+
+ DownloadFileImpl::RenameAndAnnotate(full_path, callback_to_use);
}
bool DownloadFileWithErrors::OverwriteError(
@@ -415,8 +434,10 @@ std::string TestFileErrorInjector::DebugString(FileOperationCode code) {
return "INITIALIZE";
case FILE_OPERATION_WRITE:
return "WRITE";
- case FILE_OPERATION_RENAME:
- return "RENAME";
+ case FILE_OPERATION_RENAME_UNIQUIFY:
+ return "RENAME_UNIQUIFY";
+ case FILE_OPERATION_RENAME_ANNOTATE:
+ return "RENAME_ANNOTATE";
default:
break;
}
« no previous file with comments | « content/public/test/test_file_error_injector.h ('k') | content/shell/shell_download_manager_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698