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 25 matching lines...) Expand all Loading... |
36 virtual int Read(IOBuffer* buf, | 36 virtual int Read(IOBuffer* buf, |
37 int buf_len, | 37 int buf_len, |
38 const CompletionCallback& callback) OVERRIDE; | 38 const CompletionCallback& callback) OVERRIDE; |
39 virtual int ReadSync(char* buf, int buf_len) OVERRIDE; | 39 virtual int ReadSync(char* buf, int buf_len) OVERRIDE; |
40 virtual int ReadUntilComplete(char *buf, int buf_len) OVERRIDE; | 40 virtual int ReadUntilComplete(char *buf, int buf_len) OVERRIDE; |
41 virtual int Write(IOBuffer* buf, | 41 virtual int Write(IOBuffer* buf, |
42 int buf_len, | 42 int buf_len, |
43 const CompletionCallback& callback) OVERRIDE; | 43 const CompletionCallback& callback) OVERRIDE; |
44 virtual int WriteSync(const char* buf, int buf_len) OVERRIDE; | 44 virtual int WriteSync(const char* buf, int buf_len) OVERRIDE; |
45 virtual int64 Truncate(int64 bytes) OVERRIDE; | 45 virtual int64 Truncate(int64 bytes) OVERRIDE; |
46 virtual int Flush() OVERRIDE; | 46 virtual int Flush(const CompletionCallback& callback) OVERRIDE; |
| 47 virtual int FlushSync() OVERRIDE; |
47 | 48 |
48 void set_forced_error(int error) { forced_error_ = error; } | 49 void set_forced_error(int error) { forced_error_ = error; } |
49 void clear_forced_error() { forced_error_ = net::OK; } | 50 void clear_forced_error() { forced_error_ = net::OK; } |
50 int forced_error() const { return forced_error_; } | 51 int forced_error() const { return forced_error_; } |
51 const FilePath& get_path() const { return path_; } | 52 const FilePath& get_path() const { return path_; } |
52 | 53 |
53 private: | 54 private: |
54 int ReturnError(int function_error) { | 55 int ReturnError(int function_error) { |
55 if (forced_error_ != net::OK) { | 56 if (forced_error_ != net::OK) { |
56 int ret = forced_error_; | 57 int ret = forced_error_; |
(...skipping 16 matching lines...) Expand all Loading... |
73 | 74 |
74 int forced_error_; | 75 int forced_error_; |
75 FilePath path_; | 76 FilePath path_; |
76 }; | 77 }; |
77 | 78 |
78 } // namespace testing | 79 } // namespace testing |
79 | 80 |
80 } // namespace net | 81 } // namespace net |
81 | 82 |
82 #endif // NET_BASE_MOCK_FILE_STREAM_H_ | 83 #endif // NET_BASE_MOCK_FILE_STREAM_H_ |
OLD | NEW |