Index: content/public/test/mock_download_manager.h |
diff --git a/content/public/test/mock_download_manager.h b/content/public/test/mock_download_manager.h |
index 82c2858fa5675562b318107df182b61bce1c045b..04cac3f5fc5e28bf15f4710343e44b051e200812 100644 |
--- a/content/public/test/mock_download_manager.h |
+++ b/content/public/test/mock_download_manager.h |
@@ -5,6 +5,8 @@ |
#ifndef CONTENT_PUBLIC_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_MANAGER_H_ |
#define CONTENT_PUBLIC_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_MANAGER_H_ |
+#include <vector> |
+ |
#include "content/public/browser/download_manager.h" |
#include "content/public/browser/download_save_info.h" |
#include "content/public/browser/download_url_parameters.h" |
@@ -21,6 +23,42 @@ void PrintTo(const DownloadRequestHandle& params, std::ostream* os); |
class MockDownloadManager : public DownloadManager { |
public: |
+ // Structure to make it possible to match more than 10 arguments on |
+ // CreateDownloadItem. |
+ struct CreateDownloadItemAdapter { |
+ FilePath current_path; |
+ FilePath target_path; |
+ std::vector<GURL> url_chain; |
+ GURL referrer_url; |
+ base::Time start_time; |
+ base::Time end_time; |
+ int64 received_bytes; |
+ int64 total_bytes; |
+ DownloadItem::DownloadState state; |
+ DownloadDangerType danger_type; |
+ DownloadInterruptReason interrupt_reason; |
+ bool opened; |
+ |
+ CreateDownloadItemAdapter( |
+ const FilePath& current_path, |
+ const FilePath& target_path, |
+ const std::vector<GURL>& url_chain, |
+ const GURL& referrer_url, |
+ const base::Time& start_time, |
+ const base::Time& end_time, |
+ int64 received_bytes, |
+ int64 total_bytes, |
+ DownloadItem::DownloadState state, |
+ DownloadDangerType danger_type, |
+ DownloadInterruptReason interrupt_reason, |
+ bool opened); |
+ // Required by clang compiler. |
+ CreateDownloadItemAdapter(const CreateDownloadItemAdapter& rhs); |
+ ~CreateDownloadItemAdapter(); |
+ |
+ bool operator==(const CreateDownloadItemAdapter& rhs); |
+ }; |
+ |
MockDownloadManager(); |
// DownloadManager: |
@@ -48,16 +86,25 @@ class MockDownloadManager : public DownloadManager { |
} |
MOCK_METHOD1(AddObserver, void(Observer* observer)); |
MOCK_METHOD1(RemoveObserver, void(Observer* observer)); |
- MOCK_METHOD9(CreateDownloadItem, DownloadItem*( |
- const FilePath& path, |
- const GURL& url, |
+ |
+ // Redirects to mock method to get around gmock 10 argument limit. |
+ virtual DownloadItem* CreateDownloadItem( |
+ const FilePath& current_path, |
+ const FilePath& target_path, |
+ const std::vector<GURL>& url_chain, |
const GURL& referrer_url, |
- const base::Time& start_tiem, |
+ const base::Time& start_time, |
const base::Time& end_time, |
int64 received_bytes, |
int64 total_bytes, |
DownloadItem::DownloadState state, |
- bool opened)); |
+ DownloadDangerType danger_type, |
+ DownloadInterruptReason interrupt_reason, |
+ bool opened) OVERRIDE; |
+ |
+ MOCK_METHOD1(MockCreateDownloadItem, |
+ DownloadItem*(CreateDownloadItemAdapter adapter)); |
+ |
MOCK_METHOD2(OnItemAddedToPersistentStore, void(int32 download_id, |
int64 db_handle)); |
MOCK_CONST_METHOD0(InProgressCount, int()); |