Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1786)

Side by Side Diff: content/public/test/mock_download_manager.cc

Issue 11363222: Persist download interrupt reason, both target and current paths, and url_chain. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged to r180302 Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/download/byte_stream.h" 7 #include "content/browser/download/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 {
11 11
12 void PrintTo(const DownloadRequestHandle& params, std::ostream* os) { 12 MockDownloadManager::CreateDownloadItemAdapter::CreateDownloadItemAdapter(
13 const FilePath& current_path,
14 const FilePath& target_path,
15 const std::vector<GURL>& url_chain,
16 const GURL& referrer_url,
17 const base::Time& start_time,
18 const base::Time& end_time,
19 int64 received_bytes,
20 int64 total_bytes,
21 DownloadItem::DownloadState state,
22 DownloadDangerType danger_type,
23 DownloadInterruptReason interrupt_reason,
24 bool opened)
25 : current_path(current_path),
26 target_path(target_path),
27 url_chain(url_chain),
28 referrer_url(referrer_url),
29 start_time(start_time),
30 end_time(end_time),
31 received_bytes(received_bytes),
32 total_bytes(total_bytes),
33 state(state),
34 danger_type(danger_type),
35 interrupt_reason(interrupt_reason),
36 opened(opened) {}
37
38 MockDownloadManager::CreateDownloadItemAdapter::CreateDownloadItemAdapter(
39 const CreateDownloadItemAdapter& rhs)
40 : current_path(rhs.current_path),
41 target_path(rhs.target_path),
42 url_chain(rhs.url_chain),
43 referrer_url(rhs.referrer_url),
44 start_time(rhs.start_time),
45 end_time(rhs.end_time),
46 received_bytes(rhs.received_bytes),
47 total_bytes(rhs.total_bytes),
48 state(rhs.state),
49 danger_type(rhs.danger_type),
50 interrupt_reason(rhs.interrupt_reason),
51 opened(rhs.opened) {}
52
53 MockDownloadManager::CreateDownloadItemAdapter::~CreateDownloadItemAdapter() {}
54
55 bool MockDownloadManager::CreateDownloadItemAdapter::operator==(
56 const CreateDownloadItemAdapter& rhs) {
57 return (current_path == rhs.current_path &&
58 target_path == rhs.target_path &&
59 url_chain == rhs.url_chain &&
60 referrer_url == rhs.referrer_url &&
61 start_time == rhs.start_time &&
62 end_time == rhs.end_time &&
63 received_bytes == rhs.received_bytes &&
64 total_bytes == rhs.total_bytes &&
65 state == rhs.state &&
66 danger_type == rhs.danger_type &&
67 interrupt_reason == rhs.interrupt_reason &&
68 opened == opened);
13 } 69 }
14 70
15 MockDownloadManager::MockDownloadManager() {} 71 MockDownloadManager::MockDownloadManager() {}
16 72
17 MockDownloadManager::~MockDownloadManager() {} 73 MockDownloadManager::~MockDownloadManager() {}
18 74
19 DownloadItem* MockDownloadManager::StartDownload( 75 DownloadItem* MockDownloadManager::StartDownload(
20 scoped_ptr<DownloadCreateInfo> info, 76 scoped_ptr<DownloadCreateInfo> info,
21 scoped_ptr<ByteStreamReader> stream) { 77 scoped_ptr<ByteStreamReader> stream) {
22 return MockStartDownload(info.get(), stream.get()); 78 return MockStartDownload(info.get(), stream.get());
23 } 79 }
24 80
81 DownloadItem* MockDownloadManager::CreateDownloadItem(
82 const FilePath& current_path,
83 const FilePath& target_path,
84 const std::vector<GURL>& url_chain,
85 const GURL& referrer_url,
86 const base::Time& start_time,
87 const base::Time& end_time,
88 int64 received_bytes,
89 int64 total_bytes,
90 DownloadItem::DownloadState state,
91 DownloadDangerType danger_type,
92 DownloadInterruptReason interrupt_reason,
93 bool opened) {
94 CreateDownloadItemAdapter adapter(
95 current_path, target_path, url_chain, referrer_url, start_time,
96 end_time, received_bytes, total_bytes, state, danger_type,
97 interrupt_reason, opened);
98 return MockCreateDownloadItem(adapter);
99 }
100
25 } // namespace content 101 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/mock_download_manager.h ('k') | content/test/net/url_request_slow_download_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698