| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_MANAGER_H_ | |
| 6 #define CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_MANAGER_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "content/browser/download/download_request_handle.h" | |
| 10 #include "content/common/content_export.h" | |
| 11 #include "content/public/browser/download_item.h" | |
| 12 #include "content/public/browser/download_manager.h" | |
| 13 #include "content/public/browser/download_save_info.h" | |
| 14 #include "content/public/browser/download_url_parameters.h" | |
| 15 #include "googleurl/src/gurl.h" | |
| 16 #include "testing/gmock/include/gmock/gmock.h" | |
| 17 #include "testing/gtest/include/gtest/gtest.h" | |
| 18 | |
| 19 namespace content { | |
| 20 | |
| 21 class MockDownloadManager : public content::DownloadManager { | |
| 22 public: | |
| 23 MockDownloadManager(); | |
| 24 | |
| 25 // DownloadManager: | |
| 26 MOCK_METHOD0(Shutdown, void()); | |
| 27 MOCK_METHOD2(GetTemporaryDownloads, void(const FilePath& dir_path, | |
| 28 DownloadVector* result)); | |
| 29 MOCK_METHOD2(GetAllDownloads, void(const FilePath& dir_path, | |
| 30 DownloadVector* result)); | |
| 31 MOCK_METHOD2(SearchDownloads, void(const string16& query, | |
| 32 DownloadVector* result)); | |
| 33 MOCK_METHOD1(Init, bool(content::BrowserContext* browser_context)); | |
| 34 MOCK_METHOD1(StartDownload, void(int32 id)); | |
| 35 MOCK_METHOD4(UpdateDownload, void(int32 download_id, | |
| 36 int64 bytes_so_far, | |
| 37 int64 bytes_per_sec, | |
| 38 const std::string& hash_state)); | |
| 39 MOCK_METHOD3(OnResponseCompleted, void(int32 download_id, | |
| 40 int64 size, | |
| 41 const std::string& hash)); | |
| 42 MOCK_METHOD1(CancelDownload, void(int32 download_id)); | |
| 43 MOCK_METHOD4(OnDownloadInterrupted, | |
| 44 void(int32 download_id, | |
| 45 int64 size, | |
| 46 const std::string& hash_state, | |
| 47 content::DownloadInterruptReason reason)); | |
| 48 MOCK_METHOD2(RemoveDownloadsBetween, int(base::Time remove_begin, | |
| 49 base::Time remove_end)); | |
| 50 MOCK_METHOD1(RemoveDownloads, int(base::Time remove_begin)); | |
| 51 MOCK_METHOD0(RemoveAllDownloads, int()); | |
| 52 MOCK_METHOD1(DownloadUrlMock, void(DownloadUrlParameters*)); | |
| 53 virtual void DownloadUrl(scoped_ptr<DownloadUrlParameters> params) OVERRIDE { | |
| 54 DownloadUrlMock(params.get()); | |
| 55 } | |
| 56 MOCK_METHOD1(AddObserver, void(Observer* observer)); | |
| 57 MOCK_METHOD1(RemoveObserver, void(Observer* observer)); | |
| 58 MOCK_METHOD1(OnPersistentStoreQueryComplete, void( | |
| 59 std::vector<DownloadPersistentStoreInfo>* entries)); | |
| 60 MOCK_METHOD2(OnItemAddedToPersistentStore, void(int32 download_id, | |
| 61 int64 db_handle)); | |
| 62 MOCK_CONST_METHOD0(InProgressCount, int()); | |
| 63 MOCK_CONST_METHOD0(GetBrowserContext, content::BrowserContext*()); | |
| 64 MOCK_METHOD0(LastDownloadPath, FilePath()); | |
| 65 MOCK_METHOD2(CreateDownloadItem, net::BoundNetLog( | |
| 66 DownloadCreateInfo* info, | |
| 67 const DownloadRequestHandle& request_handle)); | |
| 68 MOCK_METHOD5(CreateSavePackageDownloadItem, content::DownloadItem*( | |
| 69 const FilePath& main_file_path, | |
| 70 const GURL& page_url, | |
| 71 bool is_otr, | |
| 72 const std::string& mime_type, | |
| 73 content::DownloadItem::Observer* observer)); | |
| 74 MOCK_METHOD0(ClearLastDownloadPath, void()); | |
| 75 MOCK_METHOD2(FileSelected, void(const FilePath& path, int32 download_id)); | |
| 76 MOCK_METHOD1(FileSelectionCanceled, void(int32 download_id)); | |
| 77 MOCK_METHOD1(RestartDownload, void(int32 download_id)); | |
| 78 MOCK_METHOD0(CheckForHistoryFilesRemoval, void()); | |
| 79 MOCK_METHOD1(GetDownloadItem, content::DownloadItem*(int id)); | |
| 80 MOCK_METHOD1(SavePageDownloadFinished, void(content::DownloadItem* download)); | |
| 81 MOCK_METHOD1(GetActiveDownloadItem, content::DownloadItem*(int id)); | |
| 82 MOCK_METHOD0(GenerateFileHash, bool()); | |
| 83 MOCK_CONST_METHOD0(delegate, content::DownloadManagerDelegate*()); | |
| 84 MOCK_METHOD1(SetDownloadManagerDelegate, void( | |
| 85 content::DownloadManagerDelegate* delegate)); | |
| 86 MOCK_METHOD2(ContinueDownloadWithPath, void(content::DownloadItem* download, | |
| 87 const FilePath& chosen_file)); | |
| 88 MOCK_METHOD1(GetActiveDownload, content::DownloadItem*(int32 download_id)); | |
| 89 MOCK_METHOD1(SetFileManager, void(DownloadFileManager* file_manager)); | |
| 90 | |
| 91 protected: | |
| 92 virtual ~MockDownloadManager(); | |
| 93 }; | |
| 94 | |
| 95 } // namespace content | |
| 96 | |
| 97 #endif // CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_MANAGER_H_ | |
| OLD | NEW |