Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(930)

Unified Diff: net/socket/socks_client_socket_unittest.cc

Issue 435603008: Fix crash when trying to connect to an IPv6 IP via a SOCKS4 proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix a couple issues Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« net/dns/host_resolver_impl.cc ('K') | « net/dns/mock_host_resolver.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« net/dns/host_resolver_impl.cc ('K') | « net/dns/mock_host_resolver.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698