| 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 // This file defines MockFileStream, a test class for FileStream. | 5 // This file defines MockFileStream, a test class for FileStream. |
| 6 | 6 |
| 7 #ifndef NET_BASE_MOCK_FILE_STREAM_H_ | 7 #ifndef NET_BASE_MOCK_FILE_STREAM_H_ |
| 8 #define NET_BASE_MOCK_FILE_STREAM_H_ | 8 #define NET_BASE_MOCK_FILE_STREAM_H_ |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 namespace testing { | 21 namespace testing { |
| 22 | 22 |
| 23 class MockFileStream : public net::FileStream { | 23 class MockFileStream : public net::FileStream { |
| 24 public: | 24 public: |
| 25 explicit MockFileStream(const scoped_refptr<base::TaskRunner>& task_runner); | 25 explicit MockFileStream(const scoped_refptr<base::TaskRunner>& task_runner); |
| 26 MockFileStream(base::File file, | 26 MockFileStream(base::File file, |
| 27 const scoped_refptr<base::TaskRunner>& task_runner); | 27 const scoped_refptr<base::TaskRunner>& task_runner); |
| 28 virtual ~MockFileStream(); | 28 virtual ~MockFileStream(); |
| 29 | 29 |
| 30 // FileStream methods. | 30 // FileStream methods. |
| 31 virtual int Seek(base::File::Whence whence, int64 offset, | 31 virtual int Seek(base::File::Whence whence, |
| 32 int64 offset, |
| 32 const Int64CompletionCallback& callback) override; | 33 const Int64CompletionCallback& callback) override; |
| 33 virtual int Read(IOBuffer* buf, | 34 virtual int Read(IOBuffer* buf, |
| 34 int buf_len, | 35 int buf_len, |
| 35 const CompletionCallback& callback) override; | 36 const CompletionCallback& callback) override; |
| 36 virtual int Write(IOBuffer* buf, | 37 virtual int Write(IOBuffer* buf, |
| 37 int buf_len, | 38 int buf_len, |
| 38 const CompletionCallback& callback) override; | 39 const CompletionCallback& callback) override; |
| 39 virtual int Flush(const CompletionCallback& callback) override; | 40 virtual int Flush(const CompletionCallback& callback) override; |
| 40 | 41 |
| 41 void set_forced_error_async(int error) { | 42 void set_forced_error_async(int error) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 base::FilePath path_; | 99 base::FilePath path_; |
| 99 | 100 |
| 100 base::WeakPtrFactory<MockFileStream> weak_factory_; | 101 base::WeakPtrFactory<MockFileStream> weak_factory_; |
| 101 }; | 102 }; |
| 102 | 103 |
| 103 } // namespace testing | 104 } // namespace testing |
| 104 | 105 |
| 105 } // namespace net | 106 } // namespace net |
| 106 | 107 |
| 107 #endif // NET_BASE_MOCK_FILE_STREAM_H_ | 108 #endif // NET_BASE_MOCK_FILE_STREAM_H_ |
| OLD | NEW |