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 3291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3302 it->address.size() == kIPv6AddressSize) | 3302 it->address.size() == kIPv6AddressSize) |
3303 << "Invalid address of size " << it->address.size(); | 3303 << "Invalid address of size " << it->address.size(); |
3304 bool all_zeroes = true; | 3304 bool all_zeroes = true; |
3305 for (size_t i = 0; i < it->address.size(); ++i) { | 3305 for (size_t i = 0; i < it->address.size(); ++i) { |
3306 if (it->address[i] != 0) { | 3306 if (it->address[i] != 0) { |
3307 all_zeroes = false; | 3307 all_zeroes = false; |
3308 break; | 3308 break; |
3309 } | 3309 } |
3310 } | 3310 } |
3311 EXPECT_FALSE(all_zeroes); | 3311 EXPECT_FALSE(all_zeroes); |
3312 | |
3313 #if !defined(OS_ANDROID) | |
3314 EXPECT_GE(it->network_prefix, 1u); | |
3315 EXPECT_TRUE(it->address.size() != kIPv4AddressSize || | |
3316 it->network_prefix <= 32u); | |
szym
2013/09/20 19:30:15
Point-to-point addresses have no netmask. Will the
| |
3317 #endif // OS_ANDROID | |
3312 } | 3318 } |
3313 } | 3319 } |
3314 | 3320 |
3315 static const base::FilePath::CharType* kSafePortableBasenames[] = { | 3321 static const base::FilePath::CharType* kSafePortableBasenames[] = { |
3316 FILE_PATH_LITERAL("a"), | 3322 FILE_PATH_LITERAL("a"), |
3317 FILE_PATH_LITERAL("a.txt"), | 3323 FILE_PATH_LITERAL("a.txt"), |
3318 FILE_PATH_LITERAL("a b.txt"), | 3324 FILE_PATH_LITERAL("a b.txt"), |
3319 FILE_PATH_LITERAL("a-b.txt"), | 3325 FILE_PATH_LITERAL("a-b.txt"), |
3320 FILE_PATH_LITERAL("My Computer"), | 3326 FILE_PATH_LITERAL("My Computer"), |
3321 FILE_PATH_LITERAL(" Computer"), | 3327 FILE_PATH_LITERAL(" Computer"), |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3468 TEST_P(NetUtilNonUniqueNameTest, IsHostnameNonUnique) { | 3474 TEST_P(NetUtilNonUniqueNameTest, IsHostnameNonUnique) { |
3469 const NonUniqueNameTestData& test_data = GetParam(); | 3475 const NonUniqueNameTestData& test_data = GetParam(); |
3470 | 3476 |
3471 EXPECT_EQ(test_data.is_unique, IsUnique(test_data.hostname)); | 3477 EXPECT_EQ(test_data.is_unique, IsUnique(test_data.hostname)); |
3472 } | 3478 } |
3473 | 3479 |
3474 INSTANTIATE_TEST_CASE_P(, NetUtilNonUniqueNameTest, | 3480 INSTANTIATE_TEST_CASE_P(, NetUtilNonUniqueNameTest, |
3475 testing::ValuesIn(kNonUniqueNameTestData)); | 3481 testing::ValuesIn(kNonUniqueNameTestData)); |
3476 | 3482 |
3477 } // namespace net | 3483 } // namespace net |
OLD | NEW |