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/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "net/base/file_stream.h" | 14 #include "net/base/file_stream.h" |
15 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 | 18 |
19 class IOBuffer; | 19 class IOBuffer; |
20 | 20 |
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(net::NetLog* net_log); | 25 explicit MockFileStream(net::NetLog* net_log); |
26 MockFileStream(base::PlatformFile file, int flags, net::NetLog* net_log); | 26 MockFileStream(base::File file, net::NetLog* net_log); |
27 MockFileStream(base::PlatformFile file, int flags, net::NetLog* net_log, | 27 MockFileStream(base::File file, net::NetLog* net_log, |
28 const scoped_refptr<base::TaskRunner>& task_runner); | 28 const scoped_refptr<base::TaskRunner>& task_runner); |
29 virtual ~MockFileStream(); | 29 virtual ~MockFileStream(); |
30 | 30 |
31 // FileStream methods. | 31 // FileStream methods. |
32 virtual int OpenSync(const base::FilePath& path, int open_flags) OVERRIDE; | 32 virtual int OpenSync(const base::FilePath& path, int open_flags) OVERRIDE; |
33 virtual int Seek(net::Whence whence, int64 offset, | 33 virtual int Seek(net::Whence whence, int64 offset, |
34 const Int64CompletionCallback& callback) OVERRIDE; | 34 const Int64CompletionCallback& callback) OVERRIDE; |
35 virtual int64 SeekSync(net::Whence whence, int64 offset) OVERRIDE; | 35 virtual int64 SeekSync(net::Whence whence, int64 offset) OVERRIDE; |
36 virtual int64 Available() OVERRIDE; | 36 virtual int64 Available() OVERRIDE; |
37 virtual int Read(IOBuffer* buf, | 37 virtual int Read(IOBuffer* buf, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 base::FilePath path_; | 107 base::FilePath path_; |
108 | 108 |
109 base::WeakPtrFactory<MockFileStream> weak_factory_; | 109 base::WeakPtrFactory<MockFileStream> weak_factory_; |
110 }; | 110 }; |
111 | 111 |
112 } // namespace testing | 112 } // namespace testing |
113 | 113 |
114 } // namespace net | 114 } // namespace net |
115 | 115 |
116 #endif // NET_BASE_MOCK_FILE_STREAM_H_ | 116 #endif // NET_BASE_MOCK_FILE_STREAM_H_ |
OLD | NEW |