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

Unified Diff: content/browser/download/mock_download_file.cc

Issue 8372034: Created an interface for DownloadFile, for use in unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up download file interface and unit test class. Created 9 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
Index: content/browser/download/mock_download_file.cc
diff --git a/content/browser/download/mock_download_file.cc b/content/browser/download/mock_download_file.cc
new file mode 100755
index 0000000000000000000000000000000000000000..300c76676f9daf41c69a5844de7100e32afcd4ca
--- /dev/null
+++ b/content/browser/download/mock_download_file.cc
@@ -0,0 +1,74 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/download/mock_download_file.h"
+
+MockDownloadFile::MockDownloadFile(
+ const DownloadCreateInfo* info,
+ const DownloadRequestHandle& request_handle,
+ DownloadManager* download_manager)
+ : id_(1),
+ request_handle_(request_handle),
+ download_manager_(download_manager) {
+}
+
+MockDownloadFile::~MockDownloadFile() {
+}
+
+net::Error MockDownloadFile::Initialize(bool calculate_hash) {
+ return net::OK;
+}
+
+net::Error MockDownloadFile::AppendDataToFile(
+ const char* data, size_t data_len) {
+ return net::OK;
+}
+
+net::Error MockDownloadFile::Rename(const FilePath& full_path) {
+ return net::OK;
+}
+
+void MockDownloadFile::Detach() {
+}
+
+void MockDownloadFile::Cancel() {
+}
+
+void MockDownloadFile::Finish() {
+}
+
+void MockDownloadFile::AnnotateWithSourceInformation() {
+}
+
+FilePath MockDownloadFile::FullPath() const {
+ return FilePath();
+}
+
+bool MockDownloadFile::InProgress() const {
+ return true;
+}
+
+int64 MockDownloadFile::BytesSoFar() const {
+ return 0;
+}
+
+bool GetSha256Hash(std::string* hash) {
+ return false;
+}
+
+// DownloadFileInterface implementation.
+void MockDownloadFile::CancelDownloadRequest() {
+}
+
+int MockDownloadFile::Id() const {
+ return id_;
+}
+
+DownloadManager* MockDownloadFile::GetDownloadManager() {
+ return NULL;
+}
+
+std::string MockDownloadFile::DebugString() const {
+ return "";
+}

Powered by Google App Engine
This is Rietveld 408576698