| 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/net_util.h" | 5 #include "net/base/net_util.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 3499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3510 << "; is_unique: " << testing::PrintToString(data.is_unique); | 3510 << "; is_unique: " << testing::PrintToString(data.is_unique); |
| 3511 } | 3511 } |
| 3512 | 3512 |
| 3513 const NonUniqueNameTestData kNonUniqueNameTestData[] = { | 3513 const NonUniqueNameTestData kNonUniqueNameTestData[] = { |
| 3514 // Domains under ICANN-assigned domains. | 3514 // Domains under ICANN-assigned domains. |
| 3515 { true, "google.com" }, | 3515 { true, "google.com" }, |
| 3516 { true, "google.co.uk" }, | 3516 { true, "google.co.uk" }, |
| 3517 // Domains under private registries. | 3517 // Domains under private registries. |
| 3518 { true, "appspot.com" }, | 3518 { true, "appspot.com" }, |
| 3519 { true, "test.appspot.com" }, | 3519 { true, "test.appspot.com" }, |
| 3520 // IPv4 addresses (in various forms). | 3520 // Unreserved IPv4 addresses (in various forms). |
| 3521 { true, "8.8.8.8" }, | 3521 { true, "8.8.8.8" }, |
| 3522 { true, "1.2.3" }, | 3522 { true, "99.64.0.0" }, |
| 3523 { true, "14.15" }, | 3523 { true, "212.15.0.0" }, |
| 3524 { true, "676768" }, | 3524 { true, "212.15" }, |
| 3525 // IPv6 addresses. | 3525 { true, "212.15.0" }, |
| 3526 { true, "FEDC:ba98:7654:3210:FEDC:BA98:7654:3210" }, | 3526 { true, "3557752832" }, |
| 3527 { true, "::192.9.5.5" }, | 3527 // Reserved IPv4 addresses (in various forms). |
| 3528 { true, "FEED::BEEF" }, | 3528 { false, "192.168.0.0" }, |
| 3529 { false, "192.168.0.6" }, |
| 3530 { false, "10.0.0.5" }, |
| 3531 { false, "10.0" }, |
| 3532 { false, "10.0.0" }, |
| 3533 { false, "3232235526" }, |
| 3534 // Unreserved IPv6 addresses. |
| 3535 { true, "FFC0:ba98:7654:3210:FEDC:BA98:7654:3210" }, |
| 3536 { true, "2000:ba98:7654:2301:EFCD:BA98:7654:3210" }, |
| 3537 // Reserved IPv6 addresses. |
| 3538 { false, "::192.9.5.5" }, |
| 3539 { false, "FEED::BEEF" }, |
| 3540 { false, "FEC0:ba98:7654:3210:FEDC:BA98:7654:3210" }, |
| 3529 // 'internal'/non-IANA assigned domains. | 3541 // 'internal'/non-IANA assigned domains. |
| 3530 { false, "intranet" }, | 3542 { false, "intranet" }, |
| 3531 { false, "intranet." }, | 3543 { false, "intranet." }, |
| 3532 { false, "intranet.example" }, | 3544 { false, "intranet.example" }, |
| 3533 { false, "host.intranet.example" }, | 3545 { false, "host.intranet.example" }, |
| 3534 // gTLDs under discussion, but not yet assigned. | 3546 // gTLDs under discussion, but not yet assigned. |
| 3535 { false, "intranet.corp" }, | 3547 { false, "intranet.corp" }, |
| 3536 { false, "example.tech" }, | 3548 { false, "example.tech" }, |
| 3537 { false, "intranet.internal" }, | 3549 { false, "intranet.internal" }, |
| 3538 // Invalid host names are treated as unique - but expected to be | 3550 // Invalid host names are treated as unique - but expected to be |
| (...skipping 21 matching lines...) Expand all Loading... |
| 3560 TEST_P(NetUtilNonUniqueNameTest, IsHostnameNonUnique) { | 3572 TEST_P(NetUtilNonUniqueNameTest, IsHostnameNonUnique) { |
| 3561 const NonUniqueNameTestData& test_data = GetParam(); | 3573 const NonUniqueNameTestData& test_data = GetParam(); |
| 3562 | 3574 |
| 3563 EXPECT_EQ(test_data.is_unique, IsUnique(test_data.hostname)); | 3575 EXPECT_EQ(test_data.is_unique, IsUnique(test_data.hostname)); |
| 3564 } | 3576 } |
| 3565 | 3577 |
| 3566 INSTANTIATE_TEST_CASE_P(, NetUtilNonUniqueNameTest, | 3578 INSTANTIATE_TEST_CASE_P(, NetUtilNonUniqueNameTest, |
| 3567 testing::ValuesIn(kNonUniqueNameTestData)); | 3579 testing::ValuesIn(kNonUniqueNameTestData)); |
| 3568 | 3580 |
| 3569 } // namespace net | 3581 } // namespace net |
| OLD | NEW |