| 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 #ifndef CONTENT_PUBLIC_TEST_MOCK_DOWNLOAD_MANAGER_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_MOCK_DOWNLOAD_MANAGER_H_ |
| 6 #define CONTENT_PUBLIC_TEST_MOCK_DOWNLOAD_MANAGER_H_ | 6 #define CONTENT_PUBLIC_TEST_MOCK_DOWNLOAD_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 base::Time end_time; | 45 base::Time end_time; |
| 46 std::string etag; | 46 std::string etag; |
| 47 std::string last_modified; | 47 std::string last_modified; |
| 48 int64_t received_bytes; | 48 int64_t received_bytes; |
| 49 int64_t total_bytes; | 49 int64_t total_bytes; |
| 50 std::string hash; | 50 std::string hash; |
| 51 DownloadItem::DownloadState state; | 51 DownloadItem::DownloadState state; |
| 52 DownloadDangerType danger_type; | 52 DownloadDangerType danger_type; |
| 53 DownloadInterruptReason interrupt_reason; | 53 DownloadInterruptReason interrupt_reason; |
| 54 bool opened; | 54 bool opened; |
| 55 std::vector<DownloadItem::ReceivedSlice> received_slices; |
| 55 | 56 |
| 56 CreateDownloadItemAdapter(const std::string& guid, | 57 CreateDownloadItemAdapter( |
| 57 uint32_t id, | 58 const std::string& guid, |
| 58 const base::FilePath& current_path, | 59 uint32_t id, |
| 59 const base::FilePath& target_path, | 60 const base::FilePath& current_path, |
| 60 const std::vector<GURL>& url_chain, | 61 const base::FilePath& target_path, |
| 61 const GURL& referrer_url, | 62 const std::vector<GURL>& url_chain, |
| 62 const GURL& site_url, | 63 const GURL& referrer_url, |
| 63 const GURL& tab_url, | 64 const GURL& site_url, |
| 64 const GURL& tab_refererr_url, | 65 const GURL& tab_url, |
| 65 const std::string& mime_type, | 66 const GURL& tab_refererr_url, |
| 66 const std::string& original_mime_type, | 67 const std::string& mime_type, |
| 67 const base::Time& start_time, | 68 const std::string& original_mime_type, |
| 68 const base::Time& end_time, | 69 const base::Time& start_time, |
| 69 const std::string& etag, | 70 const base::Time& end_time, |
| 70 const std::string& last_modified, | 71 const std::string& etag, |
| 71 int64_t received_bytes, | 72 const std::string& last_modified, |
| 72 int64_t total_bytes, | 73 int64_t received_bytes, |
| 73 const std::string& hash, | 74 int64_t total_bytes, |
| 74 DownloadItem::DownloadState state, | 75 const std::string& hash, |
| 75 DownloadDangerType danger_type, | 76 DownloadItem::DownloadState state, |
| 76 DownloadInterruptReason interrupt_reason, | 77 DownloadDangerType danger_type, |
| 77 bool opened); | 78 DownloadInterruptReason interrupt_reason, |
| 79 bool opened, |
| 80 const std::vector<DownloadItem::ReceivedSlice>& received_slices); |
| 78 // Required by clang compiler. | 81 // Required by clang compiler. |
| 79 CreateDownloadItemAdapter(const CreateDownloadItemAdapter& rhs); | 82 CreateDownloadItemAdapter(const CreateDownloadItemAdapter& rhs); |
| 80 ~CreateDownloadItemAdapter(); | 83 ~CreateDownloadItemAdapter(); |
| 81 | 84 |
| 82 bool operator==(const CreateDownloadItemAdapter& rhs) const; | 85 bool operator==(const CreateDownloadItemAdapter& rhs) const; |
| 83 }; | 86 }; |
| 84 | 87 |
| 85 MockDownloadManager(); | 88 MockDownloadManager(); |
| 86 ~MockDownloadManager() override; | 89 ~MockDownloadManager() override; |
| 87 | 90 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 105 base::Time remove_begin, | 108 base::Time remove_begin, |
| 106 base::Time remove_end)); | 109 base::Time remove_end)); |
| 107 MOCK_METHOD1(DownloadUrlMock, void(DownloadUrlParameters*)); | 110 MOCK_METHOD1(DownloadUrlMock, void(DownloadUrlParameters*)); |
| 108 void DownloadUrl(std::unique_ptr<DownloadUrlParameters> params) override { | 111 void DownloadUrl(std::unique_ptr<DownloadUrlParameters> params) override { |
| 109 DownloadUrlMock(params.get()); | 112 DownloadUrlMock(params.get()); |
| 110 } | 113 } |
| 111 MOCK_METHOD1(AddObserver, void(Observer* observer)); | 114 MOCK_METHOD1(AddObserver, void(Observer* observer)); |
| 112 MOCK_METHOD1(RemoveObserver, void(Observer* observer)); | 115 MOCK_METHOD1(RemoveObserver, void(Observer* observer)); |
| 113 | 116 |
| 114 // Redirects to mock method to get around gmock 10 argument limit. | 117 // Redirects to mock method to get around gmock 10 argument limit. |
| 115 DownloadItem* CreateDownloadItem(const std::string& guid, | 118 DownloadItem* CreateDownloadItem( |
| 116 uint32_t id, | 119 const std::string& guid, |
| 117 const base::FilePath& current_path, | 120 uint32_t id, |
| 118 const base::FilePath& target_path, | 121 const base::FilePath& current_path, |
| 119 const std::vector<GURL>& url_chain, | 122 const base::FilePath& target_path, |
| 120 const GURL& referrer_url, | 123 const std::vector<GURL>& url_chain, |
| 121 const GURL& site_url, | 124 const GURL& referrer_url, |
| 122 const GURL& tab_url, | 125 const GURL& site_url, |
| 123 const GURL& tab_refererr_url, | 126 const GURL& tab_url, |
| 124 const std::string& mime_type, | 127 const GURL& tab_refererr_url, |
| 125 const std::string& original_mime_type, | 128 const std::string& mime_type, |
| 126 const base::Time& start_time, | 129 const std::string& original_mime_type, |
| 127 const base::Time& end_time, | 130 const base::Time& start_time, |
| 128 const std::string& etag, | 131 const base::Time& end_time, |
| 129 const std::string& last_modified, | 132 const std::string& etag, |
| 130 int64_t received_bytes, | 133 const std::string& last_modified, |
| 131 int64_t total_bytes, | 134 int64_t received_bytes, |
| 132 const std::string& hash, | 135 int64_t total_bytes, |
| 133 DownloadItem::DownloadState state, | 136 const std::string& hash, |
| 134 DownloadDangerType danger_type, | 137 DownloadItem::DownloadState state, |
| 135 DownloadInterruptReason interrupt_reason, | 138 DownloadDangerType danger_type, |
| 136 bool opened) override; | 139 DownloadInterruptReason interrupt_reason, |
| 140 bool opened, |
| 141 const std::vector<DownloadItem::ReceivedSlice>& received_slices) override; |
| 137 | 142 |
| 138 MOCK_METHOD1(MockCreateDownloadItem, | 143 MOCK_METHOD1(MockCreateDownloadItem, |
| 139 DownloadItem*(CreateDownloadItemAdapter adapter)); | 144 DownloadItem*(CreateDownloadItemAdapter adapter)); |
| 140 | 145 |
| 141 MOCK_CONST_METHOD0(InProgressCount, int()); | 146 MOCK_CONST_METHOD0(InProgressCount, int()); |
| 142 MOCK_CONST_METHOD0(NonMaliciousInProgressCount, int()); | 147 MOCK_CONST_METHOD0(NonMaliciousInProgressCount, int()); |
| 143 MOCK_CONST_METHOD0(GetBrowserContext, BrowserContext*()); | 148 MOCK_CONST_METHOD0(GetBrowserContext, BrowserContext*()); |
| 144 MOCK_METHOD0(CheckForHistoryFilesRemoval, void()); | 149 MOCK_METHOD0(CheckForHistoryFilesRemoval, void()); |
| 145 MOCK_METHOD1(GetDownload, DownloadItem*(uint32_t id)); | 150 MOCK_METHOD1(GetDownload, DownloadItem*(uint32_t id)); |
| 146 MOCK_METHOD1(GetDownloadByGuid, DownloadItem*(const std::string&)); | 151 MOCK_METHOD1(GetDownloadByGuid, DownloadItem*(const std::string&)); |
| 147 }; | 152 }; |
| 148 | 153 |
| 149 } // namespace content | 154 } // namespace content |
| 150 | 155 |
| 151 #endif // CONTENT_PUBLIC_TEST_MOCK_DOWNLOAD_MANAGER_H_ | 156 #endif // CONTENT_PUBLIC_TEST_MOCK_DOWNLOAD_MANAGER_H_ |
| OLD | NEW |