Chromium Code Reviews| 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 3501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 // 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" }, |
|
Ryan Sleevi
2013/08/13 20:45:39
Note: This was testing the two-dot form, but the r
felt
2013/08/14 14:18:14
restructured this so that it has all the same test
| |
| 3523 { true, "14.15" }, | 3523 { true, "212.15" }, |
| 3524 { true, "676768" }, | 3524 { false, "192.168.0.0" }, |
|
Ryan Sleevi
2013/08/13 20:45:39
Note: This was testing the dotless form (pure numb
felt
2013/08/14 14:18:14
Done.
| |
| 3525 { false, "192.168.0.6" }, | |
| 3526 { false, "10.0.0.5" }, | |
| 3525 // IPv6 addresses. | 3527 // IPv6 addresses. |
| 3526 { true, "FEDC:ba98:7654:3210:FEDC:BA98:7654:3210" }, | 3528 { true, "FFC0:ba98:7654:3210:FEDC:BA98:7654:3210" }, |
| 3527 { true, "::192.9.5.5" }, | 3529 { true, "2000:ba98:7654:2301:EFCD:BA98:7654:3210" }, |
| 3528 { true, "FEED::BEEF" }, | 3530 { false, "::192.9.5.5" }, |
| 3531 { false, "FEED::BEEF" }, | |
| 3532 { false, "FEC0:ba98:7654:3210:FEDC:BA98:7654:3210" }, | |
| 3529 // 'internal'/non-IANA assigned domains. | 3533 // 'internal'/non-IANA assigned domains. |
| 3530 { false, "intranet" }, | 3534 { false, "intranet" }, |
| 3531 { false, "intranet." }, | 3535 { false, "intranet." }, |
| 3532 { false, "intranet.example" }, | 3536 { false, "intranet.example" }, |
| 3533 { false, "host.intranet.example" }, | 3537 { false, "host.intranet.example" }, |
| 3534 // gTLDs under discussion, but not yet assigned. | 3538 // gTLDs under discussion, but not yet assigned. |
| 3535 { false, "intranet.corp" }, | 3539 { false, "intranet.corp" }, |
| 3536 { false, "example.tech" }, | 3540 { false, "example.tech" }, |
| 3537 { false, "intranet.internal" }, | 3541 { false, "intranet.internal" }, |
| 3538 // Invalid host names are treated as unique - but expected to be | 3542 // Invalid host names are treated as unique - but expected to be |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 3560 TEST_P(NetUtilNonUniqueNameTest, IsHostnameNonUnique) { | 3564 TEST_P(NetUtilNonUniqueNameTest, IsHostnameNonUnique) { |
| 3561 const NonUniqueNameTestData& test_data = GetParam(); | 3565 const NonUniqueNameTestData& test_data = GetParam(); |
| 3562 | 3566 |
| 3563 EXPECT_EQ(test_data.is_unique, IsUnique(test_data.hostname)); | 3567 EXPECT_EQ(test_data.is_unique, IsUnique(test_data.hostname)); |
| 3564 } | 3568 } |
| 3565 | 3569 |
| 3566 INSTANTIATE_TEST_CASE_P(, NetUtilNonUniqueNameTest, | 3570 INSTANTIATE_TEST_CASE_P(, NetUtilNonUniqueNameTest, |
| 3567 testing::ValuesIn(kNonUniqueNameTestData)); | 3571 testing::ValuesIn(kNonUniqueNameTestData)); |
| 3568 | 3572 |
| 3569 } // namespace net | 3573 } // namespace net |
| OLD | NEW |