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

Side by Side Diff: content/browser/download/mock_download_file.cc

Issue 8404049: Added member data to classes to support download resumption. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated comment. Created 9 years 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/download/mock_download_file.h" 5 #include "content/browser/download/mock_download_file.h"
6 6
7 #include "content/browser/download/download_create_info.h" 7 #include "content/browser/download/download_create_info.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 MockDownloadFile::StatisticsRecorder::StatisticsRecorder() { 10 MockDownloadFile::StatisticsRecorder::StatisticsRecorder() {
(...skipping 26 matching lines...) Expand all
37 request_handle_(request_handle), 37 request_handle_(request_handle),
38 download_manager_(download_manager), 38 download_manager_(download_manager),
39 recorder_(recorder), 39 recorder_(recorder),
40 rename_count_(0), 40 rename_count_(0),
41 in_progress_(true) { 41 in_progress_(true) {
42 } 42 }
43 43
44 MockDownloadFile::~MockDownloadFile() { 44 MockDownloadFile::~MockDownloadFile() {
45 } 45 }
46 46
47 net::Error MockDownloadFile::Initialize(bool calculate_hash) { 47 net::Error MockDownloadFile::Initialize() {
48 in_progress_ = true; 48 in_progress_ = true;
49 if (recorder_) 49 if (recorder_)
50 recorder_->Record(StatisticsRecorder::STAT_INITIALIZE); 50 recorder_->Record(StatisticsRecorder::STAT_INITIALIZE);
51 return net::OK; 51 return net::OK;
52 } 52 }
53 53
54 net::Error MockDownloadFile::AppendDataToFile( 54 net::Error MockDownloadFile::AppendDataToFile(
55 const char* data, size_t data_len) { 55 const char* data, size_t data_len) {
56 data_.append(data, data_len); 56 data_.append(data, data_len);
57 if (recorder_) { 57 if (recorder_) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 100 }
101 101
102 int64 MockDownloadFile::BytesSoFar() const { 102 int64 MockDownloadFile::BytesSoFar() const {
103 return data_.length(); 103 return data_.length();
104 } 104 }
105 105
106 int64 MockDownloadFile::CurrentSpeed() const { 106 int64 MockDownloadFile::CurrentSpeed() const {
107 return 0; 107 return 0;
108 } 108 }
109 109
110 bool MockDownloadFile::GetSha256Hash(std::string* hash) { 110 bool MockDownloadFile::GetHash(std::string* hash) {
111 return false; 111 return false;
112 } 112 }
113 113
114 std::string MockDownloadFile::GetHashState() {
115 return "";
116 }
117
114 // DownloadFileInterface implementation. 118 // DownloadFileInterface implementation.
115 void MockDownloadFile::CancelDownloadRequest() { 119 void MockDownloadFile::CancelDownloadRequest() {
116 } 120 }
117 121
118 int MockDownloadFile::Id() const { 122 int MockDownloadFile::Id() const {
119 return id_.local(); 123 return id_.local();
120 } 124 }
121 125
122 DownloadManager* MockDownloadFile::GetDownloadManager() { 126 DownloadManager* MockDownloadFile::GetDownloadManager() {
123 return download_manager_; 127 return download_manager_;
124 } 128 }
125 129
126 const DownloadId& MockDownloadFile::GlobalId() const { 130 const DownloadId& MockDownloadFile::GlobalId() const {
127 return id_; 131 return id_;
128 } 132 }
129 133
130 std::string MockDownloadFile::DebugString() const { 134 std::string MockDownloadFile::DebugString() const {
131 return ""; 135 return "";
132 } 136 }
133 137
134 void MockDownloadFile::SetExpectedPath(size_t index, const FilePath& path) { 138 void MockDownloadFile::SetExpectedPath(size_t index, const FilePath& path) {
135 if (expected_rename_path_list_.size() < index + 1) 139 if (expected_rename_path_list_.size() < index + 1)
136 expected_rename_path_list_.resize(index + 1); 140 expected_rename_path_list_.resize(index + 1);
137 expected_rename_path_list_[index] = path; 141 expected_rename_path_list_[index] = path;
138 } 142 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698