| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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_address.h" | 5 #include "net/base/ip_address.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 "192.168.0.1", | 245 "192.168.0.1", |
| 246 "::1", | 246 "::1", |
| 247 "/", | 247 "/", |
| 248 "/1", | 248 "/1", |
| 249 "1", | 249 "1", |
| 250 "192.168.1.1/-1", | 250 "192.168.1.1/-1", |
| 251 "192.168.1.1/33", | 251 "192.168.1.1/33", |
| 252 "::1/-3", | 252 "::1/-3", |
| 253 "a::3/129", | 253 "a::3/129", |
| 254 "::1/x", | 254 "::1/x", |
| 255 "192.168.0.1//11"}; | 255 "192.168.0.1//11", |
| 256 "192.168.1.1/+1", |
| 257 "192.168.1.1/ +1", |
| 258 "192.168.1.1/"}; |
| 256 | 259 |
| 257 for (const auto& bad_literal : bad_literals) { | 260 for (const auto& bad_literal : bad_literals) { |
| 258 IPAddress ip_address; | 261 IPAddress ip_address; |
| 259 size_t prefix_length_in_bits; | 262 size_t prefix_length_in_bits; |
| 260 | 263 |
| 261 EXPECT_FALSE( | 264 EXPECT_FALSE( |
| 262 ParseCIDRBlock(bad_literal, &ip_address, &prefix_length_in_bits)); | 265 ParseCIDRBlock(bad_literal, &ip_address, &prefix_length_in_bits)); |
| 263 } | 266 } |
| 264 } | 267 } |
| 265 | 268 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 | 321 |
| 319 // Prefix is longer than the address. | 322 // Prefix is longer than the address. |
| 320 uint8_t ipv6_prefix5[] = {42, 0, 20, 80, 64, 12, 12, 9, 0, | 323 uint8_t ipv6_prefix5[] = {42, 0, 20, 80, 64, 12, 12, 9, 0, |
| 321 0, 0, 0, 0, 0, 0, 0, 10}; | 324 0, 0, 0, 0, 0, 0, 0, 10}; |
| 322 EXPECT_FALSE(IPAddressStartsWith(ipv6_address, ipv6_prefix5)); | 325 EXPECT_FALSE(IPAddressStartsWith(ipv6_address, ipv6_prefix5)); |
| 323 } | 326 } |
| 324 | 327 |
| 325 } // anonymous namespace | 328 } // anonymous namespace |
| 326 | 329 |
| 327 } // namespace net | 330 } // namespace net |
| OLD | NEW |