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

Unified Diff: net/base/ip_address_unittest.cc

Issue 2881673002: Avoid heap allocations in IPAddress (Closed)
Patch Set: Address comments Created 3 years, 7 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
Index: net/base/ip_address_unittest.cc
diff --git a/net/base/ip_address_unittest.cc b/net/base/ip_address_unittest.cc
index b7a04ad213f3aedd5937dd8abe7a7f272436a623..d1dcf896329dab92b1c94b5941ab4d743581eec0 100644
--- a/net/base/ip_address_unittest.cc
+++ b/net/base/ip_address_unittest.cc
@@ -190,6 +190,7 @@ TEST(IPAddressTest, IsReservedIPv4) {
IPAddress address;
for (const auto& test : tests) {
EXPECT_TRUE(address.AssignFromIPLiteral(test.address));
+ ASSERT_TRUE(address.IsValid());
EXPECT_EQ(!!test.is_reserved, address.IsReserved());
}
}
@@ -420,6 +421,11 @@ TEST(IPAddressTest, LessThan) {
EXPECT_TRUE(ip_address3.AssignFromIPLiteral("127.0.0.1"));
EXPECT_FALSE(ip_address1 < ip_address3);
EXPECT_FALSE(ip_address3 < ip_address1);
+
+ IPAddress ip_address4;
+ EXPECT_TRUE(ip_address4.AssignFromIPLiteral("128.0.0.0"));
+ EXPECT_TRUE(ip_address1 < ip_address4);
+ EXPECT_FALSE(ip_address4 < ip_address1);
}
// Test mapping an IPv4 address to an IPv6 address.

Powered by Google App Engine
This is Rietveld 408576698