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