OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CHROME_BROWSER_NTP_SNIPPETS_FAKE_DOWNLOAD_ITEM_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_FAKE_DOWNLOAD_ITEM_H_ |
6 #define CHROME_BROWSER_NTP_SNIPPETS_FAKE_DOWNLOAD_ITEM_H_ | 6 #define CONTENT_PUBLIC_TEST_FAKE_DOWNLOAD_ITEM_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
14 #include "content/public/browser/download_danger_type.h" | 14 #include "content/public/browser/download_danger_type.h" |
15 #include "content/public/browser/download_interrupt_reasons.h" | 15 #include "content/public/browser/download_interrupt_reasons.h" |
16 #include "content/public/browser/download_item.h" | 16 #include "content/public/browser/download_item.h" |
17 #include "ui/base/page_transition_types.h" | 17 #include "ui/base/page_transition_types.h" |
18 #include "url/gurl.h" | 18 #include "url/gurl.h" |
19 | 19 |
20 namespace test { | 20 namespace content { |
21 | 21 |
22 class FakeDownloadItem : public content::DownloadItem { | 22 class FakeDownloadItem : public DownloadItem { |
23 public: | 23 public: |
24 FakeDownloadItem(); | 24 FakeDownloadItem(); |
25 ~FakeDownloadItem() override; | 25 ~FakeDownloadItem() override; |
26 | 26 |
27 void AddObserver(Observer* observer) override; | 27 void AddObserver(Observer* observer) override; |
28 | 28 |
29 void RemoveObserver(Observer* observer) override; | 29 void RemoveObserver(Observer* observer) override; |
30 | 30 |
31 void NotifyDownloadDestroyed(); | 31 void NotifyDownloadDestroyed(); |
32 | 32 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // The methods below are not supported and are not expected to be called. | 69 // The methods below are not supported and are not expected to be called. |
70 void ValidateDangerousDownload() override; | 70 void ValidateDangerousDownload() override; |
71 void StealDangerousDownload(bool delete_file_afterward, | 71 void StealDangerousDownload(bool delete_file_afterward, |
72 const AcquireFileCallback& callback) override; | 72 const AcquireFileCallback& callback) override; |
73 void Pause() override; | 73 void Pause() override; |
74 void Resume() override; | 74 void Resume() override; |
75 void Cancel(bool user_cancel) override; | 75 void Cancel(bool user_cancel) override; |
76 void Remove() override; | 76 void Remove() override; |
77 void OpenDownload() override; | 77 void OpenDownload() override; |
78 void ShowDownloadInShell() override; | 78 void ShowDownloadInShell() override; |
79 content::DownloadInterruptReason GetLastReason() const override; | 79 DownloadInterruptReason GetLastReason() const override; |
80 bool IsPaused() const override; | 80 bool IsPaused() const override; |
81 bool IsTemporary() const override; | 81 bool IsTemporary() const override; |
82 bool CanResume() const override; | 82 bool CanResume() const override; |
83 bool IsDone() const override; | 83 bool IsDone() const override; |
84 const std::vector<GURL>& GetUrlChain() const override; | 84 const std::vector<GURL>& GetUrlChain() const override; |
85 const GURL& GetReferrerUrl() const override; | 85 const GURL& GetReferrerUrl() const override; |
86 const GURL& GetSiteUrl() const override; | 86 const GURL& GetSiteUrl() const override; |
87 const GURL& GetTabUrl() const override; | 87 const GURL& GetTabUrl() const override; |
88 const GURL& GetTabReferrerUrl() const override; | 88 const GURL& GetTabReferrerUrl() const override; |
89 std::string GetSuggestedFilename() const override; | 89 std::string GetSuggestedFilename() const override; |
90 std::string GetContentDisposition() const override; | 90 std::string GetContentDisposition() const override; |
91 std::string GetOriginalMimeType() const override; | 91 std::string GetOriginalMimeType() const override; |
92 std::string GetRemoteAddress() const override; | 92 std::string GetRemoteAddress() const override; |
93 bool HasUserGesture() const override; | 93 bool HasUserGesture() const override; |
94 ui::PageTransition GetTransitionType() const override; | 94 ui::PageTransition GetTransitionType() const override; |
95 const std::string& GetLastModifiedTime() const override; | 95 const std::string& GetLastModifiedTime() const override; |
96 const std::string& GetETag() const override; | 96 const std::string& GetETag() const override; |
97 bool IsSavePackageDownload() const override; | 97 bool IsSavePackageDownload() const override; |
98 const base::FilePath& GetFullPath() const override; | 98 const base::FilePath& GetFullPath() const override; |
99 const base::FilePath& GetForcedFilePath() const override; | 99 const base::FilePath& GetForcedFilePath() const override; |
100 base::FilePath GetFileNameToReportUser() const override; | 100 base::FilePath GetFileNameToReportUser() const override; |
101 TargetDisposition GetTargetDisposition() const override; | 101 TargetDisposition GetTargetDisposition() const override; |
102 const std::string& GetHash() const override; | 102 const std::string& GetHash() const override; |
103 void DeleteFile(const base::Callback<void(bool)>& callback) override; | 103 void DeleteFile(const base::Callback<void(bool)>& callback) override; |
104 bool IsDangerous() const override; | 104 bool IsDangerous() const override; |
105 content::DownloadDangerType GetDangerType() const override; | 105 DownloadDangerType GetDangerType() const override; |
106 bool TimeRemaining(base::TimeDelta* remaining) const override; | 106 bool TimeRemaining(base::TimeDelta* remaining) const override; |
107 int64_t CurrentSpeed() const override; | 107 int64_t CurrentSpeed() const override; |
108 int PercentComplete() const override; | 108 int PercentComplete() const override; |
109 bool AllDataSaved() const override; | 109 bool AllDataSaved() const override; |
110 int64_t GetTotalBytes() const override; | 110 int64_t GetTotalBytes() const override; |
111 int64_t GetReceivedBytes() const override; | 111 int64_t GetReceivedBytes() const override; |
112 const std::vector<DownloadItem::ReceivedSlice>& GetReceivedSlices() | 112 const std::vector<DownloadItem::ReceivedSlice>& GetReceivedSlices() |
113 const override; | 113 const override; |
114 bool CanShowInFolder() override; | 114 bool CanShowInFolder() override; |
115 bool CanOpenDownload() override; | 115 bool CanOpenDownload() override; |
116 bool ShouldOpenFileBasedOnExtension() override; | 116 bool ShouldOpenFileBasedOnExtension() override; |
117 bool GetOpenWhenComplete() const override; | 117 bool GetOpenWhenComplete() const override; |
118 bool GetAutoOpened() override; | 118 bool GetAutoOpened() override; |
119 bool GetOpened() const override; | 119 bool GetOpened() const override; |
120 base::Time GetLastAccessTime() const override; | 120 base::Time GetLastAccessTime() const override; |
121 content::BrowserContext* GetBrowserContext() const override; | 121 BrowserContext* GetBrowserContext() const override; |
122 content::WebContents* GetWebContents() const override; | 122 WebContents* GetWebContents() const override; |
123 void OnContentCheckCompleted( | 123 void OnContentCheckCompleted(DownloadDangerType danger_type) override; |
124 content::DownloadDangerType danger_type) override; | |
125 void SetOpenWhenComplete(bool open) override; | 124 void SetOpenWhenComplete(bool open) override; |
126 void SetOpened(bool opened) override; | 125 void SetOpened(bool opened) override; |
127 void SetLastAccessTime(base::Time time) override; | 126 void SetLastAccessTime(base::Time time) override; |
128 void SetDisplayName(const base::FilePath& name) override; | 127 void SetDisplayName(const base::FilePath& name) override; |
129 std::string DebugString(bool verbose) const override; | 128 std::string DebugString(bool verbose) const override; |
130 | 129 |
131 private: | 130 private: |
132 base::ObserverList<Observer> observers_; | 131 base::ObserverList<Observer> observers_; |
133 uint32_t id_; | 132 uint32_t id_; |
134 std::string guid_; | 133 std::string guid_; |
135 GURL url_; | 134 GURL url_; |
136 base::FilePath file_path_; | 135 base::FilePath file_path_; |
137 bool is_file_externally_removed_; | 136 bool is_file_externally_removed_; |
138 base::Time start_time_; | 137 base::Time start_time_; |
139 base::Time end_time_; | 138 base::Time end_time_; |
140 DownloadState download_state_; | 139 DownloadState download_state_; |
141 std::string mime_type_; | 140 std::string mime_type_; |
142 GURL original_url_; | 141 GURL original_url_; |
143 | 142 |
144 // The members below are to be returned by methods, which return by reference. | 143 // The members below are to be returned by methods, which return by reference. |
145 std::string dummy_string; | 144 std::string dummy_string; |
146 std::vector<GURL> dummy_url_vector; | 145 std::vector<GURL> dummy_url_vector; |
147 GURL dummy_url; | 146 GURL dummy_url; |
148 base::FilePath dummy_file_path; | 147 base::FilePath dummy_file_path; |
149 | 148 |
150 DISALLOW_COPY_AND_ASSIGN(FakeDownloadItem); | 149 DISALLOW_COPY_AND_ASSIGN(FakeDownloadItem); |
151 }; | 150 }; |
152 | 151 |
153 } // namespace test | 152 } // namespace content |
154 | 153 |
155 #endif // CHROME_BROWSER_NTP_SNIPPETS_FAKE_DOWNLOAD_ITEM_H_ | 154 #endif // CONTENT_PUBLIC_TEST_FAKE_DOWNLOAD_ITEM_H_ |
OLD | NEW |