| 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" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "net/base/file_stream.h" | 13 #include "net/base/file_stream.h" |
| 14 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 | 17 |
| 18 class IOBuffer; | 18 class IOBuffer; |
| 19 | 19 |
| 20 namespace testing { | 20 namespace testing { |
| 21 | 21 |
| 22 class MockFileStream : public net::FileStream { | 22 class MockFileStream : public net::FileStream { |
| 23 public: | 23 public: |
| 24 MockFileStream(net::NetLog* net_log) | 24 explicit MockFileStream(net::NetLog* net_log) |
| 25 : net::FileStream(net_log), forced_error_(net::OK) {} | 25 : net::FileStream(net_log), forced_error_(net::OK) {} |
| 26 | 26 |
| 27 MockFileStream(base::PlatformFile file, int flags, net::NetLog* net_log) | 27 MockFileStream(base::PlatformFile file, int flags, net::NetLog* net_log) |
| 28 : net::FileStream(file, flags, net_log), forced_error_(net::OK) {} | 28 : net::FileStream(file, flags, net_log), forced_error_(net::OK) {} |
| 29 | 29 |
| 30 // FileStream methods. | 30 // FileStream methods. |
| 31 virtual int OpenSync(const FilePath& path, int open_flags) OVERRIDE; | 31 virtual int OpenSync(const FilePath& path, int open_flags) OVERRIDE; |
| 32 virtual int Seek(net::Whence whence, int64 offset, | 32 virtual int Seek(net::Whence whence, int64 offset, |
| 33 const Int64CompletionCallback& callback) OVERRIDE; | 33 const Int64CompletionCallback& callback) OVERRIDE; |
| 34 virtual int64 SeekSync(net::Whence whence, int64 offset) OVERRIDE; | 34 virtual int64 SeekSync(net::Whence whence, int64 offset) OVERRIDE; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 int forced_error_; | 75 int forced_error_; |
| 76 FilePath path_; | 76 FilePath path_; |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 } // namespace testing | 79 } // namespace testing |
| 80 | 80 |
| 81 } // namespace net | 81 } // namespace net |
| 82 | 82 |
| 83 #endif // NET_BASE_MOCK_FILE_STREAM_H_ | 83 #endif // NET_BASE_MOCK_FILE_STREAM_H_ |
| OLD | NEW |