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

Unified Diff: net/dns/host_resolver_impl_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: Response to eroman's comments Created 6 years, 4 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
« no previous file with comments | « net/dns/host_resolver_impl.cc ('k') | net/dns/mock_host_resolver.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/host_resolver_impl_unittest.cc
diff --git a/net/dns/host_resolver_impl_unittest.cc b/net/dns/host_resolver_impl_unittest.cc
index 4ab8fdf1c3689c441109731ef6682f325dfc9de3..89112de718012afa962b9fd54b8ff0b35103fcee 100644
--- a/net/dns/host_resolver_impl_unittest.cc
+++ b/net/dns/host_resolver_impl_unittest.cc
@@ -1236,6 +1236,33 @@ TEST_F(HostResolverImplTest, SetDefaultAddressFamily_IPv6) {
EXPECT_TRUE(requests_[2]->HasOneAddress("1.0.0.1", 80));
}
+// Make sure that the address family parameter is respected when raw IPs are
+// passed in.
+TEST_F(HostResolverImplTest, AddressFamilyWithRawIPs) {
+ Request* request =
+ CreateRequest("127.0.0.1", 80, MEDIUM, ADDRESS_FAMILY_IPV4);
+ EXPECT_EQ(OK, request->Resolve());
+ EXPECT_TRUE(request->HasOneAddress("127.0.0.1", 80));
+
+ request = CreateRequest("127.0.0.1", 80, MEDIUM, ADDRESS_FAMILY_IPV6);
+ EXPECT_EQ(ERR_NAME_NOT_RESOLVED, request->Resolve());
+
+ request = CreateRequest("127.0.0.1", 80, MEDIUM, ADDRESS_FAMILY_UNSPECIFIED);
+ EXPECT_EQ(OK, request->Resolve());
+ EXPECT_TRUE(request->HasOneAddress("127.0.0.1", 80));
+
+ request = CreateRequest("::1", 80, MEDIUM, ADDRESS_FAMILY_IPV4);
+ EXPECT_EQ(ERR_NAME_NOT_RESOLVED, request->Resolve());
+
+ request = CreateRequest("::1", 80, MEDIUM, ADDRESS_FAMILY_IPV6);
+ EXPECT_EQ(OK, request->Resolve());
+ EXPECT_TRUE(request->HasOneAddress("::1", 80));
+
+ request = CreateRequest("::1", 80, MEDIUM, ADDRESS_FAMILY_UNSPECIFIED);
+ EXPECT_EQ(OK, request->Resolve());
+ EXPECT_TRUE(request->HasOneAddress("::1", 80));
+}
+
TEST_F(HostResolverImplTest, ResolveFromCache) {
proc_->AddRuleForAllFamilies("just.testing", "192.168.1.42");
proc_->SignalMultiple(1u); // Need only one.
« no previous file with comments | « net/dns/host_resolver_impl.cc ('k') | net/dns/mock_host_resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698