| 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 "content/browser/download/download_manager_impl.h" | 5 #include "content/browser/download/download_manager_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 public: | 78 public: |
| 79 // Use history constructor for minimal base object. | 79 // Use history constructor for minimal base object. |
| 80 explicit MockDownloadItemImpl(DownloadItemImplDelegate* delegate) | 80 explicit MockDownloadItemImpl(DownloadItemImplDelegate* delegate) |
| 81 : DownloadItemImpl(delegate, | 81 : DownloadItemImpl(delegate, |
| 82 std::string("7d122682-55b5-4a47-a253-36cadc3e5bee"), | 82 std::string("7d122682-55b5-4a47-a253-36cadc3e5bee"), |
| 83 content::DownloadItem::kInvalidId, | 83 content::DownloadItem::kInvalidId, |
| 84 base::FilePath(), | 84 base::FilePath(), |
| 85 base::FilePath(), | 85 base::FilePath(), |
| 86 std::vector<GURL>(), | 86 std::vector<GURL>(), |
| 87 GURL(), | 87 GURL(), |
| 88 GURL(), |
| 89 GURL(), |
| 88 "application/octet-stream", | 90 "application/octet-stream", |
| 89 "application/octet-stream", | 91 "application/octet-stream", |
| 90 base::Time(), | 92 base::Time(), |
| 91 base::Time(), | 93 base::Time(), |
| 92 std::string(), | 94 std::string(), |
| 93 std::string(), | 95 std::string(), |
| 94 0, | 96 0, |
| 95 0, | 97 0, |
| 96 std::string(), | 98 std::string(), |
| 97 DownloadItem::COMPLETE, | 99 DownloadItem::COMPLETE, |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 244 |
| 243 // Overridden methods from DownloadItemFactory. | 245 // Overridden methods from DownloadItemFactory. |
| 244 DownloadItemImpl* CreatePersistedItem( | 246 DownloadItemImpl* CreatePersistedItem( |
| 245 DownloadItemImplDelegate* delegate, | 247 DownloadItemImplDelegate* delegate, |
| 246 const std::string& guid, | 248 const std::string& guid, |
| 247 uint32_t download_id, | 249 uint32_t download_id, |
| 248 const base::FilePath& current_path, | 250 const base::FilePath& current_path, |
| 249 const base::FilePath& target_path, | 251 const base::FilePath& target_path, |
| 250 const std::vector<GURL>& url_chain, | 252 const std::vector<GURL>& url_chain, |
| 251 const GURL& referrer_url, | 253 const GURL& referrer_url, |
| 254 const GURL& tab_url, |
| 255 const GURL& tab_referrer_url, |
| 252 const std::string& mime_type, | 256 const std::string& mime_type, |
| 253 const std::string& original_mime_type, | 257 const std::string& original_mime_type, |
| 254 const base::Time& start_time, | 258 const base::Time& start_time, |
| 255 const base::Time& end_time, | 259 const base::Time& end_time, |
| 256 const std::string& etag, | 260 const std::string& etag, |
| 257 const std::string& last_modofied, | 261 const std::string& last_modofied, |
| 258 int64_t received_bytes, | 262 int64_t received_bytes, |
| 259 int64_t total_bytes, | 263 int64_t total_bytes, |
| 260 const std::string& hash, | 264 const std::string& hash, |
| 261 DownloadItem::DownloadState state, | 265 DownloadItem::DownloadState state, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 } | 315 } |
| 312 | 316 |
| 313 DownloadItemImpl* MockDownloadItemFactory::CreatePersistedItem( | 317 DownloadItemImpl* MockDownloadItemFactory::CreatePersistedItem( |
| 314 DownloadItemImplDelegate* delegate, | 318 DownloadItemImplDelegate* delegate, |
| 315 const std::string& guid, | 319 const std::string& guid, |
| 316 uint32_t download_id, | 320 uint32_t download_id, |
| 317 const base::FilePath& current_path, | 321 const base::FilePath& current_path, |
| 318 const base::FilePath& target_path, | 322 const base::FilePath& target_path, |
| 319 const std::vector<GURL>& url_chain, | 323 const std::vector<GURL>& url_chain, |
| 320 const GURL& referrer_url, | 324 const GURL& referrer_url, |
| 325 const GURL& tab_url, |
| 326 const GURL& tab_referrer_url, |
| 321 const std::string& mime_type, | 327 const std::string& mime_type, |
| 322 const std::string& original_mime_type, | 328 const std::string& original_mime_type, |
| 323 const base::Time& start_time, | 329 const base::Time& start_time, |
| 324 const base::Time& end_time, | 330 const base::Time& end_time, |
| 325 const std::string& etag, | 331 const std::string& etag, |
| 326 const std::string& last_modified, | 332 const std::string& last_modified, |
| 327 int64_t received_bytes, | 333 int64_t received_bytes, |
| 328 int64_t total_bytes, | 334 int64_t total_bytes, |
| 329 const std::string& hash, | 335 const std::string& hash, |
| 330 DownloadItem::DownloadState state, | 336 DownloadItem::DownloadState state, |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 ASSERT_FALSE(download_manager_->GetDownloadByGuid("")); | 752 ASSERT_FALSE(download_manager_->GetDownloadByGuid("")); |
| 747 | 753 |
| 748 const char kGuid[] = "8DF158E8-C980-4618-BB03-EBA3242EB48B"; | 754 const char kGuid[] = "8DF158E8-C980-4618-BB03-EBA3242EB48B"; |
| 749 DownloadItem* persisted_item = download_manager_->CreateDownloadItem( | 755 DownloadItem* persisted_item = download_manager_->CreateDownloadItem( |
| 750 kGuid, | 756 kGuid, |
| 751 10, | 757 10, |
| 752 base::FilePath(), | 758 base::FilePath(), |
| 753 base::FilePath(), | 759 base::FilePath(), |
| 754 std::vector<GURL>(), | 760 std::vector<GURL>(), |
| 755 GURL("http://example.com/a"), | 761 GURL("http://example.com/a"), |
| 762 GURL("http://example.com/a"), |
| 763 GURL("http://example.com/a"), |
| 756 "application/octet-stream", | 764 "application/octet-stream", |
| 757 "application/octet-stream", | 765 "application/octet-stream", |
| 758 base::Time::Now(), | 766 base::Time::Now(), |
| 759 base::Time::Now(), | 767 base::Time::Now(), |
| 760 std::string(), | 768 std::string(), |
| 761 std::string(), | 769 std::string(), |
| 762 10, | 770 10, |
| 763 10, | 771 10, |
| 764 std::string(), | 772 std::string(), |
| 765 DownloadItem::INTERRUPTED, | 773 DownloadItem::INTERRUPTED, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 793 EXPECT_CALL(GetMockDownloadItem(1), Remove()).Times(0); | 801 EXPECT_CALL(GetMockDownloadItem(1), Remove()).Times(0); |
| 794 | 802 |
| 795 base::Callback<bool(const GURL&)> url_filter = | 803 base::Callback<bool(const GURL&)> url_filter = |
| 796 GetSingleURLFilter(download_urls_[0]); | 804 GetSingleURLFilter(download_urls_[0]); |
| 797 int remove_count = download_manager_->RemoveDownloadsByURLAndTime( | 805 int remove_count = download_manager_->RemoveDownloadsByURLAndTime( |
| 798 url_filter, base::Time(), base::Time::Max()); | 806 url_filter, base::Time(), base::Time::Max()); |
| 799 EXPECT_EQ(remove_count, 1); | 807 EXPECT_EQ(remove_count, 1); |
| 800 } | 808 } |
| 801 | 809 |
| 802 } // namespace content | 810 } // namespace content |
| OLD | NEW |