Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 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_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/file_path.h" | |
| 12 #include "base/memory/ref_counted.h" | |
| 13 #include "content/browser/download/download_file.h" | |
| 14 #include "content/browser/download/download_manager.h" | |
| 15 #include "content/browser/download/download_request_handle.h" | |
| 16 #include "net/base/net_errors.h" | |
| 17 | |
| 18 struct DownloadCreateInfo; | |
| 19 | |
| 20 class MockDownloadFile : virtual public DownloadFile { | |
|
Randy Smith (Not in Mondays)
2011/11/10 21:58:43
Are we using this anywhere in the CL? If not, I'd
ahendrickson
2011/11/13 00:50:21
Using it now, in place of GMockDownloadFile.
| |
| 21 public: | |
| 22 MockDownloadFile(const DownloadCreateInfo* info, | |
| 23 const DownloadRequestHandle& request_handle, | |
| 24 DownloadManager* download_manager); | |
| 25 virtual ~MockDownloadFile(); | |
| 26 | |
| 27 // BaseFile delegated functions. | |
| 28 virtual net::Error Initialize(bool calculate_hash) OVERRIDE; | |
| 29 virtual net::Error AppendDataToFile(const char* data, | |
| 30 size_t data_len) OVERRIDE; | |
| 31 virtual net::Error Rename(const FilePath& full_path) OVERRIDE; | |
| 32 virtual void Detach() OVERRIDE; | |
| 33 virtual void Cancel() OVERRIDE; | |
| 34 virtual void Finish() OVERRIDE; | |
| 35 virtual void AnnotateWithSourceInformation() OVERRIDE; | |
| 36 virtual FilePath FullPath() const OVERRIDE; | |
| 37 virtual bool InProgress() const OVERRIDE; | |
| 38 virtual int64 BytesSoFar() const OVERRIDE; | |
| 39 virtual bool GetSha256Hash(std::string* hash) OVERRIDE; | |
| 40 | |
| 41 // DownloadFile implementation. | |
| 42 virtual void CancelDownloadRequest() OVERRIDE; | |
| 43 virtual int Id() const OVERRIDE; | |
| 44 virtual DownloadManager* GetDownloadManager() OVERRIDE; | |
| 45 virtual std::string DebugString() const OVERRIDE; | |
| 46 | |
| 47 private: | |
| 48 // The unique identifier for this download, assigned at creation by | |
| 49 // the DownloadFileManager for its internal record keeping. | |
| 50 int id_; | |
| 51 | |
| 52 // The handle to the request information. Used for operations outside the | |
| 53 // download system, specifically canceling a download. | |
| 54 DownloadRequestHandle request_handle_; | |
| 55 | |
| 56 // DownloadManager this download belongs to. | |
| 57 scoped_refptr<DownloadManager> download_manager_; | |
| 58 }; | |
| 59 | |
| 60 #endif // CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_FILE_H_ | |
| OLD | NEW |