| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/tcp_client_socket.h" | 5 #include "net/socket/tcp_client_socket.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "net/base/address_list.h" | 8 #include "net/base/address_list.h" |
| 9 #include "net/base/host_resolver.h" | 9 #include "net/base/host_resolver.h" |
| 10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 class TCPClientSocketTest | 26 class TCPClientSocketTest |
| 27 : public PlatformTest, public ListenSocket::ListenSocketDelegate { | 27 : public PlatformTest, public ListenSocket::ListenSocketDelegate { |
| 28 public: | 28 public: |
| 29 TCPClientSocketTest() : net_log_(CapturingNetLog::kUnbounded) { | 29 TCPClientSocketTest() : net_log_(CapturingNetLog::kUnbounded) { |
| 30 } | 30 } |
| 31 | 31 |
| 32 // Implement ListenSocketDelegate methods | 32 // Implement ListenSocketDelegate methods |
| 33 virtual void DidAccept(ListenSocket* server, ListenSocket* connection) { | 33 virtual void DidAccept(ListenSocket* server, ListenSocket* connection) { |
| 34 connected_sock_ = connection; | 34 connected_sock_ = connection; |
| 35 } | 35 } |
| 36 virtual void DidRead(ListenSocket*, const std::string& s) { | 36 virtual void DidRead(ListenSocket*, const char* str, int len) { |
| 37 // TODO(dkegel): this might not be long enough to tickle some bugs. | 37 // TODO(dkegel): this might not be long enough to tickle some bugs. |
| 38 connected_sock_->Send(kServerReply, | 38 connected_sock_->Send(kServerReply, |
| 39 arraysize(kServerReply) - 1, | 39 arraysize(kServerReply) - 1, |
| 40 false /* don't append line feed */); | 40 false /* don't append line feed */); |
| 41 } | 41 } |
| 42 virtual void DidClose(ListenSocket* sock) {} | 42 virtual void DidClose(ListenSocket* sock) {} |
| 43 | 43 |
| 44 // Testcase hooks | 44 // Testcase hooks |
| 45 virtual void SetUp(); | 45 virtual void SetUp(); |
| 46 | 46 |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 // Close the server socket, so there will at least be a 0-byte read. | 338 // Close the server socket, so there will at least be a 0-byte read. |
| 339 CloseServerSocket(); | 339 CloseServerSocket(); |
| 340 | 340 |
| 341 rv = callback.WaitForResult(); | 341 rv = callback.WaitForResult(); |
| 342 EXPECT_GE(rv, 0); | 342 EXPECT_GE(rv, 0); |
| 343 } | 343 } |
| 344 | 344 |
| 345 } // namespace | 345 } // namespace |
| 346 | 346 |
| 347 } // namespace net | 347 } // namespace net |
| OLD | NEW |