OLD | NEW |
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/address_list.h" | 5 #include "net/base/address_list.h" |
6 | 6 |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "base/sys_byteorder.h" | 8 #include "base/sys_byteorder.h" |
9 #include "net/base/net_util.h" | 9 #include "net/base/net_util.h" |
10 #include "net/base/sys_addrinfo.h" | 10 #include "net/base/sys_addrinfo.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 AF_INET, | 114 AF_INET, |
115 sizeof(struct sockaddr_in), | 115 sizeof(struct sockaddr_in), |
116 offsetof(struct sockaddr_in, sin_addr), | 116 offsetof(struct sockaddr_in, sin_addr), |
117 sizeof(struct in_addr), | 117 sizeof(struct in_addr), |
118 }, | 118 }, |
119 }; | 119 }; |
120 const std::string kCanonicalName = "canonical.example.com"; | 120 const std::string kCanonicalName = "canonical.example.com"; |
121 | 121 |
122 // Construct a list of ip addresses. | 122 // Construct a list of ip addresses. |
123 IPAddressList ip_list; | 123 IPAddressList ip_list; |
124 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 124 for (size_t i = 0; i < arraysize(tests); ++i) { |
125 IPAddressNumber ip_number; | 125 IPAddressNumber ip_number; |
126 ASSERT_TRUE(ParseIPLiteralToNumber(tests[i].ip_address, &ip_number)); | 126 ASSERT_TRUE(ParseIPLiteralToNumber(tests[i].ip_address, &ip_number)); |
127 ip_list.push_back(ip_number); | 127 ip_list.push_back(ip_number); |
128 } | 128 } |
129 | 129 |
130 AddressList test_list = AddressList::CreateFromIPAddressList(ip_list, | 130 AddressList test_list = AddressList::CreateFromIPAddressList(ip_list, |
131 kCanonicalName); | 131 kCanonicalName); |
132 std::string canonical_name; | 132 std::string canonical_name; |
133 EXPECT_EQ(kCanonicalName, test_list.canonical_name()); | 133 EXPECT_EQ(kCanonicalName, test_list.canonical_name()); |
134 EXPECT_EQ(ARRAYSIZE_UNSAFE(tests), test_list.size()); | 134 EXPECT_EQ(arraysize(tests), test_list.size()); |
135 } | 135 } |
136 | 136 |
137 } // namespace | 137 } // namespace |
138 } // namespace net | 138 } // namespace net |
OLD | NEW |