| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 return ERR_FAILED; | 100 return ERR_FAILED; |
| 101 } | 101 } |
| 102 virtual int Read(IOBuffer* buf, int buf_len, | 102 virtual int Read(IOBuffer* buf, int buf_len, |
| 103 const CompletionCallback& callback) { | 103 const CompletionCallback& callback) { |
| 104 return ERR_FAILED; | 104 return ERR_FAILED; |
| 105 } | 105 } |
| 106 virtual int Write(IOBuffer* buf, int buf_len, | 106 virtual int Write(IOBuffer* buf, int buf_len, |
| 107 OldCompletionCallback* callback) { | 107 OldCompletionCallback* callback) { |
| 108 return ERR_FAILED; | 108 return ERR_FAILED; |
| 109 } | 109 } |
| 110 virtual int Write(IOBuffer* buf, int buf_len, |
| 111 const CompletionCallback& callback) { |
| 112 return ERR_FAILED; |
| 113 } |
| 110 virtual bool SetReceiveBufferSize(int32 size) { return true; } | 114 virtual bool SetReceiveBufferSize(int32 size) { return true; } |
| 111 virtual bool SetSendBufferSize(int32 size) { return true; } | 115 virtual bool SetSendBufferSize(int32 size) { return true; } |
| 112 | 116 |
| 113 private: | 117 private: |
| 114 bool connected_; | 118 bool connected_; |
| 115 const AddressList addrlist_; | 119 const AddressList addrlist_; |
| 116 BoundNetLog net_log_; | 120 BoundNetLog net_log_; |
| 117 }; | 121 }; |
| 118 | 122 |
| 119 class MockFailingClientSocket : public StreamSocket { | 123 class MockFailingClientSocket : public StreamSocket { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 166 } |
| 163 virtual int Read(IOBuffer* buf, int buf_len, | 167 virtual int Read(IOBuffer* buf, int buf_len, |
| 164 const CompletionCallback& callback) { | 168 const CompletionCallback& callback) { |
| 165 return ERR_FAILED; | 169 return ERR_FAILED; |
| 166 } | 170 } |
| 167 | 171 |
| 168 virtual int Write(IOBuffer* buf, int buf_len, | 172 virtual int Write(IOBuffer* buf, int buf_len, |
| 169 OldCompletionCallback* callback) { | 173 OldCompletionCallback* callback) { |
| 170 return ERR_FAILED; | 174 return ERR_FAILED; |
| 171 } | 175 } |
| 176 virtual int Write(IOBuffer* buf, int buf_len, |
| 177 const CompletionCallback& callback) { |
| 178 return ERR_FAILED; |
| 179 } |
| 172 virtual bool SetReceiveBufferSize(int32 size) { return true; } | 180 virtual bool SetReceiveBufferSize(int32 size) { return true; } |
| 173 virtual bool SetSendBufferSize(int32 size) { return true; } | 181 virtual bool SetSendBufferSize(int32 size) { return true; } |
| 174 | 182 |
| 175 private: | 183 private: |
| 176 const AddressList addrlist_; | 184 const AddressList addrlist_; |
| 177 BoundNetLog net_log_; | 185 BoundNetLog net_log_; |
| 178 }; | 186 }; |
| 179 | 187 |
| 180 class MockPendingClientSocket : public StreamSocket { | 188 class MockPendingClientSocket : public StreamSocket { |
| 181 public: | 189 public: |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 } | 261 } |
| 254 virtual int Read(IOBuffer* buf, int buf_len, | 262 virtual int Read(IOBuffer* buf, int buf_len, |
| 255 const CompletionCallback& callback) { | 263 const CompletionCallback& callback) { |
| 256 return ERR_FAILED; | 264 return ERR_FAILED; |
| 257 } | 265 } |
| 258 | 266 |
| 259 virtual int Write(IOBuffer* buf, int buf_len, | 267 virtual int Write(IOBuffer* buf, int buf_len, |
| 260 OldCompletionCallback* callback) { | 268 OldCompletionCallback* callback) { |
| 261 return ERR_FAILED; | 269 return ERR_FAILED; |
| 262 } | 270 } |
| 271 virtual int Write(IOBuffer* buf, int buf_len, |
| 272 const CompletionCallback& callback) { |
| 273 return ERR_FAILED; |
| 274 } |
| 263 virtual bool SetReceiveBufferSize(int32 size) { return true; } | 275 virtual bool SetReceiveBufferSize(int32 size) { return true; } |
| 264 virtual bool SetSendBufferSize(int32 size) { return true; } | 276 virtual bool SetSendBufferSize(int32 size) { return true; } |
| 265 | 277 |
| 266 private: | 278 private: |
| 267 void DoOldCallback(OldCompletionCallback* callback) { | 279 void DoOldCallback(OldCompletionCallback* callback) { |
| 268 if (should_stall_) | 280 if (should_stall_) |
| 269 return; | 281 return; |
| 270 | 282 |
| 271 if (should_connect_) { | 283 if (should_connect_) { |
| 272 is_connected_ = true; | 284 is_connected_ = true; |
| (...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1267 EXPECT_TRUE(handle.socket()); | 1279 EXPECT_TRUE(handle.socket()); |
| 1268 IPEndPoint endpoint; | 1280 IPEndPoint endpoint; |
| 1269 handle.socket()->GetLocalAddress(&endpoint); | 1281 handle.socket()->GetLocalAddress(&endpoint); |
| 1270 EXPECT_EQ(kIPv4AddressSize, endpoint.address().size()); | 1282 EXPECT_EQ(kIPv4AddressSize, endpoint.address().size()); |
| 1271 EXPECT_EQ(1, client_socket_factory_.allocation_count()); | 1283 EXPECT_EQ(1, client_socket_factory_.allocation_count()); |
| 1272 } | 1284 } |
| 1273 | 1285 |
| 1274 } // namespace | 1286 } // namespace |
| 1275 | 1287 |
| 1276 } // namespace net | 1288 } // namespace net |
| OLD | NEW |