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

Unified Diff: net/base/ip_endpoint_unittest.cc

Issue 6685013: Use IPEndPoint for P2P IPC messages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 9 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_endpoint.cc ('K') | « net/base/ip_endpoint.cc ('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 ae09ad363e18ce20437c648515741dbeea5006e6..17f6e0b22808a287dd9db331b9d7c5b37a10a68a 100644
--- a/net/base/ip_endpoint_unittest.cc
+++ b/net/base/ip_endpoint_unittest.cc
@@ -4,6 +4,7 @@
#include "net/base/ip_endpoint.h"
+#include "base/string_number_conversions.h"
#include "net/base/net_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
@@ -19,13 +20,14 @@ namespace {
struct TestData {
std::string host;
+ std::string host_normalized;
bool ipv6;
IPAddressNumber ip_address;
} tests[] = {
- { "127.0.00.1", false},
- { "192.168.1.1", false },
- { "::1", true },
- { "2001:db8:0::42", true },
+ { "127.0.00.1", "127.0.0.1", false},
+ { "192.168.1.1", "192.168.1.1", false },
+ { "::1", "::1", true },
+ { "2001:db8:0::42", "2001:db8::42", true },
};
int test_count = ARRAYSIZE_UNSAFE(tests);
@@ -136,6 +138,18 @@ TEST_F(IPEndPointTest, LessThan) {
EXPECT_TRUE(ip_endpoint1 < ip_endpoint2);
}
+TEST_F(IPEndPointTest, ToString) {
+ IPEndPoint endpoint;
+ EXPECT_EQ(0, endpoint.port());
+
+ for (int index = 0; index < test_count; ++index) {
+ int port = 100 + index;
+ IPEndPoint endpoint(tests[index].ip_address, port);
+ EXPECT_EQ(tests[index].host_normalized + ":" + base::IntToString(port),
+ endpoint.ToString());
+ }
+}
+
} // namespace
} // namespace net
« net/base/ip_endpoint.cc ('K') | « net/base/ip_endpoint.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698