| 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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "content/public/browser/download_manager.h" | 13 #include "content/public/browser/download_manager.h" |
| 14 #include "content/public/browser/download_save_info.h" | 14 #include "content/public/browser/download_save_info.h" |
| 15 #include "content/public/browser/download_url_parameters.h" | 15 #include "content/public/browser/download_url_parameters.h" |
| 16 #include "net/traffic_annotation/network_traffic_annotation.h" |
| 16 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 18 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 19 #include "url/origin.h" | 20 #include "url/origin.h" |
| 20 | 21 |
| 21 class DownloadRequestHandle; | 22 class DownloadRequestHandle; |
| 22 | 23 |
| 23 namespace content { | 24 namespace content { |
| 24 | 25 |
| 25 // To avoid leaking download_request_handle.h to embedders. | 26 // To avoid leaking download_request_handle.h to embedders. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 std::unique_ptr<ByteStreamReader> stream, | 106 std::unique_ptr<ByteStreamReader> stream, |
| 106 const DownloadUrlParameters::OnStartedCallback& callback) override; | 107 const DownloadUrlParameters::OnStartedCallback& callback) override; |
| 107 | 108 |
| 108 MOCK_METHOD2(MockStartDownload, | 109 MOCK_METHOD2(MockStartDownload, |
| 109 void(DownloadCreateInfo*, ByteStreamReader*)); | 110 void(DownloadCreateInfo*, ByteStreamReader*)); |
| 110 MOCK_METHOD3(RemoveDownloadsByURLAndTime, | 111 MOCK_METHOD3(RemoveDownloadsByURLAndTime, |
| 111 int(const base::Callback<bool(const GURL&)>& url_filter, | 112 int(const base::Callback<bool(const GURL&)>& url_filter, |
| 112 base::Time remove_begin, | 113 base::Time remove_begin, |
| 113 base::Time remove_end)); | 114 base::Time remove_end)); |
| 114 MOCK_METHOD1(DownloadUrlMock, void(DownloadUrlParameters*)); | 115 MOCK_METHOD1(DownloadUrlMock, void(DownloadUrlParameters*)); |
| 115 void DownloadUrl(std::unique_ptr<DownloadUrlParameters> params) override { | 116 void DownloadUrl( |
| 117 std::unique_ptr<DownloadUrlParameters> params, |
| 118 const net::NetworkTrafficAnnotationTag& traffic_annotation) override { |
| 116 DownloadUrlMock(params.get()); | 119 DownloadUrlMock(params.get()); |
| 117 } | 120 } |
| 118 MOCK_METHOD1(AddObserver, void(Observer* observer)); | 121 MOCK_METHOD1(AddObserver, void(Observer* observer)); |
| 119 MOCK_METHOD1(RemoveObserver, void(Observer* observer)); | 122 MOCK_METHOD1(RemoveObserver, void(Observer* observer)); |
| 120 | 123 |
| 121 // Redirects to mock method to get around gmock 10 argument limit. | 124 // Redirects to mock method to get around gmock 10 argument limit. |
| 122 DownloadItem* CreateDownloadItem( | 125 DownloadItem* CreateDownloadItem( |
| 123 const std::string& guid, | 126 const std::string& guid, |
| 124 uint32_t id, | 127 uint32_t id, |
| 125 const base::FilePath& current_path, | 128 const base::FilePath& current_path, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 154 MOCK_CONST_METHOD0(NonMaliciousInProgressCount, int()); | 157 MOCK_CONST_METHOD0(NonMaliciousInProgressCount, int()); |
| 155 MOCK_CONST_METHOD0(GetBrowserContext, BrowserContext*()); | 158 MOCK_CONST_METHOD0(GetBrowserContext, BrowserContext*()); |
| 156 MOCK_METHOD0(CheckForHistoryFilesRemoval, void()); | 159 MOCK_METHOD0(CheckForHistoryFilesRemoval, void()); |
| 157 MOCK_METHOD1(GetDownload, DownloadItem*(uint32_t id)); | 160 MOCK_METHOD1(GetDownload, DownloadItem*(uint32_t id)); |
| 158 MOCK_METHOD1(GetDownloadByGuid, DownloadItem*(const std::string&)); | 161 MOCK_METHOD1(GetDownloadByGuid, DownloadItem*(const std::string&)); |
| 159 }; | 162 }; |
| 160 | 163 |
| 161 } // namespace content | 164 } // namespace content |
| 162 | 165 |
| 163 #endif // CONTENT_PUBLIC_TEST_MOCK_DOWNLOAD_MANAGER_H_ | 166 #endif // CONTENT_PUBLIC_TEST_MOCK_DOWNLOAD_MANAGER_H_ |
| OLD | NEW |