| 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/public/test/mock_download_manager.h" | 5 #include "content/public/test/mock_download_manager.h" |
| 6 | 6 |
| 7 #include "content/browser/byte_stream.h" | 7 #include "content/browser/byte_stream.h" |
| 8 #include "content/browser/download/download_create_info.h" | 8 #include "content/browser/download/download_create_info.h" |
| 9 | 9 |
| 10 namespace content { | 10 namespace content { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 const std::string& etag, | 26 const std::string& etag, |
| 27 const std::string& last_modified, | 27 const std::string& last_modified, |
| 28 int64_t received_bytes, | 28 int64_t received_bytes, |
| 29 int64_t total_bytes, | 29 int64_t total_bytes, |
| 30 const std::string& hash, | 30 const std::string& hash, |
| 31 DownloadItem::DownloadState state, | 31 DownloadItem::DownloadState state, |
| 32 DownloadDangerType danger_type, | 32 DownloadDangerType danger_type, |
| 33 DownloadInterruptReason interrupt_reason, | 33 DownloadInterruptReason interrupt_reason, |
| 34 bool opened, | 34 bool opened, |
| 35 base::Time last_access_time, | 35 base::Time last_access_time, |
| 36 bool transient, |
| 36 const std::vector<DownloadItem::ReceivedSlice>& received_slices) | 37 const std::vector<DownloadItem::ReceivedSlice>& received_slices) |
| 37 : guid(guid), | 38 : guid(guid), |
| 38 id(id), | 39 id(id), |
| 39 current_path(current_path), | 40 current_path(current_path), |
| 40 target_path(target_path), | 41 target_path(target_path), |
| 41 url_chain(url_chain), | 42 url_chain(url_chain), |
| 42 referrer_url(referrer_url), | 43 referrer_url(referrer_url), |
| 43 site_url(site_url), | 44 site_url(site_url), |
| 44 tab_url(tab_url), | 45 tab_url(tab_url), |
| 45 tab_referrer_url(tab_referrer_url), | 46 tab_referrer_url(tab_referrer_url), |
| 46 mime_type(mime_type), | 47 mime_type(mime_type), |
| 47 original_mime_type(original_mime_type), | 48 original_mime_type(original_mime_type), |
| 48 start_time(start_time), | 49 start_time(start_time), |
| 49 end_time(end_time), | 50 end_time(end_time), |
| 50 received_bytes(received_bytes), | 51 received_bytes(received_bytes), |
| 51 total_bytes(total_bytes), | 52 total_bytes(total_bytes), |
| 52 hash(hash), | 53 hash(hash), |
| 53 state(state), | 54 state(state), |
| 54 danger_type(danger_type), | 55 danger_type(danger_type), |
| 55 interrupt_reason(interrupt_reason), | 56 interrupt_reason(interrupt_reason), |
| 56 opened(opened), | 57 opened(opened), |
| 57 last_access_time(last_access_time), | 58 last_access_time(last_access_time), |
| 59 transient(transient), |
| 58 received_slices(received_slices) {} | 60 received_slices(received_slices) {} |
| 59 | 61 |
| 60 MockDownloadManager::CreateDownloadItemAdapter::CreateDownloadItemAdapter( | 62 MockDownloadManager::CreateDownloadItemAdapter::CreateDownloadItemAdapter( |
| 61 const CreateDownloadItemAdapter& rhs) | 63 const CreateDownloadItemAdapter& rhs) |
| 62 : guid(rhs.guid), | 64 : guid(rhs.guid), |
| 63 id(rhs.id), | 65 id(rhs.id), |
| 64 current_path(rhs.current_path), | 66 current_path(rhs.current_path), |
| 65 target_path(rhs.target_path), | 67 target_path(rhs.target_path), |
| 66 url_chain(rhs.url_chain), | 68 url_chain(rhs.url_chain), |
| 67 referrer_url(rhs.referrer_url), | 69 referrer_url(rhs.referrer_url), |
| 68 site_url(rhs.site_url), | 70 site_url(rhs.site_url), |
| 69 tab_url(rhs.tab_url), | 71 tab_url(rhs.tab_url), |
| 70 tab_referrer_url(rhs.tab_referrer_url), | 72 tab_referrer_url(rhs.tab_referrer_url), |
| 71 start_time(rhs.start_time), | 73 start_time(rhs.start_time), |
| 72 end_time(rhs.end_time), | 74 end_time(rhs.end_time), |
| 73 etag(rhs.etag), | 75 etag(rhs.etag), |
| 74 last_modified(rhs.last_modified), | 76 last_modified(rhs.last_modified), |
| 75 received_bytes(rhs.received_bytes), | 77 received_bytes(rhs.received_bytes), |
| 76 total_bytes(rhs.total_bytes), | 78 total_bytes(rhs.total_bytes), |
| 77 state(rhs.state), | 79 state(rhs.state), |
| 78 danger_type(rhs.danger_type), | 80 danger_type(rhs.danger_type), |
| 79 interrupt_reason(rhs.interrupt_reason), | 81 interrupt_reason(rhs.interrupt_reason), |
| 80 opened(rhs.opened), | 82 opened(rhs.opened), |
| 81 last_access_time(rhs.last_access_time), | 83 last_access_time(rhs.last_access_time), |
| 84 transient(rhs.transient), |
| 82 received_slices(rhs.received_slices) {} | 85 received_slices(rhs.received_slices) {} |
| 83 | 86 |
| 84 MockDownloadManager::CreateDownloadItemAdapter::~CreateDownloadItemAdapter() {} | 87 MockDownloadManager::CreateDownloadItemAdapter::~CreateDownloadItemAdapter() {} |
| 85 | 88 |
| 86 bool MockDownloadManager::CreateDownloadItemAdapter::operator==( | 89 bool MockDownloadManager::CreateDownloadItemAdapter::operator==( |
| 87 const CreateDownloadItemAdapter& rhs) const { | 90 const CreateDownloadItemAdapter& rhs) const { |
| 88 return ( | 91 return ( |
| 89 guid == rhs.guid && id == rhs.id && current_path == rhs.current_path && | 92 guid == rhs.guid && id == rhs.id && current_path == rhs.current_path && |
| 90 target_path == rhs.target_path && url_chain == rhs.url_chain && | 93 target_path == rhs.target_path && url_chain == rhs.url_chain && |
| 91 referrer_url == rhs.referrer_url && site_url == rhs.site_url && | 94 referrer_url == rhs.referrer_url && site_url == rhs.site_url && |
| 92 tab_url == rhs.tab_url && tab_referrer_url == rhs.tab_referrer_url && | 95 tab_url == rhs.tab_url && tab_referrer_url == rhs.tab_referrer_url && |
| 93 mime_type == rhs.mime_type && | 96 mime_type == rhs.mime_type && |
| 94 original_mime_type == rhs.original_mime_type && | 97 original_mime_type == rhs.original_mime_type && |
| 95 start_time == rhs.start_time && end_time == rhs.end_time && | 98 start_time == rhs.start_time && end_time == rhs.end_time && |
| 96 etag == rhs.etag && last_modified == rhs.last_modified && | 99 etag == rhs.etag && last_modified == rhs.last_modified && |
| 97 received_bytes == rhs.received_bytes && total_bytes == rhs.total_bytes && | 100 received_bytes == rhs.received_bytes && total_bytes == rhs.total_bytes && |
| 98 state == rhs.state && danger_type == rhs.danger_type && | 101 state == rhs.state && danger_type == rhs.danger_type && |
| 99 interrupt_reason == rhs.interrupt_reason && opened == rhs.opened && | 102 interrupt_reason == rhs.interrupt_reason && opened == rhs.opened && |
| 100 last_access_time == rhs.last_access_time && | 103 last_access_time == rhs.last_access_time && transient == rhs.transient && |
| 101 received_slices == rhs.received_slices); | 104 received_slices == rhs.received_slices); |
| 102 } | 105 } |
| 103 | 106 |
| 104 MockDownloadManager::MockDownloadManager() {} | 107 MockDownloadManager::MockDownloadManager() {} |
| 105 | 108 |
| 106 MockDownloadManager::~MockDownloadManager() {} | 109 MockDownloadManager::~MockDownloadManager() {} |
| 107 | 110 |
| 108 void MockDownloadManager::StartDownload( | 111 void MockDownloadManager::StartDownload( |
| 109 std::unique_ptr<DownloadCreateInfo> info, | 112 std::unique_ptr<DownloadCreateInfo> info, |
| 110 std::unique_ptr<ByteStreamReader> stream, | 113 std::unique_ptr<ByteStreamReader> stream, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 129 const std::string& etag, | 132 const std::string& etag, |
| 130 const std::string& last_modified, | 133 const std::string& last_modified, |
| 131 int64_t received_bytes, | 134 int64_t received_bytes, |
| 132 int64_t total_bytes, | 135 int64_t total_bytes, |
| 133 const std::string& hash, | 136 const std::string& hash, |
| 134 DownloadItem::DownloadState state, | 137 DownloadItem::DownloadState state, |
| 135 DownloadDangerType danger_type, | 138 DownloadDangerType danger_type, |
| 136 DownloadInterruptReason interrupt_reason, | 139 DownloadInterruptReason interrupt_reason, |
| 137 bool opened, | 140 bool opened, |
| 138 base::Time last_access_time, | 141 base::Time last_access_time, |
| 142 bool transient, |
| 139 const std::vector<DownloadItem::ReceivedSlice>& received_slices) { | 143 const std::vector<DownloadItem::ReceivedSlice>& received_slices) { |
| 140 CreateDownloadItemAdapter adapter( | 144 CreateDownloadItemAdapter adapter( |
| 141 guid, id, current_path, target_path, url_chain, referrer_url, site_url, | 145 guid, id, current_path, target_path, url_chain, referrer_url, site_url, |
| 142 tab_url, tab_referrer_url, mime_type, original_mime_type, start_time, | 146 tab_url, tab_referrer_url, mime_type, original_mime_type, start_time, |
| 143 end_time, etag, last_modified, received_bytes, total_bytes, hash, state, | 147 end_time, etag, last_modified, received_bytes, total_bytes, hash, state, |
| 144 danger_type, interrupt_reason, opened, last_access_time, received_slices); | 148 danger_type, interrupt_reason, opened, last_access_time, transient, |
| 149 received_slices); |
| 145 return MockCreateDownloadItem(adapter); | 150 return MockCreateDownloadItem(adapter); |
| 146 } | 151 } |
| 147 | 152 |
| 148 } // namespace content | 153 } // namespace content |
| OLD | NEW |