| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_MANAGER_DELEGATE_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_MANAGER_DELEGATE_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_MANAGER_DELEGATE_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_MANAGER_DELEGATE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 11 #include "content/browser/download/download_types.h" | 11 #include "content/browser/download/download_types.h" |
| 12 #include "content/public/browser/download_manager_delegate.h" | 12 #include "content/public/browser/download_manager_delegate.h" |
| 13 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 class DownloadManager; | 17 class DownloadManager; |
| 18 } | 18 } |
| 19 | 19 |
| 20 class MockDownloadManagerDelegate : public content::DownloadManagerDelegate { | 20 class MockDownloadManagerDelegate : public content::DownloadManagerDelegate { |
| 21 public: | 21 public: |
| 22 MockDownloadManagerDelegate(); | 22 MockDownloadManagerDelegate(); |
| 23 virtual ~MockDownloadManagerDelegate(); | 23 virtual ~MockDownloadManagerDelegate(); |
| 24 | 24 |
| 25 // DownloadManagerDelegate functions: | 25 // DownloadManagerDelegate functions: |
| 26 MOCK_METHOD1(SetDownloadManager, void(content::DownloadManager* dm)); | 26 MOCK_METHOD1(SetDownloadManager, void(content::DownloadManager* dm)); |
| 27 MOCK_METHOD0(Shutdown, void()); | 27 MOCK_METHOD0(Shutdown, void()); |
| 28 MOCK_METHOD1(ShouldStartDownload, bool(int32 download_id)); | 28 MOCK_METHOD1(ShouldStartDownload, bool(int32 download_id)); |
| 29 MOCK_METHOD3(ChooseDownloadPath, void(TabContents* tab_contents, | 29 MOCK_METHOD3(ChooseDownloadPath, void(content::WebContents* web_contents, |
| 30 const FilePath& suggested_path, | 30 const FilePath& suggested_path, |
| 31 void* data)); | 31 void* data)); |
| 32 MOCK_METHOD2(OverrideIntermediatePath, bool(content::DownloadItem* item, | 32 MOCK_METHOD2(OverrideIntermediatePath, bool(content::DownloadItem* item, |
| 33 FilePath* intermediate_path)); | 33 FilePath* intermediate_path)); |
| 34 MOCK_METHOD0(GetAlternativeTabContentsToNotifyForDownload, | 34 MOCK_METHOD0(GetAlternativeWebContentsToNotifyForDownload, |
| 35 content::WebContents*()); | 35 content::WebContents*()); |
| 36 MOCK_METHOD1(ShouldOpenFileBasedOnExtension, bool(const FilePath& path)); | 36 MOCK_METHOD1(ShouldOpenFileBasedOnExtension, bool(const FilePath& path)); |
| 37 MOCK_METHOD1(ShouldCompleteDownload, bool(content::DownloadItem* item)); | 37 MOCK_METHOD1(ShouldCompleteDownload, bool(content::DownloadItem* item)); |
| 38 MOCK_METHOD1(ShouldOpenDownload, bool(content::DownloadItem* item)); | 38 MOCK_METHOD1(ShouldOpenDownload, bool(content::DownloadItem* item)); |
| 39 MOCK_METHOD0(GenerateFileHash, bool()); | 39 MOCK_METHOD0(GenerateFileHash, bool()); |
| 40 MOCK_METHOD1(OnResponseCompleted, void(content::DownloadItem* item)); | 40 MOCK_METHOD1(OnResponseCompleted, void(content::DownloadItem* item)); |
| 41 MOCK_METHOD1(AddItemToPersistentStore, void(content::DownloadItem* item)); | 41 MOCK_METHOD1(AddItemToPersistentStore, void(content::DownloadItem* item)); |
| 42 MOCK_METHOD1(UpdateItemInPersistentStore, void(content::DownloadItem* item)); | 42 MOCK_METHOD1(UpdateItemInPersistentStore, void(content::DownloadItem* item)); |
| 43 MOCK_METHOD2(UpdatePathForItemInPersistentStore, void( | 43 MOCK_METHOD2(UpdatePathForItemInPersistentStore, void( |
| 44 content::DownloadItem* item, | 44 content::DownloadItem* item, |
| 45 const FilePath& new_path)); | 45 const FilePath& new_path)); |
| 46 MOCK_METHOD1(RemoveItemFromPersistentStore, | 46 MOCK_METHOD1(RemoveItemFromPersistentStore, |
| 47 void(content::DownloadItem* item)); | 47 void(content::DownloadItem* item)); |
| 48 MOCK_METHOD2(RemoveItemsFromPersistentStoreBetween, void( | 48 MOCK_METHOD2(RemoveItemsFromPersistentStoreBetween, void( |
| 49 base::Time remove_begin, | 49 base::Time remove_begin, |
| 50 base::Time remove_end)); | 50 base::Time remove_end)); |
| 51 MOCK_METHOD3(GetSaveDir, void(TabContents* tab_contents, | 51 MOCK_METHOD3(GetSaveDir, void(content::WebContents* web_contents, |
| 52 FilePath* website_save_dir, | 52 FilePath* website_save_dir, |
| 53 FilePath* download_save_dir)); | 53 FilePath* download_save_dir)); |
| 54 MOCK_METHOD3(ChooseSavePath, void( | 54 MOCK_METHOD3(ChooseSavePath, void( |
| 55 const base::WeakPtr<SavePackage>& save_package, | 55 const base::WeakPtr<SavePackage>& save_package, |
| 56 const FilePath& suggested_path, | 56 const FilePath& suggested_path, |
| 57 bool can_save_as_complete)); | 57 bool can_save_as_complete)); |
| 58 MOCK_METHOD0(DownloadProgressUpdated, void()); | 58 MOCK_METHOD0(DownloadProgressUpdated, void()); |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 #endif // CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_MANAGER_DELEGATE_H_ | 61 #endif // CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_MANAGER_DELEGATE_H_ |
| OLD | NEW |