| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/socks5_client_socket.h" | 5 #include "net/socket/socks5_client_socket.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <ws2tcpip.h> | 10 #include <ws2tcpip.h> |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 SOCKS5ClientSocketTest::SOCKS5ClientSocketTest() | 52 SOCKS5ClientSocketTest::SOCKS5ClientSocketTest() |
| 53 : kNwPort(htons(80)), host_resolver_(new MockHostResolver) { | 53 : kNwPort(htons(80)), host_resolver_(new MockHostResolver) { |
| 54 } | 54 } |
| 55 | 55 |
| 56 // Set up platform before every test case | 56 // Set up platform before every test case |
| 57 void SOCKS5ClientSocketTest::SetUp() { | 57 void SOCKS5ClientSocketTest::SetUp() { |
| 58 PlatformTest::SetUp(); | 58 PlatformTest::SetUp(); |
| 59 | 59 |
| 60 // Resolve the "localhost" AddressList used by the TCP connection to connect. | 60 // Resolve the "localhost" AddressList used by the TCP connection to connect. |
| 61 HostResolver::RequestInfo info("www.socks-proxy.com", 1080); | 61 HostResolver::RequestInfo info("www.socks-proxy.com", 1080); |
| 62 int rv = host_resolver_->Resolve(info, &address_list_, NULL, NULL); | 62 int rv = host_resolver_->Resolve(NULL, info, &address_list_, NULL, NULL); |
| 63 ASSERT_EQ(OK, rv); | 63 ASSERT_EQ(OK, rv); |
| 64 } | 64 } |
| 65 | 65 |
| 66 SOCKS5ClientSocket* SOCKS5ClientSocketTest::BuildMockSocket( | 66 SOCKS5ClientSocket* SOCKS5ClientSocketTest::BuildMockSocket( |
| 67 MockRead reads[], | 67 MockRead reads[], |
| 68 MockWrite writes[], | 68 MockWrite writes[], |
| 69 const std::string& hostname, | 69 const std::string& hostname, |
| 70 int port) { | 70 int port) { |
| 71 | 71 |
| 72 TestCompletionCallback callback; | 72 TestCompletionCallback callback; |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 int rv = user_sock_->Connect(&callback_); | 279 int rv = user_sock_->Connect(&callback_); |
| 280 EXPECT_EQ(ERR_IO_PENDING, rv); | 280 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 281 rv = callback_.WaitForResult(); | 281 rv = callback_.WaitForResult(); |
| 282 EXPECT_EQ(OK, rv); | 282 EXPECT_EQ(OK, rv); |
| 283 EXPECT_TRUE(user_sock_->IsConnected()); | 283 EXPECT_TRUE(user_sock_->IsConnected()); |
| 284 } | 284 } |
| 285 } | 285 } |
| 286 | 286 |
| 287 } // namespace net | 287 } // namespace net |
| 288 | 288 |
| OLD | NEW |