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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/download/mock_download_file.h"
6
7 MockDownloadFile::MockDownloadFile(
8 const DownloadCreateInfo* info,
9 const DownloadRequestHandle& request_handle,
10 DownloadManager* download_manager)
11 : id_(1),
12 request_handle_(request_handle),
13 download_manager_(download_manager) {
14 }
15
16 MockDownloadFile::~MockDownloadFile() {
17 }
18
19 net::Error MockDownloadFile::Initialize(bool calculate_hash) {
20 return net::OK;
21 }
22
23 net::Error MockDownloadFile::AppendDataToFile(
24 const char* data, size_t data_len) {
25 return net::OK;
26 }
27
28 net::Error MockDownloadFile::Rename(const FilePath& full_path) {
29 return net::OK;
30 }
31
32 void MockDownloadFile::Detach() {
33 }
34
35 void MockDownloadFile::Cancel() {
36 }
37
38 void MockDownloadFile::Finish() {
39 }
40
41 void MockDownloadFile::AnnotateWithSourceInformation() {
42 }
43
44 FilePath MockDownloadFile::FullPath() const {
45 return FilePath();
46 }
47
48 bool MockDownloadFile::InProgress() const {
49 return true;
50 }
51
52 int64 MockDownloadFile::BytesSoFar() const {
53 return 0;
54 }
55
56 bool GetSha256Hash(std::string* hash) {
57 return false;
58 }
59
60 // DownloadFileInterface implementation.
61 void MockDownloadFile::CancelDownloadRequest() {
62 }
63
64 int MockDownloadFile::Id() const {
65 return id_;
66 }
67
68 DownloadManager* MockDownloadFile::GetDownloadManager() {
69 return NULL;
70 }
71
72 std::string MockDownloadFile::DebugString() const {
73 return "";
74 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698