Chromium Code Reviews| Index: net/socket/socks_client_socket_unittest.cc |
| diff --git a/net/socket/socks_client_socket_unittest.cc b/net/socket/socks_client_socket_unittest.cc |
| index f361244feff01a7dfa3138a7bc4ded1f36b13e29..510e59a5cad508b61b0bfc584c7afcb38721aa61 100644 |
| --- a/net/socket/socks_client_socket_unittest.cc |
| +++ b/net/socket/socks_client_socket_unittest.cc |
| @@ -10,6 +10,7 @@ |
| #include "net/base/net_log_unittest.h" |
| #include "net/base/test_completion_callback.h" |
| #include "net/base/winsock_init.h" |
| +#include "net/dns/host_resolver.h" |
| #include "net/dns/mock_host_resolver.h" |
| #include "net/socket/client_socket_factory.h" |
| #include "net/socket/socket_test_util.h" |
| @@ -414,4 +415,25 @@ TEST_F(SOCKSClientSocketTest, DisconnectWhileHostResolveInProgress) { |
| EXPECT_FALSE(user_sock_->IsConnectedAndIdle()); |
| } |
| +// Tries to connect to an IPv6 IP. Should fail, as SOCKS4 does not support |
| +// IPv6. |
| +TEST_F(SOCKSClientSocketTest, NoIPv6) { |
| + const char kHostName[] = "::1"; |
| + |
| + // Use a real HostResolver for this test, as the MockHostResolver has its own |
|
Deprecated (see juliatuttle)
2014/08/04 20:32:20
Perhaps test the behavior of both of them, to ensu
mmenke
2014/08/05 22:50:38
Done.
|
| + // code to handle raw IP addresses, and this serves to test that code as |
| + // well. |
| + scoped_ptr<HostResolver> host_resolver( |
| + HostResolver::CreateSystemResolver(HostResolver::Options(), NULL)); |
| + |
| + user_sock_ = BuildMockSocket(NULL, 0, |
| + NULL, 0, |
| + host_resolver.get(), |
| + kHostName, 80, |
| + NULL); |
| + |
| + EXPECT_EQ(ERR_NAME_NOT_RESOLVED, |
| + callback_.GetResult(user_sock_->Connect(callback_.callback()))); |
| +} |
| + |
| } // namespace net |