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 <string> | |
asanka
2013/12/16 21:51:48
nit: not necessary in the .cc file since the decla
| |
8 | |
7 #include "content/browser/byte_stream.h" | 9 #include "content/browser/byte_stream.h" |
8 #include "content/browser/download/download_create_info.h" | 10 #include "content/browser/download/download_create_info.h" |
9 | 11 |
10 namespace content { | 12 namespace content { |
11 | 13 |
12 MockDownloadManager::CreateDownloadItemAdapter::CreateDownloadItemAdapter( | 14 MockDownloadManager::CreateDownloadItemAdapter::CreateDownloadItemAdapter( |
13 uint32 id, | 15 uint32 id, |
14 const base::FilePath& current_path, | 16 const base::FilePath& current_path, |
15 const base::FilePath& target_path, | 17 const base::FilePath& target_path, |
16 const std::vector<GURL>& url_chain, | 18 const std::vector<GURL>& url_chain, |
17 const GURL& referrer_url, | 19 const GURL& referrer_url, |
20 const std::string &mime_type, | |
21 const std::string &original_mime_type, | |
18 const base::Time& start_time, | 22 const base::Time& start_time, |
19 const base::Time& end_time, | 23 const base::Time& end_time, |
20 const std::string& etag, | 24 const std::string& etag, |
21 const std::string& last_modified, | 25 const std::string& last_modified, |
22 int64 received_bytes, | 26 int64 received_bytes, |
23 int64 total_bytes, | 27 int64 total_bytes, |
24 DownloadItem::DownloadState state, | 28 DownloadItem::DownloadState state, |
25 DownloadDangerType danger_type, | 29 DownloadDangerType danger_type, |
26 DownloadInterruptReason interrupt_reason, | 30 DownloadInterruptReason interrupt_reason, |
27 bool opened) | 31 bool opened) |
28 : id(id), | 32 : id(id), |
29 current_path(current_path), | 33 current_path(current_path), |
30 target_path(target_path), | 34 target_path(target_path), |
31 url_chain(url_chain), | 35 url_chain(url_chain), |
32 referrer_url(referrer_url), | 36 referrer_url(referrer_url), |
37 mime_type(mime_type), | |
38 original_mime_type(original_mime_type), | |
33 start_time(start_time), | 39 start_time(start_time), |
34 end_time(end_time), | 40 end_time(end_time), |
35 received_bytes(received_bytes), | 41 received_bytes(received_bytes), |
36 total_bytes(total_bytes), | 42 total_bytes(total_bytes), |
37 state(state), | 43 state(state), |
38 danger_type(danger_type), | 44 danger_type(danger_type), |
39 interrupt_reason(interrupt_reason), | 45 interrupt_reason(interrupt_reason), |
40 opened(opened) {} | 46 opened(opened) {} |
41 | 47 |
42 MockDownloadManager::CreateDownloadItemAdapter::CreateDownloadItemAdapter( | 48 MockDownloadManager::CreateDownloadItemAdapter::CreateDownloadItemAdapter( |
(...skipping 16 matching lines...) Expand all Loading... | |
59 | 65 |
60 MockDownloadManager::CreateDownloadItemAdapter::~CreateDownloadItemAdapter() {} | 66 MockDownloadManager::CreateDownloadItemAdapter::~CreateDownloadItemAdapter() {} |
61 | 67 |
62 bool MockDownloadManager::CreateDownloadItemAdapter::operator==( | 68 bool MockDownloadManager::CreateDownloadItemAdapter::operator==( |
63 const CreateDownloadItemAdapter& rhs) { | 69 const CreateDownloadItemAdapter& rhs) { |
64 return (id == rhs.id && | 70 return (id == rhs.id && |
65 current_path == rhs.current_path && | 71 current_path == rhs.current_path && |
66 target_path == rhs.target_path && | 72 target_path == rhs.target_path && |
67 url_chain == rhs.url_chain && | 73 url_chain == rhs.url_chain && |
68 referrer_url == rhs.referrer_url && | 74 referrer_url == rhs.referrer_url && |
75 mime_type == rhs.mime_type && | |
76 original_mime_type == rhs.original_mime_type && | |
69 start_time == rhs.start_time && | 77 start_time == rhs.start_time && |
70 end_time == rhs.end_time && | 78 end_time == rhs.end_time && |
71 etag == rhs.etag && | 79 etag == rhs.etag && |
72 last_modified == rhs.last_modified && | 80 last_modified == rhs.last_modified && |
73 received_bytes == rhs.received_bytes && | 81 received_bytes == rhs.received_bytes && |
74 total_bytes == rhs.total_bytes && | 82 total_bytes == rhs.total_bytes && |
75 state == rhs.state && | 83 state == rhs.state && |
76 danger_type == rhs.danger_type && | 84 danger_type == rhs.danger_type && |
77 interrupt_reason == rhs.interrupt_reason && | 85 interrupt_reason == rhs.interrupt_reason && |
78 opened == rhs.opened); | 86 opened == rhs.opened); |
79 } | 87 } |
80 | 88 |
81 MockDownloadManager::MockDownloadManager() {} | 89 MockDownloadManager::MockDownloadManager() {} |
82 | 90 |
83 MockDownloadManager::~MockDownloadManager() {} | 91 MockDownloadManager::~MockDownloadManager() {} |
84 | 92 |
85 void MockDownloadManager::StartDownload( | 93 void MockDownloadManager::StartDownload( |
86 scoped_ptr<DownloadCreateInfo> info, | 94 scoped_ptr<DownloadCreateInfo> info, |
87 scoped_ptr<ByteStreamReader> stream, | 95 scoped_ptr<ByteStreamReader> stream, |
88 const DownloadUrlParameters::OnStartedCallback& callback) { | 96 const DownloadUrlParameters::OnStartedCallback& callback) { |
89 MockStartDownload(info.get(), stream.get()); | 97 MockStartDownload(info.get(), stream.get()); |
90 } | 98 } |
91 | 99 |
92 DownloadItem* MockDownloadManager::CreateDownloadItem( | 100 DownloadItem* MockDownloadManager::CreateDownloadItem( |
93 uint32 id, | 101 uint32 id, |
94 const base::FilePath& current_path, | 102 const base::FilePath& current_path, |
95 const base::FilePath& target_path, | 103 const base::FilePath& target_path, |
96 const std::vector<GURL>& url_chain, | 104 const std::vector<GURL>& url_chain, |
97 const GURL& referrer_url, | 105 const GURL& referrer_url, |
106 const std::string &mime_type, | |
107 const std::string &original_mime_type, | |
98 const base::Time& start_time, | 108 const base::Time& start_time, |
99 const base::Time& end_time, | 109 const base::Time& end_time, |
100 const std::string& etag, | 110 const std::string& etag, |
101 const std::string& last_modified, | 111 const std::string& last_modified, |
102 int64 received_bytes, | 112 int64 received_bytes, |
103 int64 total_bytes, | 113 int64 total_bytes, |
104 DownloadItem::DownloadState state, | 114 DownloadItem::DownloadState state, |
105 DownloadDangerType danger_type, | 115 DownloadDangerType danger_type, |
106 DownloadInterruptReason interrupt_reason, | 116 DownloadInterruptReason interrupt_reason, |
107 bool opened) { | 117 bool opened) { |
108 CreateDownloadItemAdapter adapter( | 118 CreateDownloadItemAdapter adapter( |
109 id, current_path, target_path, url_chain, referrer_url, start_time, | 119 id, current_path, target_path, url_chain, referrer_url, |
120 mime_type, original_mime_type, | |
121 start_time, | |
110 end_time, etag, last_modified, received_bytes, total_bytes, state, | 122 end_time, etag, last_modified, received_bytes, total_bytes, state, |
111 danger_type, interrupt_reason, opened); | 123 danger_type, interrupt_reason, opened); |
112 return MockCreateDownloadItem(adapter); | 124 return MockCreateDownloadItem(adapter); |
113 } | 125 } |
114 | 126 |
115 } // namespace content | 127 } // namespace content |
OLD | NEW |