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/socks_client_socket.h" | 5 #include "net/socket/socks_client_socket.h" |
6 | 6 |
7 #include "net/base/address_list.h" | 7 #include "net/base/address_list.h" |
8 #include "net/base/net_log.h" | 8 #include "net/base/net_log.h" |
9 #include "net/base/net_log_unittest.h" | 9 #include "net/base/net_log_unittest.h" |
10 #include "net/base/mock_host_resolver.h" | 10 #include "net/base/mock_host_resolver.h" |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 EXPECT_EQ(SOCKSClientSocket::kSOCKS4a, user_sock_->socks_version_); | 334 EXPECT_EQ(SOCKSClientSocket::kSOCKS4a, user_sock_->socks_version_); |
335 EXPECT_TRUE(LogContainsEndEvent( | 335 EXPECT_TRUE(LogContainsEndEvent( |
336 log.entries(), -1, NetLog::TYPE_SOCKS_CONNECT)); | 336 log.entries(), -1, NetLog::TYPE_SOCKS_CONNECT)); |
337 } | 337 } |
338 | 338 |
339 // Tries to connect to a domain that resolves to IPv6. | 339 // Tries to connect to a domain that resolves to IPv6. |
340 // Should revert to SOCKS4a. | 340 // Should revert to SOCKS4a. |
341 TEST_F(SOCKSClientSocketTest, SOCKS4AIfDomainInIPv6) { | 341 TEST_F(SOCKSClientSocketTest, SOCKS4AIfDomainInIPv6) { |
342 const char hostname[] = "an.ipv6.address"; | 342 const char hostname[] = "an.ipv6.address"; |
343 | 343 |
344 host_resolver_->rules()->AddIPv6Rule(hostname, "2001:db8:8714:3a90::12"); | 344 host_resolver_->rules()->AddIPv6Rule(hostname, "2001:db8:8714:3a90::12", ""); |
345 | 345 |
346 std::string request(kSOCKS4aInitialRequest, | 346 std::string request(kSOCKS4aInitialRequest, |
347 arraysize(kSOCKS4aInitialRequest)); | 347 arraysize(kSOCKS4aInitialRequest)); |
348 request.append(hostname, arraysize(hostname)); | 348 request.append(hostname, arraysize(hostname)); |
349 | 349 |
350 MockWrite data_writes[] = { | 350 MockWrite data_writes[] = { |
351 MockWrite(false, request.data(), request.size()) }; | 351 MockWrite(false, request.data(), request.size()) }; |
352 MockRead data_reads[] = { | 352 MockRead data_reads[] = { |
353 MockRead(false, kSOCKSOkReply, arraysize(kSOCKSOkReply)) }; | 353 MockRead(false, kSOCKSOkReply, arraysize(kSOCKSOkReply)) }; |
354 CapturingNetLog log(CapturingNetLog::kUnbounded); | 354 CapturingNetLog log(CapturingNetLog::kUnbounded); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 // Disconnect the SOCKS socket -- this should cancel the outstanding resolve. | 396 // Disconnect the SOCKS socket -- this should cancel the outstanding resolve. |
397 user_sock_->Disconnect(); | 397 user_sock_->Disconnect(); |
398 | 398 |
399 EXPECT_FALSE(hanging_resolver->HasOutstandingRequest()); | 399 EXPECT_FALSE(hanging_resolver->HasOutstandingRequest()); |
400 | 400 |
401 EXPECT_FALSE(user_sock_->IsConnected()); | 401 EXPECT_FALSE(user_sock_->IsConnected()); |
402 EXPECT_FALSE(user_sock_->IsConnectedAndIdle()); | 402 EXPECT_FALSE(user_sock_->IsConnectedAndIdle()); |
403 } | 403 } |
404 | 404 |
405 } // namespace net | 405 } // namespace net |
OLD | NEW |