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

Unified Diff: content/test/test_file_error_injector.cc

Issue 10696043: Shifted DownloadFile to exporting DownloadInterruptReasons. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync'd to TOT. Created 8 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 | « content/public/test/test_file_error_injector.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/test_file_error_injector.cc
diff --git a/content/test/test_file_error_injector.cc b/content/test/test_file_error_injector.cc
index 790647c3e99f8be0895e5f2e5def7640cf96e4d4..3af526aa9b7719ed83fa7452bfde9136af0925bc 100644
--- a/content/test/test_file_error_injector.cc
+++ b/content/test/test_file_error_injector.cc
@@ -11,6 +11,7 @@
#include "content/browser/download/download_create_info.h"
#include "content/browser/download/download_file_impl.h"
#include "content/browser/download/download_file_manager.h"
+#include "content/browser/download/download_interrupt_reasons_impl.h"
#include "content/browser/power_save_blocker.h"
#include "content/browser/renderer_host/resource_dispatcher_host_impl.h"
#include "content/public/browser/browser_thread.h"
@@ -51,16 +52,17 @@ class DownloadFileWithErrors: public DownloadFileImpl {
~DownloadFileWithErrors();
// DownloadFile interface.
- virtual net::Error Initialize() OVERRIDE;
- virtual net::Error AppendDataToFile(const char* data,
- size_t data_len) OVERRIDE;
- virtual net::Error Rename(const FilePath& full_path) OVERRIDE;
+ virtual content::DownloadInterruptReason Initialize() OVERRIDE;
+ virtual content::DownloadInterruptReason AppendDataToFile(
+ const char* data, size_t data_len) OVERRIDE;
+ virtual content::DownloadInterruptReason Rename(
+ const FilePath& full_path) OVERRIDE;
private:
// Error generating helper.
- net::Error ShouldReturnError(
+ content::DownloadInterruptReason ShouldReturnError(
content::TestFileErrorInjector::FileOperationCode code,
- net::Error original_net_error);
+ content::DownloadInterruptReason original_error);
// Source URL for the file being downloaded.
GURL source_url_;
@@ -103,48 +105,51 @@ DownloadFileWithErrors::~DownloadFileWithErrors() {
destruction_callback_.Run(source_url_);
}
-net::Error DownloadFileWithErrors::Initialize() {
+content::DownloadInterruptReason DownloadFileWithErrors::Initialize() {
return ShouldReturnError(
- content::TestFileErrorInjector::FILE_OPERATION_INITIALIZE,
- DownloadFileImpl::Initialize());
+ content::TestFileErrorInjector::FILE_OPERATION_INITIALIZE,
+ DownloadFileImpl::Initialize());
}
-net::Error DownloadFileWithErrors::AppendDataToFile(const char* data,
- size_t data_len) {
+content::DownloadInterruptReason DownloadFileWithErrors::AppendDataToFile(
+ const char* data, size_t data_len) {
return ShouldReturnError(
content::TestFileErrorInjector::FILE_OPERATION_WRITE,
DownloadFileImpl::AppendDataToFile(data, data_len));
}
-net::Error DownloadFileWithErrors::Rename(const FilePath& full_path) {
+content::DownloadInterruptReason DownloadFileWithErrors::Rename(
+ const FilePath& full_path) {
return ShouldReturnError(
content::TestFileErrorInjector::FILE_OPERATION_RENAME,
DownloadFileImpl::Rename(full_path));
}
-net::Error DownloadFileWithErrors::ShouldReturnError(
+content::DownloadInterruptReason DownloadFileWithErrors::ShouldReturnError(
content::TestFileErrorInjector::FileOperationCode code,
- net::Error original_net_error) {
+ content::DownloadInterruptReason original_error) {
int counter = operation_counter_[code];
++operation_counter_[code];
if (code != error_info_.code)
- return original_net_error;
+ return original_error;
if (counter != error_info_.operation_instance)
- return original_net_error;
+ return original_error;
VLOG(1) << " " << __FUNCTION__ << "()"
<< " url = '" << source_url_.spec() << "'"
<< " code = " << content::TestFileErrorInjector::DebugString(code)
<< " (" << code << ")"
<< " counter = " << counter
- << " original_error = " << net::ErrorToString(original_net_error)
- << " (" << original_net_error << ")"
- << " new error = " << net::ErrorToString(error_info_.net_error)
- << " (" << error_info_.net_error << ")";
-
- return error_info_.net_error;
+ << " original_error = "
+ << content::InterruptReasonDebugString(original_error)
+ << " (" << original_error << ")"
+ << " new error = "
+ << content::InterruptReasonDebugString(error_info_.error)
+ << " (" << error_info_.error << ")";
+
+ return error_info_.error;
}
} // namespace
@@ -207,7 +212,7 @@ content::DownloadFile* DownloadFileWithErrorsFactory::CreateFile(
url,
TestFileErrorInjector::FILE_OPERATION_INITIALIZE,
-1,
- net::OK
+ content::DOWNLOAD_INTERRUPT_REASON_NONE
};
injected_errors_[url] = err_info;
}
« no previous file with comments | « content/public/test/test_file_error_injector.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698