Chromium Code Reviews| Index: content/browser/download/mock_download_file.h |
| diff --git a/content/browser/download/mock_download_file.h b/content/browser/download/mock_download_file.h |
| new file mode 100755 |
| index 0000000000000000000000000000000000000000..9b617e3327af01d5e98a58c93cb8b035ef828952 |
| --- /dev/null |
| +++ b/content/browser/download/mock_download_file.h |
| @@ -0,0 +1,60 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_FILE_H_ |
| +#define CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_FILE_H_ |
| +#pragma once |
| + |
| +#include <string> |
| + |
| +#include "base/file_path.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "content/browser/download/download_file.h" |
| +#include "content/browser/download/download_manager.h" |
| +#include "content/browser/download/download_request_handle.h" |
| +#include "net/base/net_errors.h" |
| + |
| +struct DownloadCreateInfo; |
| + |
| +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.
|
| + public: |
| + MockDownloadFile(const DownloadCreateInfo* info, |
| + const DownloadRequestHandle& request_handle, |
| + DownloadManager* download_manager); |
| + virtual ~MockDownloadFile(); |
| + |
| + // BaseFile delegated functions. |
| + virtual net::Error Initialize(bool calculate_hash) OVERRIDE; |
| + virtual net::Error AppendDataToFile(const char* data, |
| + size_t data_len) OVERRIDE; |
| + virtual net::Error Rename(const FilePath& full_path) OVERRIDE; |
| + virtual void Detach() OVERRIDE; |
| + virtual void Cancel() OVERRIDE; |
| + virtual void Finish() OVERRIDE; |
| + virtual void AnnotateWithSourceInformation() OVERRIDE; |
| + virtual FilePath FullPath() const OVERRIDE; |
| + virtual bool InProgress() const OVERRIDE; |
| + virtual int64 BytesSoFar() const OVERRIDE; |
| + virtual bool GetSha256Hash(std::string* hash) OVERRIDE; |
| + |
| + // DownloadFile implementation. |
| + virtual void CancelDownloadRequest() OVERRIDE; |
| + virtual int Id() const OVERRIDE; |
| + virtual DownloadManager* GetDownloadManager() OVERRIDE; |
| + virtual std::string DebugString() const OVERRIDE; |
| + |
| + private: |
| + // The unique identifier for this download, assigned at creation by |
| + // the DownloadFileManager for its internal record keeping. |
| + int id_; |
| + |
| + // The handle to the request information. Used for operations outside the |
| + // download system, specifically canceling a download. |
| + DownloadRequestHandle request_handle_; |
| + |
| + // DownloadManager this download belongs to. |
| + scoped_refptr<DownloadManager> download_manager_; |
| +}; |
| + |
| +#endif // CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_FILE_H_ |