| 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/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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 ASSERT_TRUE(sock != NULL); | 115 ASSERT_TRUE(sock != NULL); |
| 116 listen_sock_ = sock; | 116 listen_sock_ = sock; |
| 117 listen_port_ = port; | 117 listen_port_ = port; |
| 118 | 118 |
| 119 AddressList addr; | 119 AddressList addr; |
| 120 scoped_ptr<HostResolver> resolver( | 120 scoped_ptr<HostResolver> resolver( |
| 121 CreateSystemHostResolver(HostResolver::kDefaultParallelism, | 121 CreateSystemHostResolver(HostResolver::kDefaultParallelism, |
| 122 HostResolver::kDefaultRetryAttempts, | 122 HostResolver::kDefaultRetryAttempts, |
| 123 NULL)); | 123 NULL)); |
| 124 HostResolver::RequestInfo info(HostPortPair("localhost", listen_port_)); | 124 HostResolver::RequestInfo info(HostPortPair("localhost", listen_port_)); |
| 125 TestOldCompletionCallback callback; | 125 TestCompletionCallback callback; |
| 126 int rv = resolver->Resolve(info, &addr, &callback, NULL, BoundNetLog()); | 126 int rv = resolver->Resolve(info, &addr, callback.callback(), NULL, |
| 127 BoundNetLog()); |
| 127 CHECK_EQ(ERR_IO_PENDING, rv); | 128 CHECK_EQ(ERR_IO_PENDING, rv); |
| 128 rv = callback.WaitForResult(); | 129 rv = callback.WaitForResult(); |
| 129 CHECK_EQ(rv, OK); | 130 CHECK_EQ(rv, OK); |
| 130 sock_.reset( | 131 sock_.reset( |
| 131 socket_factory_->CreateTransportClientSocket(addr, | 132 socket_factory_->CreateTransportClientSocket(addr, |
| 132 &net_log_, | 133 &net_log_, |
| 133 NetLog::Source())); | 134 NetLog::Source())); |
| 134 } | 135 } |
| 135 | 136 |
| 136 int TransportClientSocketTest::DrainClientSocket( | 137 int TransportClientSocketTest::DrainClientSocket( |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 // Close the server socket, so there will at least be a 0-byte read. | 438 // Close the server socket, so there will at least be a 0-byte read. |
| 438 CloseServerSocket(); | 439 CloseServerSocket(); |
| 439 | 440 |
| 440 rv = callback.WaitForResult(); | 441 rv = callback.WaitForResult(); |
| 441 EXPECT_GE(rv, 0); | 442 EXPECT_GE(rv, 0); |
| 442 } | 443 } |
| 443 | 444 |
| 444 } // namespace | 445 } // namespace |
| 445 | 446 |
| 446 } // namespace net | 447 } // namespace net |
| OLD | NEW |