| 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 FileStream { | 23 class MockFileStream : public 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 ~MockFileStream() override; | 28 ~MockFileStream() override; |
| 29 | 29 |
| 30 // FileStream methods. | 30 // FileStream methods. |
| 31 int Seek(base::File::Whence whence, | 31 int Seek(int64_t offset, const Int64CompletionCallback& callback) override; |
| 32 int64_t offset, | |
| 33 const Int64CompletionCallback& callback) override; | |
| 34 int Read(IOBuffer* buf, | 32 int Read(IOBuffer* buf, |
| 35 int buf_len, | 33 int buf_len, |
| 36 const CompletionCallback& callback) override; | 34 const CompletionCallback& callback) override; |
| 37 int Write(IOBuffer* buf, | 35 int Write(IOBuffer* buf, |
| 38 int buf_len, | 36 int buf_len, |
| 39 const CompletionCallback& callback) override; | 37 const CompletionCallback& callback) override; |
| 40 int Flush(const CompletionCallback& callback) override; | 38 int Flush(const CompletionCallback& callback) override; |
| 41 | 39 |
| 42 void set_forced_error_async(int error) { | 40 void set_forced_error_async(int error) { |
| 43 forced_error_ = error; | 41 forced_error_ = error; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 base::FilePath path_; | 97 base::FilePath path_; |
| 100 | 98 |
| 101 base::WeakPtrFactory<MockFileStream> weak_factory_; | 99 base::WeakPtrFactory<MockFileStream> weak_factory_; |
| 102 }; | 100 }; |
| 103 | 101 |
| 104 } // namespace testing | 102 } // namespace testing |
| 105 | 103 |
| 106 } // namespace net | 104 } // namespace net |
| 107 | 105 |
| 108 #endif // NET_BASE_MOCK_FILE_STREAM_H_ | 106 #endif // NET_BASE_MOCK_FILE_STREAM_H_ |
| OLD | NEW |