blob: 1bae2b7ead8e5076ffbad77851dd93f60fa73687 [file] [log] [blame]
[email protected]fd3a82832012-01-19 20:35:121// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]f6c2b5312011-11-16 22:31:392// 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]f6c2b5312011-11-16 22:31:397
avib7348942015-12-25 20:57:108#include <stddef.h>
9#include <stdint.h>
10
[email protected]f6c2b5312011-11-16 22:31:3911#include <map>
xingliu992dacf2017-03-03 23:28:4612#include <memory>
[email protected]57999812013-02-24 05:40:5213#include <string>
[email protected]f6c2b5312011-11-16 22:31:3914
[email protected]57999812013-02-24 05:40:5215#include "base/files/file_path.h"
[email protected]f6c2b5312011-11-16 22:31:3916#include "base/memory/ref_counted.h"
xingliu992dacf2017-03-03 23:28:4617#include "content/browser/byte_stream.h"
[email protected]f363dae2012-01-31 06:08:2318#include "content/browser/download/download_file.h"
[email protected]e582fdd2011-12-20 16:48:1719#include "content/public/browser/download_manager.h"
[email protected]fd3a82832012-01-19 20:35:1220#include "testing/gmock/include/gmock/gmock.h"
21#include "testing/gtest/include/gtest/gtest.h"
[email protected]f6c2b5312011-11-16 22:31:3922
[email protected]35869622012-10-26 23:23:5523namespace content {
[email protected]f6c2b5312011-11-16 22:31:3924
thakisa1f7f6e2015-07-18 00:44:2825class MockDownloadFile : public DownloadFile {
[email protected]f6c2b5312011-11-16 22:31:3926 public:
[email protected]fd3a82832012-01-19 20:35:1227 MockDownloadFile();
[email protected]f6c2b5312011-11-16 22:31:3928 virtual ~MockDownloadFile();
29
30 // DownloadFile functions.
[email protected]53ac00e82012-10-18 20:59:2031 MOCK_METHOD1(Initialize, void(const InitializeCallback&));
xingliu992dacf2017-03-03 23:28:4632 void AddByteStream(std::unique_ptr<ByteStreamReader> stream_reader,
xingliu6719c202017-03-18 03:45:2133 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]35869622012-10-26 23:23:5539 MOCK_METHOD2(AppendDataToFile, DownloadInterruptReason(
[email protected]c4e8c33f2012-07-03 20:47:3940 const char* data, size_t data_len));
[email protected]2dec8ec2013-02-07 19:20:3441 MOCK_METHOD1(Rename, DownloadInterruptReason(
42 const base::FilePath& full_path));
[email protected]d6825972012-11-10 01:22:5243 MOCK_METHOD2(RenameAndUniquify,
[email protected]2dec8ec2013-02-07 19:20:3444 void(const base::FilePath& full_path,
[email protected]d6825972012-11-10 01:22:5245 const RenameCompletionCallback& callback));
asanka4350f6a2016-03-15 02:40:5746 MOCK_METHOD5(RenameAndAnnotate,
[email protected]2dec8ec2013-02-07 19:20:3447 void(const base::FilePath& full_path,
asanka4350f6a2016-03-15 02:40:5748 const std::string& client_guid,
49 const GURL& source_url,
50 const GURL& referrer_url,
[email protected]d6825972012-11-10 01:22:5251 const RenameCompletionCallback& callback));
52 MOCK_METHOD0(Detach, void());
[email protected]fd3a82832012-01-19 20:35:1253 MOCK_METHOD0(Cancel, void());
54 MOCK_METHOD0(Finish, void());
asanka4350f6a2016-03-15 02:40:5755 MOCK_CONST_METHOD0(FullPath, const base::FilePath&());
[email protected]fd3a82832012-01-19 20:35:1256 MOCK_CONST_METHOD0(InProgress, bool());
qinmin0c5570d52017-03-20 22:56:4857 MOCK_METHOD0(WasPaused, void());
avib7348942015-12-25 20:57:1058 MOCK_CONST_METHOD0(BytesSoFar, int64_t());
59 MOCK_CONST_METHOD0(CurrentSpeed, int64_t());
[email protected]fd3a82832012-01-19 20:35:1260 MOCK_METHOD1(GetHash, bool(std::string* hash));
[email protected]b36cad502012-07-13 23:19:1461 MOCK_METHOD0(SendUpdate, void());
[email protected]fd3a82832012-01-19 20:35:1262 MOCK_CONST_METHOD0(Id, int());
[email protected]35869622012-10-26 23:23:5563 MOCK_METHOD0(GetDownloadManager, DownloadManager*());
[email protected]fd3a82832012-01-19 20:35:1264 MOCK_CONST_METHOD0(DebugString, std::string());
[email protected]f6c2b5312011-11-16 22:31:3965};
66
[email protected]35869622012-10-26 23:23:5567} // namespace content
68
[email protected]f6c2b5312011-11-16 22:31:3969#endif // CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_FILE_H_