OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_ITEM_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_ITEM_IMPL_H_ |
6 #define CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_ITEM_IMPL_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_ITEM_IMPL_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "content/browser/download/download_create_info.h" | 9 #include "content/browser/download/download_create_info.h" |
10 #include "content/browser/download/download_file.h" | 10 #include "content/browser/download/download_file.h" |
11 #include "content/browser/download/download_item_impl.h" | 11 #include "content/browser/download/download_item_impl.h" |
12 #include "content/browser/download/download_request_handle.h" | 12 #include "content/browser/download/download_request_handle.h" |
13 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 | 16 |
17 class BrowserContext; | 17 class BrowserContext; |
18 class DownloadManager; | 18 class DownloadManager; |
19 class WebContents; | 19 class WebContents; |
20 | 20 |
21 class MockDownloadItemImpl : public DownloadItemImpl { | 21 class MockDownloadItemImpl : public DownloadItemImpl { |
22 public: | 22 public: |
23 // Use history constructor for minimal base object. | 23 // Use history constructor for minimal base object. |
24 explicit MockDownloadItemImpl(DownloadItemImplDelegate* delegate); | 24 explicit MockDownloadItemImpl(DownloadItemImplDelegate* delegate); |
25 MockDownloadItemImpl(DownloadItemImplDelegate* delegate, | 25 MockDownloadItemImpl(DownloadItemImplDelegate* delegate, |
26 const DownloadItem::ReceivedSlices& received_slices); | 26 const DownloadItem::ReceivedSlices& received_slices); |
27 ~MockDownloadItemImpl() override; | 27 ~MockDownloadItemImpl() override; |
28 | 28 |
29 MOCK_METHOD4(OnDownloadTargetDetermined, | 29 MOCK_METHOD5(OnDownloadTargetDetermined, |
30 void(const base::FilePath&, | 30 void(const base::FilePath&, |
31 TargetDisposition, | 31 TargetDisposition, |
32 DownloadDangerType, | 32 DownloadDangerType, |
33 const base::FilePath&)); | 33 const base::FilePath&, |
| 34 DownloadInterruptReason)); |
34 MOCK_METHOD1(AddObserver, void(DownloadItem::Observer*)); | 35 MOCK_METHOD1(AddObserver, void(DownloadItem::Observer*)); |
35 MOCK_METHOD1(RemoveObserver, void(DownloadItem::Observer*)); | 36 MOCK_METHOD1(RemoveObserver, void(DownloadItem::Observer*)); |
36 MOCK_METHOD0(UpdateObservers, void()); | 37 MOCK_METHOD0(UpdateObservers, void()); |
37 MOCK_METHOD0(CanShowInFolder, bool()); | 38 MOCK_METHOD0(CanShowInFolder, bool()); |
38 MOCK_METHOD0(CanOpenDownload, bool()); | 39 MOCK_METHOD0(CanOpenDownload, bool()); |
39 MOCK_METHOD0(ShouldOpenFileBasedOnExtension, bool()); | 40 MOCK_METHOD0(ShouldOpenFileBasedOnExtension, bool()); |
40 MOCK_METHOD0(OpenDownload, void()); | 41 MOCK_METHOD0(OpenDownload, void()); |
41 MOCK_METHOD0(ShowDownloadInShell, void()); | 42 MOCK_METHOD0(ShowDownloadInShell, void()); |
42 MOCK_METHOD0(ValidateDangerousDownload, void()); | 43 MOCK_METHOD0(ValidateDangerousDownload, void()); |
43 MOCK_METHOD2(StealDangerousDownload, void(bool, const AcquireFileCallback&)); | 44 MOCK_METHOD2(StealDangerousDownload, void(bool, const AcquireFileCallback&)); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 MOCK_CONST_METHOD0(GetWebContents, WebContents*()); | 112 MOCK_CONST_METHOD0(GetWebContents, WebContents*()); |
112 MOCK_CONST_METHOD0(GetFileNameToReportUser, base::FilePath()); | 113 MOCK_CONST_METHOD0(GetFileNameToReportUser, base::FilePath()); |
113 MOCK_METHOD1(SetDisplayName, void(const base::FilePath&)); | 114 MOCK_METHOD1(SetDisplayName, void(const base::FilePath&)); |
114 MOCK_METHOD0(NotifyRemoved, void()); | 115 MOCK_METHOD0(NotifyRemoved, void()); |
115 // May be called when vlog is on. | 116 // May be called when vlog is on. |
116 std::string DebugString(bool verbose) const override { return std::string(); } | 117 std::string DebugString(bool verbose) const override { return std::string(); } |
117 }; | 118 }; |
118 } // namespace content | 119 } // namespace content |
119 | 120 |
120 #endif // CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_ITEM_IMPL_H_ | 121 #endif // CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_ITEM_IMPL_H_ |
OLD | NEW |