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

Unified Diff: net/base/ip_endpoint_unittest.cc

Issue 1692353002: Make IP Address related functions return the empty string when used on an invalid address. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes Created 4 years, 10 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/base/ip_address_number.cc ('K') | « net/base/ip_endpoint.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/ip_endpoint_unittest.cc
diff --git a/net/base/ip_endpoint_unittest.cc b/net/base/ip_endpoint_unittest.cc
index 9f7c0f0b21b6c5222309d5666ce87750a90c6043..b3aa5b190dee5af5ad2130f94ca8266e00006f54 100644
--- a/net/base/ip_endpoint_unittest.cc
+++ b/net/base/ip_endpoint_unittest.cc
@@ -198,6 +198,12 @@ TEST_F(IPEndPointTest, ToString) {
EXPECT_EQ(tests[index].host_normalized + ":" + base::UintToString(port),
result);
}
+
+ // ToString() shouldn't crash on invalid addresses.
+ IPAddress invalid_address;
+ IPEndPoint invalid_endpoint(invalid_address, 8080);
+ EXPECT_EQ("", invalid_endpoint.ToString());
+ EXPECT_EQ("", invalid_endpoint.ToStringWithoutPort());
}
} // namespace
« net/base/ip_address_number.cc ('K') | « net/base/ip_endpoint.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698