| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 void RemoveItem(int id); | 227 void RemoveItem(int id); |
| 226 | 228 |
| 227 // Overridden methods from DownloadItemFactory. | 229 // Overridden methods from DownloadItemFactory. |
| 228 virtual DownloadItemImpl* CreatePersistedItem( | 230 virtual DownloadItemImpl* CreatePersistedItem( |
| 229 DownloadItemImplDelegate* delegate, | 231 DownloadItemImplDelegate* delegate, |
| 230 uint32 download_id, | 232 uint32 download_id, |
| 231 const base::FilePath& current_path, | 233 const base::FilePath& current_path, |
| 232 const base::FilePath& target_path, | 234 const base::FilePath& target_path, |
| 233 const std::vector<GURL>& url_chain, | 235 const std::vector<GURL>& url_chain, |
| 234 const GURL& referrer_url, | 236 const GURL& referrer_url, |
| 237 const std::string& mime_type, |
| 238 const std::string& original_mime_type, |
| 235 const base::Time& start_time, | 239 const base::Time& start_time, |
| 236 const base::Time& end_time, | 240 const base::Time& end_time, |
| 237 const std::string& etag, | 241 const std::string& etag, |
| 238 const std::string& last_modofied, | 242 const std::string& last_modofied, |
| 239 int64 received_bytes, | 243 int64 received_bytes, |
| 240 int64 total_bytes, | 244 int64 total_bytes, |
| 241 DownloadItem::DownloadState state, | 245 DownloadItem::DownloadState state, |
| 242 DownloadDangerType danger_type, | 246 DownloadDangerType danger_type, |
| 243 DownloadInterruptReason interrupt_reason, | 247 DownloadInterruptReason interrupt_reason, |
| 244 bool opened, | 248 bool opened, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 items_.erase(id); | 294 items_.erase(id); |
| 291 } | 295 } |
| 292 | 296 |
| 293 DownloadItemImpl* MockDownloadItemFactory::CreatePersistedItem( | 297 DownloadItemImpl* MockDownloadItemFactory::CreatePersistedItem( |
| 294 DownloadItemImplDelegate* delegate, | 298 DownloadItemImplDelegate* delegate, |
| 295 uint32 download_id, | 299 uint32 download_id, |
| 296 const base::FilePath& current_path, | 300 const base::FilePath& current_path, |
| 297 const base::FilePath& target_path, | 301 const base::FilePath& target_path, |
| 298 const std::vector<GURL>& url_chain, | 302 const std::vector<GURL>& url_chain, |
| 299 const GURL& referrer_url, | 303 const GURL& referrer_url, |
| 304 const std::string& mime_type, |
| 305 const std::string& original_mime_type, |
| 300 const base::Time& start_time, | 306 const base::Time& start_time, |
| 301 const base::Time& end_time, | 307 const base::Time& end_time, |
| 302 const std::string& etag, | 308 const std::string& etag, |
| 303 const std::string& last_modified, | 309 const std::string& last_modified, |
| 304 int64 received_bytes, | 310 int64 received_bytes, |
| 305 int64 total_bytes, | 311 int64 total_bytes, |
| 306 DownloadItem::DownloadState state, | 312 DownloadItem::DownloadState state, |
| 307 DownloadDangerType danger_type, | 313 DownloadDangerType danger_type, |
| 308 DownloadInterruptReason interrupt_reason, | 314 DownloadInterruptReason interrupt_reason, |
| 309 bool opened, | 315 bool opened, |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 .WillOnce(Return()); | 688 .WillOnce(Return()); |
| 683 EXPECT_CALL(GetMockDownloadItem(3), Remove()) | 689 EXPECT_CALL(GetMockDownloadItem(3), Remove()) |
| 684 .Times(0); | 690 .Times(0); |
| 685 | 691 |
| 686 download_manager_->RemoveAllDownloads(); | 692 download_manager_->RemoveAllDownloads(); |
| 687 // Because we're mocking the download item, the Remove call doesn't | 693 // Because we're mocking the download item, the Remove call doesn't |
| 688 // result in them being removed from the DownloadManager list. | 694 // result in them being removed from the DownloadManager list. |
| 689 } | 695 } |
| 690 | 696 |
| 691 } // namespace content | 697 } // namespace content |
| OLD | NEW |