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 #include "net/base/mock_file_stream.h" | 5 #include "net/base/mock_file_stream.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 | 9 |
10 namespace net { | 10 namespace net { |
11 | 11 |
12 namespace testing { | 12 namespace testing { |
13 | 13 |
14 MockFileStream::MockFileStream(net::NetLog* net_log) | 14 MockFileStream::MockFileStream(net::NetLog* net_log) |
15 : net::FileStream(net_log), | 15 : net::FileStream(net_log), |
16 forced_error_(net::OK), | 16 forced_error_(net::OK), |
17 async_error_(false), | 17 async_error_(false), |
18 throttled_(false), | 18 throttled_(false), |
19 weak_factory_(this) { | 19 weak_factory_(this) { |
20 } | 20 } |
21 | 21 |
22 MockFileStream::MockFileStream(base::PlatformFile file, | 22 MockFileStream::MockFileStream(base::File file, net::NetLog* net_log) |
23 int flags, | 23 : net::FileStream(file.Pass(), net_log), |
24 net::NetLog* net_log) | |
25 : net::FileStream(file, flags, net_log), | |
26 forced_error_(net::OK), | 24 forced_error_(net::OK), |
27 async_error_(false), | 25 async_error_(false), |
28 throttled_(false), | 26 throttled_(false), |
29 weak_factory_(this) { | 27 weak_factory_(this) { |
30 } | 28 } |
31 | 29 |
32 MockFileStream::MockFileStream( | 30 MockFileStream::MockFileStream( |
33 base::PlatformFile file, | 31 base::File file, |
34 int flags, | |
35 net::NetLog* net_log, | 32 net::NetLog* net_log, |
36 const scoped_refptr<base::TaskRunner>& task_runner) | 33 const scoped_refptr<base::TaskRunner>& task_runner) |
37 : net::FileStream(file, flags, net_log, task_runner), | 34 : net::FileStream(file.Pass(), net_log, task_runner), |
38 forced_error_(net::OK), | 35 forced_error_(net::OK), |
39 async_error_(false), | 36 async_error_(false), |
40 throttled_(false), | 37 throttled_(false), |
41 weak_factory_(this) { | 38 weak_factory_(this) { |
42 } | 39 } |
43 | 40 |
44 MockFileStream::~MockFileStream() { | 41 MockFileStream::~MockFileStream() { |
45 } | 42 } |
46 | 43 |
47 int MockFileStream::OpenSync(const base::FilePath& path, int open_flags) { | 44 int MockFileStream::OpenSync(const base::FilePath& path, int open_flags) { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 return net::ERR_IO_PENDING; | 173 return net::ERR_IO_PENDING; |
177 } | 174 } |
178 int64 ret = forced_error_; | 175 int64 ret = forced_error_; |
179 clear_forced_error(); | 176 clear_forced_error(); |
180 return ret; | 177 return ret; |
181 } | 178 } |
182 | 179 |
183 } // namespace testing | 180 } // namespace testing |
184 | 181 |
185 } // namespace net | 182 } // namespace net |
OLD | NEW |