| 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 18 matching lines...) Expand all Loading... |
| 29 public: | 29 public: |
| 30 // Structure to make it possible to match more than 10 arguments on | 30 // Structure to make it possible to match more than 10 arguments on |
| 31 // CreateDownloadItem. | 31 // CreateDownloadItem. |
| 32 struct CreateDownloadItemAdapter { | 32 struct CreateDownloadItemAdapter { |
| 33 std::string guid; | 33 std::string guid; |
| 34 uint32_t id; | 34 uint32_t id; |
| 35 base::FilePath current_path; | 35 base::FilePath current_path; |
| 36 base::FilePath target_path; | 36 base::FilePath target_path; |
| 37 std::vector<GURL> url_chain; | 37 std::vector<GURL> url_chain; |
| 38 GURL referrer_url; | 38 GURL referrer_url; |
| 39 GURL tab_url; |
| 40 GURL tab_referrer_url; |
| 39 std::string mime_type; | 41 std::string mime_type; |
| 40 std::string original_mime_type; | 42 std::string original_mime_type; |
| 41 base::Time start_time; | 43 base::Time start_time; |
| 42 base::Time end_time; | 44 base::Time end_time; |
| 43 std::string etag; | 45 std::string etag; |
| 44 std::string last_modified; | 46 std::string last_modified; |
| 45 int64_t received_bytes; | 47 int64_t received_bytes; |
| 46 int64_t total_bytes; | 48 int64_t total_bytes; |
| 47 std::string hash; | 49 std::string hash; |
| 48 DownloadItem::DownloadState state; | 50 DownloadItem::DownloadState state; |
| 49 DownloadDangerType danger_type; | 51 DownloadDangerType danger_type; |
| 50 DownloadInterruptReason interrupt_reason; | 52 DownloadInterruptReason interrupt_reason; |
| 51 bool opened; | 53 bool opened; |
| 52 | 54 |
| 53 CreateDownloadItemAdapter(const std::string& guid, | 55 CreateDownloadItemAdapter(const std::string& guid, |
| 54 uint32_t id, | 56 uint32_t id, |
| 55 const base::FilePath& current_path, | 57 const base::FilePath& current_path, |
| 56 const base::FilePath& target_path, | 58 const base::FilePath& target_path, |
| 57 const std::vector<GURL>& url_chain, | 59 const std::vector<GURL>& url_chain, |
| 58 const GURL& referrer_url, | 60 const GURL& referrer_url, |
| 61 const GURL& tab_url, |
| 62 const GURL& tab_refererr_url, |
| 59 const std::string& mime_type, | 63 const std::string& mime_type, |
| 60 const std::string& original_mime_type, | 64 const std::string& original_mime_type, |
| 61 const base::Time& start_time, | 65 const base::Time& start_time, |
| 62 const base::Time& end_time, | 66 const base::Time& end_time, |
| 63 const std::string& etag, | 67 const std::string& etag, |
| 64 const std::string& last_modified, | 68 const std::string& last_modified, |
| 65 int64_t received_bytes, | 69 int64_t received_bytes, |
| 66 int64_t total_bytes, | 70 int64_t total_bytes, |
| 67 const std::string& hash, | 71 const std::string& hash, |
| 68 DownloadItem::DownloadState state, | 72 DownloadItem::DownloadState state, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 MOCK_METHOD1(AddObserver, void(Observer* observer)); | 110 MOCK_METHOD1(AddObserver, void(Observer* observer)); |
| 107 MOCK_METHOD1(RemoveObserver, void(Observer* observer)); | 111 MOCK_METHOD1(RemoveObserver, void(Observer* observer)); |
| 108 | 112 |
| 109 // Redirects to mock method to get around gmock 10 argument limit. | 113 // Redirects to mock method to get around gmock 10 argument limit. |
| 110 DownloadItem* CreateDownloadItem(const std::string& guid, | 114 DownloadItem* CreateDownloadItem(const std::string& guid, |
| 111 uint32_t id, | 115 uint32_t id, |
| 112 const base::FilePath& current_path, | 116 const base::FilePath& current_path, |
| 113 const base::FilePath& target_path, | 117 const base::FilePath& target_path, |
| 114 const std::vector<GURL>& url_chain, | 118 const std::vector<GURL>& url_chain, |
| 115 const GURL& referrer_url, | 119 const GURL& referrer_url, |
| 120 const GURL& tab_url, |
| 121 const GURL& tab_refererr_url, |
| 116 const std::string& mime_type, | 122 const std::string& mime_type, |
| 117 const std::string& original_mime_type, | 123 const std::string& original_mime_type, |
| 118 const base::Time& start_time, | 124 const base::Time& start_time, |
| 119 const base::Time& end_time, | 125 const base::Time& end_time, |
| 120 const std::string& etag, | 126 const std::string& etag, |
| 121 const std::string& last_modified, | 127 const std::string& last_modified, |
| 122 int64_t received_bytes, | 128 int64_t received_bytes, |
| 123 int64_t total_bytes, | 129 int64_t total_bytes, |
| 124 const std::string& hash, | 130 const std::string& hash, |
| 125 DownloadItem::DownloadState state, | 131 DownloadItem::DownloadState state, |
| 126 DownloadDangerType danger_type, | 132 DownloadDangerType danger_type, |
| 127 DownloadInterruptReason interrupt_reason, | 133 DownloadInterruptReason interrupt_reason, |
| 128 bool opened) override; | 134 bool opened) override; |
| 129 | 135 |
| 130 MOCK_METHOD1(MockCreateDownloadItem, | 136 MOCK_METHOD1(MockCreateDownloadItem, |
| 131 DownloadItem*(CreateDownloadItemAdapter adapter)); | 137 DownloadItem*(CreateDownloadItemAdapter adapter)); |
| 132 | 138 |
| 133 MOCK_CONST_METHOD0(InProgressCount, int()); | 139 MOCK_CONST_METHOD0(InProgressCount, int()); |
| 134 MOCK_CONST_METHOD0(NonMaliciousInProgressCount, int()); | 140 MOCK_CONST_METHOD0(NonMaliciousInProgressCount, int()); |
| 135 MOCK_CONST_METHOD0(GetBrowserContext, BrowserContext*()); | 141 MOCK_CONST_METHOD0(GetBrowserContext, BrowserContext*()); |
| 136 MOCK_METHOD0(CheckForHistoryFilesRemoval, void()); | 142 MOCK_METHOD0(CheckForHistoryFilesRemoval, void()); |
| 137 MOCK_METHOD1(GetDownload, DownloadItem*(uint32_t id)); | 143 MOCK_METHOD1(GetDownload, DownloadItem*(uint32_t id)); |
| 138 MOCK_METHOD1(GetDownloadByGuid, DownloadItem*(const std::string&)); | 144 MOCK_METHOD1(GetDownloadByGuid, DownloadItem*(const std::string&)); |
| 139 }; | 145 }; |
| 140 | 146 |
| 141 } // namespace content | 147 } // namespace content |
| 142 | 148 |
| 143 #endif // CONTENT_PUBLIC_TEST_MOCK_DOWNLOAD_MANAGER_H_ | 149 #endif // CONTENT_PUBLIC_TEST_MOCK_DOWNLOAD_MANAGER_H_ |
| OLD | NEW |