| 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_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_FILE_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_FILE_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_FILE_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_FILE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <map> | 10 #include <map> |
| 11 | 11 |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "content/browser/download/download_file.h" | 14 #include "content/browser/download/download_file.h" |
| 15 #include "content/public/browser/download_id.h" | 15 #include "content/public/browser/download_id.h" |
| 16 #include "content/public/browser/download_manager.h" | 16 #include "content/public/browser/download_manager.h" |
| 17 #include "net/base/net_errors.h" | |
| 18 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 20 | 19 |
| 21 struct DownloadCreateInfo; | 20 struct DownloadCreateInfo; |
| 22 | 21 |
| 23 class MockDownloadFile : virtual public content::DownloadFile { | 22 class MockDownloadFile : virtual public content::DownloadFile { |
| 24 public: | 23 public: |
| 25 MockDownloadFile(); | 24 MockDownloadFile(); |
| 26 virtual ~MockDownloadFile(); | 25 virtual ~MockDownloadFile(); |
| 27 | 26 |
| 28 // DownloadFile functions. | 27 // DownloadFile functions. |
| 29 MOCK_METHOD0(Initialize, net::Error()); | 28 MOCK_METHOD0(Initialize, content::DownloadInterruptReason()); |
| 30 MOCK_METHOD2(AppendDataToFile, net::Error(const char* data, size_t data_len)); | 29 MOCK_METHOD2(AppendDataToFile, content::DownloadInterruptReason( |
| 31 MOCK_METHOD1(Rename, net::Error(const FilePath& full_path)); | 30 const char* data, size_t data_len)); |
| 31 MOCK_METHOD1(Rename, content::DownloadInterruptReason( |
| 32 const FilePath& full_path)); |
| 32 MOCK_METHOD0(Detach, void()); | 33 MOCK_METHOD0(Detach, void()); |
| 33 MOCK_METHOD0(Cancel, void()); | 34 MOCK_METHOD0(Cancel, void()); |
| 34 MOCK_METHOD0(Finish, void()); | 35 MOCK_METHOD0(Finish, void()); |
| 35 MOCK_METHOD0(AnnotateWithSourceInformation, void()); | 36 MOCK_METHOD0(AnnotateWithSourceInformation, void()); |
| 36 MOCK_CONST_METHOD0(FullPath, FilePath()); | 37 MOCK_CONST_METHOD0(FullPath, FilePath()); |
| 37 MOCK_CONST_METHOD0(InProgress, bool()); | 38 MOCK_CONST_METHOD0(InProgress, bool()); |
| 38 MOCK_CONST_METHOD0(BytesSoFar, int64()); | 39 MOCK_CONST_METHOD0(BytesSoFar, int64()); |
| 39 MOCK_CONST_METHOD0(CurrentSpeed, int64()); | 40 MOCK_CONST_METHOD0(CurrentSpeed, int64()); |
| 40 MOCK_METHOD1(GetHash, bool(std::string* hash)); | 41 MOCK_METHOD1(GetHash, bool(std::string* hash)); |
| 41 MOCK_METHOD0(GetHashState, std::string()); | 42 MOCK_METHOD0(GetHashState, std::string()); |
| 42 MOCK_METHOD0(CancelDownloadRequest, void()); | 43 MOCK_METHOD0(CancelDownloadRequest, void()); |
| 43 MOCK_CONST_METHOD0(Id, int()); | 44 MOCK_CONST_METHOD0(Id, int()); |
| 44 MOCK_METHOD0(GetDownloadManager, content::DownloadManager*()); | 45 MOCK_METHOD0(GetDownloadManager, content::DownloadManager*()); |
| 45 MOCK_CONST_METHOD0(GlobalId, const content::DownloadId&()); | 46 MOCK_CONST_METHOD0(GlobalId, const content::DownloadId&()); |
| 46 MOCK_CONST_METHOD0(DebugString, std::string()); | 47 MOCK_CONST_METHOD0(DebugString, std::string()); |
| 47 }; | 48 }; |
| 48 | 49 |
| 49 #endif // CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_FILE_H_ | 50 #endif // CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_FILE_H_ |
| OLD | NEW |