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

Side by Side Diff: content/browser/download/mock_download_item_impl.h

Issue 2689373003: Introduce ParallelDownloadJob. (Closed)
Patch Set: nits. Created 3 years, 9 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
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_ITEM_IMPL_H_
6 #define CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_ITEM_IMPL_H_
7
8 #include "base/macros.h"
9 #include "content/browser/download/download_create_info.h"
10 #include "content/browser/download/download_file.h"
11 #include "content/browser/download/download_item_impl.h"
12 #include "content/browser/download/download_request_handle.h"
13 #include "testing/gmock/include/gmock/gmock.h"
14
15 namespace content {
16
17 class BrowserContext;
18 class DownloadManager;
19 class WebContents;
20
21 class MockDownloadItemImpl : public DownloadItemImpl {
22 public:
23 // Use history constructor for minimal base object.
24 explicit MockDownloadItemImpl(DownloadItemImplDelegate* delegate);
25 ~MockDownloadItemImpl() override;
26
27 MOCK_METHOD4(OnDownloadTargetDetermined,
28 void(const base::FilePath&,
29 TargetDisposition,
30 DownloadDangerType,
31 const base::FilePath&));
32 MOCK_METHOD1(AddObserver, void(DownloadItem::Observer*));
33 MOCK_METHOD1(RemoveObserver, void(DownloadItem::Observer*));
34 MOCK_METHOD0(UpdateObservers, void());
35 MOCK_METHOD0(CanShowInFolder, bool());
36 MOCK_METHOD0(CanOpenDownload, bool());
37 MOCK_METHOD0(ShouldOpenFileBasedOnExtension, bool());
38 MOCK_METHOD0(OpenDownload, void());
39 MOCK_METHOD0(ShowDownloadInShell, void());
40 MOCK_METHOD0(ValidateDangerousDownload, void());
41 MOCK_METHOD2(StealDangerousDownload, void(bool, const AcquireFileCallback&));
42 MOCK_METHOD3(UpdateProgress, void(int64_t, int64_t, const std::string&));
43 MOCK_METHOD1(Cancel, void(bool));
44 MOCK_METHOD0(MarkAsComplete, void());
45 void OnAllDataSaved(int64_t, std::unique_ptr<crypto::SecureHash>) override {
46 NOTREACHED();
47 }
48 MOCK_METHOD0(OnDownloadedFileRemoved, void());
49 void Start(std::unique_ptr<DownloadFile> download_file,
50 std::unique_ptr<DownloadRequestHandleInterface> req_handle,
51 const DownloadCreateInfo& create_info) override {
52 MockStart(download_file.get(), req_handle.get());
53 }
54
55 MOCK_METHOD2(MockStart, void(DownloadFile*, DownloadRequestHandleInterface*));
56
57 MOCK_METHOD0(Remove, void());
58 MOCK_CONST_METHOD1(TimeRemaining, bool(base::TimeDelta*));
59 MOCK_CONST_METHOD0(CurrentSpeed, int64_t());
60 MOCK_CONST_METHOD0(PercentComplete, int());
61 MOCK_CONST_METHOD0(AllDataSaved, bool());
62 MOCK_CONST_METHOD1(MatchesQuery, bool(const base::string16& query));
63 MOCK_CONST_METHOD0(IsDone, bool());
64 MOCK_CONST_METHOD0(GetFullPath, const base::FilePath&());
65 MOCK_CONST_METHOD0(GetTargetFilePath, const base::FilePath&());
66 MOCK_CONST_METHOD0(GetTargetDisposition, TargetDisposition());
67 MOCK_METHOD1(OnContentCheckCompleted, void(DownloadDangerType));
68 MOCK_CONST_METHOD0(GetState, DownloadState());
69 MOCK_CONST_METHOD0(GetUrlChain, const std::vector<GURL>&());
70 MOCK_METHOD1(SetTotalBytes, void(int64_t));
71 MOCK_CONST_METHOD0(GetURL, const GURL&());
72 MOCK_CONST_METHOD0(GetOriginalUrl, const GURL&());
73 MOCK_CONST_METHOD0(GetReferrerUrl, const GURL&());
74 MOCK_CONST_METHOD0(GetTabUrl, const GURL&());
75 MOCK_CONST_METHOD0(GetTabReferrerUrl, const GURL&());
76 MOCK_CONST_METHOD0(GetSuggestedFilename, std::string());
77 MOCK_CONST_METHOD0(GetContentDisposition, std::string());
78 MOCK_CONST_METHOD0(GetMimeType, std::string());
79 MOCK_CONST_METHOD0(GetOriginalMimeType, std::string());
80 MOCK_CONST_METHOD0(GetReferrerCharset, std::string());
81 MOCK_CONST_METHOD0(GetRemoteAddress, std::string());
82 MOCK_CONST_METHOD0(GetTotalBytes, int64_t());
83 MOCK_CONST_METHOD0(GetReceivedBytes, int64_t());
84 MOCK_CONST_METHOD0(GetHashState, const std::string&());
85 MOCK_CONST_METHOD0(GetHash, const std::string&());
86 MOCK_CONST_METHOD0(GetId, uint32_t());
87 MOCK_CONST_METHOD0(GetGuid, const std::string&());
88 MOCK_CONST_METHOD0(GetStartTime, base::Time());
89 MOCK_CONST_METHOD0(GetEndTime, base::Time());
90 MOCK_METHOD0(GetDownloadManager, DownloadManager*());
91 MOCK_CONST_METHOD0(IsPaused, bool());
92 MOCK_CONST_METHOD0(GetOpenWhenComplete, bool());
93 MOCK_METHOD1(SetOpenWhenComplete, void(bool));
94 MOCK_CONST_METHOD0(GetFileExternallyRemoved, bool());
95 MOCK_CONST_METHOD0(GetDangerType, DownloadDangerType());
96 MOCK_CONST_METHOD0(IsDangerous, bool());
97 MOCK_METHOD0(GetAutoOpened, bool());
98 MOCK_CONST_METHOD0(GetForcedFilePath, const base::FilePath&());
99 MOCK_CONST_METHOD0(HasUserGesture, bool());
100 MOCK_CONST_METHOD0(GetTransitionType, ui::PageTransition());
101 MOCK_CONST_METHOD0(IsTemporary, bool());
102 MOCK_METHOD1(SetOpened, void(bool));
103 MOCK_CONST_METHOD0(GetOpened, bool());
104 MOCK_CONST_METHOD0(GetLastModifiedTime, const std::string&());
105 MOCK_CONST_METHOD0(GetETag, const std::string&());
106 MOCK_CONST_METHOD0(GetLastReason, DownloadInterruptReason());
107 MOCK_CONST_METHOD0(GetBrowserContext, BrowserContext*());
108 MOCK_CONST_METHOD0(GetWebContents, WebContents*());
109 MOCK_CONST_METHOD0(GetFileNameToReportUser, base::FilePath());
110 MOCK_METHOD1(SetDisplayName, void(const base::FilePath&));
111 MOCK_METHOD0(NotifyRemoved, void());
112 // May be called when vlog is on.
113 std::string DebugString(bool verbose) const override { return std::string(); }
114 };
115 } // namespace content
116
117 #endif // CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_ITEM_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/download/download_worker.cc ('k') | content/browser/download/mock_download_item_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698