OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <set> | 5 #include <set> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 public: | 69 public: |
70 // Use history constructor for minimal base object. | 70 // Use history constructor for minimal base object. |
71 explicit MockDownloadItemImpl(DownloadItemImplDelegate* delegate) | 71 explicit MockDownloadItemImpl(DownloadItemImplDelegate* delegate) |
72 : DownloadItemImpl( | 72 : DownloadItemImpl( |
73 delegate, | 73 delegate, |
74 content::DownloadItem::kInvalidId, | 74 content::DownloadItem::kInvalidId, |
75 base::FilePath(), | 75 base::FilePath(), |
76 base::FilePath(), | 76 base::FilePath(), |
77 std::vector<GURL>(), | 77 std::vector<GURL>(), |
78 GURL(), | 78 GURL(), |
| 79 "application/octet-stream", |
| 80 "application/octet-stream", |
79 base::Time(), | 81 base::Time(), |
80 base::Time(), | 82 base::Time(), |
81 std::string(), | 83 std::string(), |
82 std::string(), | 84 std::string(), |
83 0, | 85 0, |
84 0, | 86 0, |
85 DownloadItem::COMPLETE, | 87 DownloadItem::COMPLETE, |
86 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, | 88 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, |
87 DOWNLOAD_INTERRUPT_REASON_NONE, | 89 DOWNLOAD_INTERRUPT_REASON_NONE, |
88 false, | 90 false, |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 void RemoveItem(int id); | 229 void RemoveItem(int id); |
228 | 230 |
229 // Overridden methods from DownloadItemFactory. | 231 // Overridden methods from DownloadItemFactory. |
230 virtual DownloadItemImpl* CreatePersistedItem( | 232 virtual DownloadItemImpl* CreatePersistedItem( |
231 DownloadItemImplDelegate* delegate, | 233 DownloadItemImplDelegate* delegate, |
232 uint32 download_id, | 234 uint32 download_id, |
233 const base::FilePath& current_path, | 235 const base::FilePath& current_path, |
234 const base::FilePath& target_path, | 236 const base::FilePath& target_path, |
235 const std::vector<GURL>& url_chain, | 237 const std::vector<GURL>& url_chain, |
236 const GURL& referrer_url, | 238 const GURL& referrer_url, |
| 239 const std::string& mime_type, |
| 240 const std::string& original_mime_type, |
237 const base::Time& start_time, | 241 const base::Time& start_time, |
238 const base::Time& end_time, | 242 const base::Time& end_time, |
239 const std::string& etag, | 243 const std::string& etag, |
240 const std::string& last_modofied, | 244 const std::string& last_modofied, |
241 int64 received_bytes, | 245 int64 received_bytes, |
242 int64 total_bytes, | 246 int64 total_bytes, |
243 DownloadItem::DownloadState state, | 247 DownloadItem::DownloadState state, |
244 DownloadDangerType danger_type, | 248 DownloadDangerType danger_type, |
245 DownloadInterruptReason interrupt_reason, | 249 DownloadInterruptReason interrupt_reason, |
246 bool opened, | 250 bool opened, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 items_.erase(id); | 296 items_.erase(id); |
293 } | 297 } |
294 | 298 |
295 DownloadItemImpl* MockDownloadItemFactory::CreatePersistedItem( | 299 DownloadItemImpl* MockDownloadItemFactory::CreatePersistedItem( |
296 DownloadItemImplDelegate* delegate, | 300 DownloadItemImplDelegate* delegate, |
297 uint32 download_id, | 301 uint32 download_id, |
298 const base::FilePath& current_path, | 302 const base::FilePath& current_path, |
299 const base::FilePath& target_path, | 303 const base::FilePath& target_path, |
300 const std::vector<GURL>& url_chain, | 304 const std::vector<GURL>& url_chain, |
301 const GURL& referrer_url, | 305 const GURL& referrer_url, |
| 306 const std::string& mime_type, |
| 307 const std::string& original_mime_type, |
302 const base::Time& start_time, | 308 const base::Time& start_time, |
303 const base::Time& end_time, | 309 const base::Time& end_time, |
304 const std::string& etag, | 310 const std::string& etag, |
305 const std::string& last_modified, | 311 const std::string& last_modified, |
306 int64 received_bytes, | 312 int64 received_bytes, |
307 int64 total_bytes, | 313 int64 total_bytes, |
308 DownloadItem::DownloadState state, | 314 DownloadItem::DownloadState state, |
309 DownloadDangerType danger_type, | 315 DownloadDangerType danger_type, |
310 DownloadInterruptReason interrupt_reason, | 316 DownloadInterruptReason interrupt_reason, |
311 bool opened, | 317 bool opened, |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 .WillOnce(Return()); | 702 .WillOnce(Return()); |
697 EXPECT_CALL(GetMockDownloadItem(3), Remove()) | 703 EXPECT_CALL(GetMockDownloadItem(3), Remove()) |
698 .Times(0); | 704 .Times(0); |
699 | 705 |
700 download_manager_->RemoveAllDownloads(); | 706 download_manager_->RemoveAllDownloads(); |
701 // Because we're mocking the download item, the Remove call doesn't | 707 // Because we're mocking the download item, the Remove call doesn't |
702 // result in them being removed from the DownloadManager list. | 708 // result in them being removed from the DownloadManager list. |
703 } | 709 } |
704 | 710 |
705 } // namespace content | 711 } // namespace content |
OLD | NEW |