Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: net/base/mock_file_stream.cc

Issue 323683002: net: FileStream cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add DCHECK, fix ASSERT message Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 {
(...skipping 15 matching lines...) Expand all
26 : net::FileStream(file.Pass(), task_runner), 26 : net::FileStream(file.Pass(), task_runner),
27 forced_error_(net::OK), 27 forced_error_(net::OK),
28 async_error_(false), 28 async_error_(false),
29 throttled_(false), 29 throttled_(false),
30 weak_factory_(this) { 30 weak_factory_(this) {
31 } 31 }
32 32
33 MockFileStream::~MockFileStream() { 33 MockFileStream::~MockFileStream() {
34 } 34 }
35 35
36 int MockFileStream::Seek(Whence whence, int64 offset, 36 int MockFileStream::Seek(base::File::Whence whence, int64 offset,
37 const Int64CompletionCallback& callback) { 37 const Int64CompletionCallback& callback) {
38 Int64CompletionCallback wrapped_callback = 38 Int64CompletionCallback wrapped_callback =
39 base::Bind(&MockFileStream::DoCallback64, 39 base::Bind(&MockFileStream::DoCallback64,
40 weak_factory_.GetWeakPtr(), callback); 40 weak_factory_.GetWeakPtr(), callback);
41 if (forced_error_ == net::OK) 41 if (forced_error_ == net::OK)
42 return FileStream::Seek(whence, offset, wrapped_callback); 42 return FileStream::Seek(whence, offset, wrapped_callback);
43 return ErrorCallback64(wrapped_callback); 43 return ErrorCallback64(wrapped_callback);
44 } 44 }
45 45
46 int MockFileStream::Read(IOBuffer* buf, 46 int MockFileStream::Read(IOBuffer* buf,
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 return net::ERR_IO_PENDING; 132 return net::ERR_IO_PENDING;
133 } 133 }
134 int64 ret = forced_error_; 134 int64 ret = forced_error_;
135 clear_forced_error(); 135 clear_forced_error();
136 return ret; 136 return ret;
137 } 137 }
138 138
139 } // namespace testing 139 } // namespace testing
140 140
141 } // namespace net 141 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698