| 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
|
|
|