[email protected] | fd3a8283 | 2012-01-19 20:35:12 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | f6c2b531 | 2011-11-16 22:31:39 | [diff] [blame] | 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_FILE_H_ |
| 6 | #define CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_FILE_H_ |
[email protected] | f6c2b531 | 2011-11-16 22:31:39 | [diff] [blame] | 7 | |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 8 | #include <stddef.h> |
| 9 | #include <stdint.h> |
| 10 | |
[email protected] | f6c2b531 | 2011-11-16 22:31:39 | [diff] [blame] | 11 | #include <map> |
xingliu | 992dacf | 2017-03-03 23:28:46 | [diff] [blame] | 12 | #include <memory> |
[email protected] | 5799981 | 2013-02-24 05:40:52 | [diff] [blame] | 13 | #include <string> |
[email protected] | f6c2b531 | 2011-11-16 22:31:39 | [diff] [blame] | 14 | |
[email protected] | 5799981 | 2013-02-24 05:40:52 | [diff] [blame] | 15 | #include "base/files/file_path.h" |
[email protected] | f6c2b531 | 2011-11-16 22:31:39 | [diff] [blame] | 16 | #include "base/memory/ref_counted.h" |
xingliu | 992dacf | 2017-03-03 23:28:46 | [diff] [blame] | 17 | #include "content/browser/byte_stream.h" |
[email protected] | f363dae | 2012-01-31 06:08:23 | [diff] [blame] | 18 | #include "content/browser/download/download_file.h" |
[email protected] | e582fdd | 2011-12-20 16:48:17 | [diff] [blame] | 19 | #include "content/public/browser/download_manager.h" |
[email protected] | fd3a8283 | 2012-01-19 20:35:12 | [diff] [blame] | 20 | #include "testing/gmock/include/gmock/gmock.h" |
| 21 | #include "testing/gtest/include/gtest/gtest.h" |
[email protected] | f6c2b531 | 2011-11-16 22:31:39 | [diff] [blame] | 22 | |
[email protected] | 3586962 | 2012-10-26 23:23:55 | [diff] [blame] | 23 | namespace content { |
[email protected] | f6c2b531 | 2011-11-16 22:31:39 | [diff] [blame] | 24 | |
thakis | a1f7f6e | 2015-07-18 00:44:28 | [diff] [blame] | 25 | class MockDownloadFile : public DownloadFile { |
[email protected] | f6c2b531 | 2011-11-16 22:31:39 | [diff] [blame] | 26 | public: |
[email protected] | fd3a8283 | 2012-01-19 20:35:12 | [diff] [blame] | 27 | MockDownloadFile(); |
[email protected] | f6c2b531 | 2011-11-16 22:31:39 | [diff] [blame] | 28 | virtual ~MockDownloadFile(); |
| 29 | |
| 30 | // DownloadFile functions. |
[email protected] | 53ac00e8 | 2012-10-18 20:59:20 | [diff] [blame] | 31 | MOCK_METHOD1(Initialize, void(const InitializeCallback&)); |
xingliu | 992dacf | 2017-03-03 23:28:46 | [diff] [blame] | 32 | void AddByteStream(std::unique_ptr<ByteStreamReader> stream_reader, |
xingliu | 6719c20 | 2017-03-18 03:45:21 | [diff] [blame] | 33 | int64_t offset, |
| 34 | int64_t length) override; |
| 35 | MOCK_METHOD3(DoAddByteStream, |
| 36 | void(ByteStreamReader* stream_reader, |
| 37 | int64_t offset, |
| 38 | int64_t length)); |
[email protected] | 3586962 | 2012-10-26 23:23:55 | [diff] [blame] | 39 | MOCK_METHOD2(AppendDataToFile, DownloadInterruptReason( |
[email protected] | c4e8c33f | 2012-07-03 20:47:39 | [diff] [blame] | 40 | const char* data, size_t data_len)); |
[email protected] | 2dec8ec | 2013-02-07 19:20:34 | [diff] [blame] | 41 | MOCK_METHOD1(Rename, DownloadInterruptReason( |
| 42 | const base::FilePath& full_path)); |
[email protected] | d682597 | 2012-11-10 01:22:52 | [diff] [blame] | 43 | MOCK_METHOD2(RenameAndUniquify, |
[email protected] | 2dec8ec | 2013-02-07 19:20:34 | [diff] [blame] | 44 | void(const base::FilePath& full_path, |
[email protected] | d682597 | 2012-11-10 01:22:52 | [diff] [blame] | 45 | const RenameCompletionCallback& callback)); |
asanka | 4350f6a | 2016-03-15 02:40:57 | [diff] [blame] | 46 | MOCK_METHOD5(RenameAndAnnotate, |
[email protected] | 2dec8ec | 2013-02-07 19:20:34 | [diff] [blame] | 47 | void(const base::FilePath& full_path, |
asanka | 4350f6a | 2016-03-15 02:40:57 | [diff] [blame] | 48 | const std::string& client_guid, |
| 49 | const GURL& source_url, |
| 50 | const GURL& referrer_url, |
[email protected] | d682597 | 2012-11-10 01:22:52 | [diff] [blame] | 51 | const RenameCompletionCallback& callback)); |
| 52 | MOCK_METHOD0(Detach, void()); |
[email protected] | fd3a8283 | 2012-01-19 20:35:12 | [diff] [blame] | 53 | MOCK_METHOD0(Cancel, void()); |
| 54 | MOCK_METHOD0(Finish, void()); |
asanka | 4350f6a | 2016-03-15 02:40:57 | [diff] [blame] | 55 | MOCK_CONST_METHOD0(FullPath, const base::FilePath&()); |
[email protected] | fd3a8283 | 2012-01-19 20:35:12 | [diff] [blame] | 56 | MOCK_CONST_METHOD0(InProgress, bool()); |
qinmin | 0c5570d5 | 2017-03-20 22:56:48 | [diff] [blame] | 57 | MOCK_METHOD0(WasPaused, void()); |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 58 | MOCK_CONST_METHOD0(BytesSoFar, int64_t()); |
| 59 | MOCK_CONST_METHOD0(CurrentSpeed, int64_t()); |
[email protected] | fd3a8283 | 2012-01-19 20:35:12 | [diff] [blame] | 60 | MOCK_METHOD1(GetHash, bool(std::string* hash)); |
[email protected] | b36cad50 | 2012-07-13 23:19:14 | [diff] [blame] | 61 | MOCK_METHOD0(SendUpdate, void()); |
[email protected] | fd3a8283 | 2012-01-19 20:35:12 | [diff] [blame] | 62 | MOCK_CONST_METHOD0(Id, int()); |
[email protected] | 3586962 | 2012-10-26 23:23:55 | [diff] [blame] | 63 | MOCK_METHOD0(GetDownloadManager, DownloadManager*()); |
[email protected] | fd3a8283 | 2012-01-19 20:35:12 | [diff] [blame] | 64 | MOCK_CONST_METHOD0(DebugString, std::string()); |
[email protected] | f6c2b531 | 2011-11-16 22:31:39 | [diff] [blame] | 65 | }; |
| 66 | |
[email protected] | 3586962 | 2012-10-26 23:23:55 | [diff] [blame] | 67 | } // namespace content |
| 68 | |
[email protected] | f6c2b531 | 2011-11-16 22:31:39 | [diff] [blame] | 69 | #endif // CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_FILE_H_ |