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 13 matching lines...) Expand all Loading... |
24 const base::Time& start_time, | 24 const base::Time& start_time, |
25 const base::Time& end_time, | 25 const base::Time& end_time, |
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 const base::Time& last_access_time) |
35 : guid(guid), | 36 : guid(guid), |
36 id(id), | 37 id(id), |
37 current_path(current_path), | 38 current_path(current_path), |
38 target_path(target_path), | 39 target_path(target_path), |
39 url_chain(url_chain), | 40 url_chain(url_chain), |
40 referrer_url(referrer_url), | 41 referrer_url(referrer_url), |
41 site_url(site_url), | 42 site_url(site_url), |
42 tab_url(tab_url), | 43 tab_url(tab_url), |
43 tab_referrer_url(tab_referrer_url), | 44 tab_referrer_url(tab_referrer_url), |
44 mime_type(mime_type), | 45 mime_type(mime_type), |
45 original_mime_type(original_mime_type), | 46 original_mime_type(original_mime_type), |
46 start_time(start_time), | 47 start_time(start_time), |
47 end_time(end_time), | 48 end_time(end_time), |
48 received_bytes(received_bytes), | 49 received_bytes(received_bytes), |
49 total_bytes(total_bytes), | 50 total_bytes(total_bytes), |
50 hash(hash), | 51 hash(hash), |
51 state(state), | 52 state(state), |
52 danger_type(danger_type), | 53 danger_type(danger_type), |
53 interrupt_reason(interrupt_reason), | 54 interrupt_reason(interrupt_reason), |
54 opened(opened) {} | 55 opened(opened), |
| 56 last_access_time(last_access_time) {} |
55 | 57 |
56 MockDownloadManager::CreateDownloadItemAdapter::CreateDownloadItemAdapter( | 58 MockDownloadManager::CreateDownloadItemAdapter::CreateDownloadItemAdapter( |
57 const CreateDownloadItemAdapter& rhs) | 59 const CreateDownloadItemAdapter& rhs) |
58 : guid(rhs.guid), | 60 : guid(rhs.guid), |
59 id(rhs.id), | 61 id(rhs.id), |
60 current_path(rhs.current_path), | 62 current_path(rhs.current_path), |
61 target_path(rhs.target_path), | 63 target_path(rhs.target_path), |
62 url_chain(rhs.url_chain), | 64 url_chain(rhs.url_chain), |
63 referrer_url(rhs.referrer_url), | 65 referrer_url(rhs.referrer_url), |
64 site_url(rhs.site_url), | 66 site_url(rhs.site_url), |
65 tab_url(rhs.tab_url), | 67 tab_url(rhs.tab_url), |
66 tab_referrer_url(rhs.tab_referrer_url), | 68 tab_referrer_url(rhs.tab_referrer_url), |
67 start_time(rhs.start_time), | 69 start_time(rhs.start_time), |
68 end_time(rhs.end_time), | 70 end_time(rhs.end_time), |
69 etag(rhs.etag), | 71 etag(rhs.etag), |
70 last_modified(rhs.last_modified), | 72 last_modified(rhs.last_modified), |
71 received_bytes(rhs.received_bytes), | 73 received_bytes(rhs.received_bytes), |
72 total_bytes(rhs.total_bytes), | 74 total_bytes(rhs.total_bytes), |
73 state(rhs.state), | 75 state(rhs.state), |
74 danger_type(rhs.danger_type), | 76 danger_type(rhs.danger_type), |
75 interrupt_reason(rhs.interrupt_reason), | 77 interrupt_reason(rhs.interrupt_reason), |
76 opened(rhs.opened) {} | 78 opened(rhs.opened), |
| 79 last_access_time(rhs.last_access_time) {} |
77 | 80 |
78 MockDownloadManager::CreateDownloadItemAdapter::~CreateDownloadItemAdapter() {} | 81 MockDownloadManager::CreateDownloadItemAdapter::~CreateDownloadItemAdapter() {} |
79 | 82 |
80 bool MockDownloadManager::CreateDownloadItemAdapter::operator==( | 83 bool MockDownloadManager::CreateDownloadItemAdapter::operator==( |
81 const CreateDownloadItemAdapter& rhs) const { | 84 const CreateDownloadItemAdapter& rhs) const { |
82 return ( | 85 return ( |
83 guid == rhs.guid && id == rhs.id && current_path == rhs.current_path && | 86 guid == rhs.guid && id == rhs.id && current_path == rhs.current_path && |
84 target_path == rhs.target_path && url_chain == rhs.url_chain && | 87 target_path == rhs.target_path && url_chain == rhs.url_chain && |
85 referrer_url == rhs.referrer_url && site_url == rhs.site_url && | 88 referrer_url == rhs.referrer_url && site_url == rhs.site_url && |
86 tab_url == rhs.tab_url && tab_referrer_url == rhs.tab_referrer_url && | 89 tab_url == rhs.tab_url && tab_referrer_url == rhs.tab_referrer_url && |
87 mime_type == rhs.mime_type && | 90 mime_type == rhs.mime_type && |
88 original_mime_type == rhs.original_mime_type && | 91 original_mime_type == rhs.original_mime_type && |
89 start_time == rhs.start_time && end_time == rhs.end_time && | 92 start_time == rhs.start_time && end_time == rhs.end_time && |
90 etag == rhs.etag && last_modified == rhs.last_modified && | 93 etag == rhs.etag && last_modified == rhs.last_modified && |
91 received_bytes == rhs.received_bytes && total_bytes == rhs.total_bytes && | 94 received_bytes == rhs.received_bytes && total_bytes == rhs.total_bytes && |
92 state == rhs.state && danger_type == rhs.danger_type && | 95 state == rhs.state && danger_type == rhs.danger_type && |
93 interrupt_reason == rhs.interrupt_reason && opened == rhs.opened); | 96 interrupt_reason == rhs.interrupt_reason && opened == rhs.opened && |
| 97 last_access_time == rhs.last_access_time); |
94 } | 98 } |
95 | 99 |
96 MockDownloadManager::MockDownloadManager() {} | 100 MockDownloadManager::MockDownloadManager() {} |
97 | 101 |
98 MockDownloadManager::~MockDownloadManager() {} | 102 MockDownloadManager::~MockDownloadManager() {} |
99 | 103 |
100 void MockDownloadManager::StartDownload( | 104 void MockDownloadManager::StartDownload( |
101 std::unique_ptr<DownloadCreateInfo> info, | 105 std::unique_ptr<DownloadCreateInfo> info, |
102 std::unique_ptr<ByteStreamReader> stream, | 106 std::unique_ptr<ByteStreamReader> stream, |
103 const DownloadUrlParameters::OnStartedCallback& callback) { | 107 const DownloadUrlParameters::OnStartedCallback& callback) { |
(...skipping 15 matching lines...) Expand all Loading... |
119 const base::Time& start_time, | 123 const base::Time& start_time, |
120 const base::Time& end_time, | 124 const base::Time& end_time, |
121 const std::string& etag, | 125 const std::string& etag, |
122 const std::string& last_modified, | 126 const std::string& last_modified, |
123 int64_t received_bytes, | 127 int64_t received_bytes, |
124 int64_t total_bytes, | 128 int64_t total_bytes, |
125 const std::string& hash, | 129 const std::string& hash, |
126 DownloadItem::DownloadState state, | 130 DownloadItem::DownloadState state, |
127 DownloadDangerType danger_type, | 131 DownloadDangerType danger_type, |
128 DownloadInterruptReason interrupt_reason, | 132 DownloadInterruptReason interrupt_reason, |
129 bool opened) { | 133 bool opened, |
| 134 const base::Time& last_access_time) { |
130 CreateDownloadItemAdapter adapter( | 135 CreateDownloadItemAdapter adapter( |
131 guid, id, current_path, target_path, url_chain, referrer_url, site_url, | 136 guid, id, current_path, target_path, url_chain, referrer_url, site_url, |
132 tab_url, tab_referrer_url, mime_type, original_mime_type, start_time, | 137 tab_url, tab_referrer_url, mime_type, original_mime_type, start_time, |
133 end_time, etag, last_modified, received_bytes, total_bytes, hash, state, | 138 end_time, etag, last_modified, received_bytes, total_bytes, hash, state, |
134 danger_type, interrupt_reason, opened); | 139 danger_type, interrupt_reason, opened, last_access_time); |
135 return MockCreateDownloadItem(adapter); | 140 return MockCreateDownloadItem(adapter); |
136 } | 141 } |
137 | 142 |
138 } // namespace content | 143 } // namespace content |
OLD | NEW |