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

Side by Side Diff: net/base/ip_endpoint_unittest.cc

Issue 1676023002: Make IPAddress::FromIPLiteral a member function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/base/ip_endpoint.h" 5 #include "net/base/ip_endpoint.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <winsock2.h> 10 #include <winsock2.h>
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 { "::1", "[::1]", true }, 61 { "::1", "[::1]", true },
62 { "2001:db8:0::42", "[2001:db8::42]", true }, 62 { "2001:db8:0::42", "[2001:db8::42]", true },
63 }; 63 };
64 uint16_t test_count = static_cast<uint16_t>(arraysize(tests)); 64 uint16_t test_count = static_cast<uint16_t>(arraysize(tests));
65 65
66 class IPEndPointTest : public PlatformTest { 66 class IPEndPointTest : public PlatformTest {
67 public: 67 public:
68 void SetUp() override { 68 void SetUp() override {
69 // This is where we populate the TestData. 69 // This is where we populate the TestData.
70 for (int index = 0; index < test_count; ++index) { 70 for (int index = 0; index < test_count; ++index) {
71 EXPECT_TRUE(IPAddress::FromIPLiteral(tests[index].host, 71 EXPECT_TRUE(
72 &tests[index].ip_address)); 72 tests[index].ip_address.AssignFromIPLiteral(tests[index].host));
73 } 73 }
74 } 74 }
75 }; 75 };
76 76
77 TEST_F(IPEndPointTest, Constructor) { 77 TEST_F(IPEndPointTest, Constructor) {
78 IPEndPoint endpoint; 78 IPEndPoint endpoint;
79 EXPECT_EQ(0, endpoint.port()); 79 EXPECT_EQ(0, endpoint.port());
80 80
81 for (uint16_t index = 0; index < test_count; ++index) { 81 for (uint16_t index = 0; index < test_count; ++index) {
82 IPEndPoint endpoint(tests[index].ip_address, 80); 82 IPEndPoint endpoint(tests[index].ip_address, 80);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 IPEndPoint endpoint(tests[index].ip_address, port); 196 IPEndPoint endpoint(tests[index].ip_address, port);
197 const std::string result = endpoint.ToString(); 197 const std::string result = endpoint.ToString();
198 EXPECT_EQ(tests[index].host_normalized + ":" + base::UintToString(port), 198 EXPECT_EQ(tests[index].host_normalized + ":" + base::UintToString(port),
199 result); 199 result);
200 } 200 }
201 } 201 }
202 202
203 } // namespace 203 } // namespace
204 204
205 } // namespace net 205 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698