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

Side by Side Diff: net/socket/transport_client_socket_pool_unittest.cc

Issue 227473008: make SetReceiveBufferSize and SetSendBufferSize return net error codes (instead of bools) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix linux typo Created 6 years, 8 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/socket/transport_client_socket_pool.h" 5 #include "net/socket/transport_client_socket_pool.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 138
139 // Socket implementation. 139 // Socket implementation.
140 virtual int Read(IOBuffer* buf, int buf_len, 140 virtual int Read(IOBuffer* buf, int buf_len,
141 const CompletionCallback& callback) OVERRIDE { 141 const CompletionCallback& callback) OVERRIDE {
142 return ERR_FAILED; 142 return ERR_FAILED;
143 } 143 }
144 virtual int Write(IOBuffer* buf, int buf_len, 144 virtual int Write(IOBuffer* buf, int buf_len,
145 const CompletionCallback& callback) OVERRIDE { 145 const CompletionCallback& callback) OVERRIDE {
146 return ERR_FAILED; 146 return ERR_FAILED;
147 } 147 }
148 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE { return true; } 148 virtual int SetReceiveBufferSize(int32 size) OVERRIDE { return OK; }
149 virtual bool SetSendBufferSize(int32 size) OVERRIDE { return true; } 149 virtual int SetSendBufferSize(int32 size) OVERRIDE { return OK; }
150 150
151 private: 151 private:
152 bool connected_; 152 bool connected_;
153 const AddressList addrlist_; 153 const AddressList addrlist_;
154 BoundNetLog net_log_; 154 BoundNetLog net_log_;
155 155
156 DISALLOW_COPY_AND_ASSIGN(MockClientSocket); 156 DISALLOW_COPY_AND_ASSIGN(MockClientSocket);
157 }; 157 };
158 158
159 class MockFailingClientSocket : public StreamSocket { 159 class MockFailingClientSocket : public StreamSocket {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 // Socket implementation. 203 // Socket implementation.
204 virtual int Read(IOBuffer* buf, int buf_len, 204 virtual int Read(IOBuffer* buf, int buf_len,
205 const CompletionCallback& callback) OVERRIDE { 205 const CompletionCallback& callback) OVERRIDE {
206 return ERR_FAILED; 206 return ERR_FAILED;
207 } 207 }
208 208
209 virtual int Write(IOBuffer* buf, int buf_len, 209 virtual int Write(IOBuffer* buf, int buf_len,
210 const CompletionCallback& callback) OVERRIDE { 210 const CompletionCallback& callback) OVERRIDE {
211 return ERR_FAILED; 211 return ERR_FAILED;
212 } 212 }
213 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE { return true; } 213 virtual int SetReceiveBufferSize(int32 size) OVERRIDE { return OK; }
214 virtual bool SetSendBufferSize(int32 size) OVERRIDE { return true; } 214 virtual int SetSendBufferSize(int32 size) OVERRIDE { return OK; }
215 215
216 private: 216 private:
217 const AddressList addrlist_; 217 const AddressList addrlist_;
218 BoundNetLog net_log_; 218 BoundNetLog net_log_;
219 219
220 DISALLOW_COPY_AND_ASSIGN(MockFailingClientSocket); 220 DISALLOW_COPY_AND_ASSIGN(MockFailingClientSocket);
221 }; 221 };
222 222
223 class MockPendingClientSocket : public StreamSocket { 223 class MockPendingClientSocket : public StreamSocket {
224 public: 224 public:
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 // Socket implementation. 292 // Socket implementation.
293 virtual int Read(IOBuffer* buf, int buf_len, 293 virtual int Read(IOBuffer* buf, int buf_len,
294 const CompletionCallback& callback) OVERRIDE { 294 const CompletionCallback& callback) OVERRIDE {
295 return ERR_FAILED; 295 return ERR_FAILED;
296 } 296 }
297 297
298 virtual int Write(IOBuffer* buf, int buf_len, 298 virtual int Write(IOBuffer* buf, int buf_len,
299 const CompletionCallback& callback) OVERRIDE { 299 const CompletionCallback& callback) OVERRIDE {
300 return ERR_FAILED; 300 return ERR_FAILED;
301 } 301 }
302 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE { return true; } 302 virtual int SetReceiveBufferSize(int32 size) OVERRIDE { return OK; }
303 virtual bool SetSendBufferSize(int32 size) OVERRIDE { return true; } 303 virtual int SetSendBufferSize(int32 size) OVERRIDE { return OK; }
304 304
305 private: 305 private:
306 void DoCallback(const CompletionCallback& callback) { 306 void DoCallback(const CompletionCallback& callback) {
307 if (should_stall_) 307 if (should_stall_)
308 return; 308 return;
309 309
310 if (should_connect_) { 310 if (should_connect_) {
311 is_connected_ = true; 311 is_connected_ = true;
312 callback.Run(OK); 312 callback.Run(OK);
313 } else { 313 } else {
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 EXPECT_TRUE(handle.socket()); 1366 EXPECT_TRUE(handle.socket());
1367 IPEndPoint endpoint; 1367 IPEndPoint endpoint;
1368 handle.socket()->GetLocalAddress(&endpoint); 1368 handle.socket()->GetLocalAddress(&endpoint);
1369 EXPECT_EQ(kIPv4AddressSize, endpoint.address().size()); 1369 EXPECT_EQ(kIPv4AddressSize, endpoint.address().size());
1370 EXPECT_EQ(1, client_socket_factory_.allocation_count()); 1370 EXPECT_EQ(1, client_socket_factory_.allocation_count());
1371 } 1371 }
1372 1372
1373 } // namespace 1373 } // namespace
1374 1374
1375 } // namespace net 1375 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698