OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 | 568 |
569 TEST(IPAddressTest, TestIsLoopback) { | 569 TEST(IPAddressTest, TestIsLoopback) { |
570 EXPECT_FALSE(IPIsLoopback(IPAddress(INADDR_ANY))); | 570 EXPECT_FALSE(IPIsLoopback(IPAddress(INADDR_ANY))); |
571 EXPECT_FALSE(IPIsLoopback(IPAddress(kIPv4PublicAddr))); | 571 EXPECT_FALSE(IPIsLoopback(IPAddress(kIPv4PublicAddr))); |
572 EXPECT_FALSE(IPIsLoopback(IPAddress(in6addr_any))); | 572 EXPECT_FALSE(IPIsLoopback(IPAddress(in6addr_any))); |
573 EXPECT_FALSE(IPIsLoopback(IPAddress(kIPv6PublicAddr))); | 573 EXPECT_FALSE(IPIsLoopback(IPAddress(kIPv6PublicAddr))); |
574 EXPECT_FALSE(IPIsLoopback(IPAddress(kIPv4MappedAnyAddr))); | 574 EXPECT_FALSE(IPIsLoopback(IPAddress(kIPv4MappedAnyAddr))); |
575 EXPECT_FALSE(IPIsLoopback(IPAddress(kIPv4MappedPublicAddr))); | 575 EXPECT_FALSE(IPIsLoopback(IPAddress(kIPv4MappedPublicAddr))); |
576 | 576 |
577 EXPECT_TRUE(IPIsLoopback(IPAddress(INADDR_LOOPBACK))); | 577 EXPECT_TRUE(IPIsLoopback(IPAddress(INADDR_LOOPBACK))); |
| 578 // Try an address in the loopback range (127.0.0.0/8) other than the typical |
| 579 // 127.0.0.1. |
| 580 EXPECT_TRUE(IPIsLoopback(IPAddress(0x7f010203))); |
578 EXPECT_TRUE(IPIsLoopback(IPAddress(in6addr_loopback))); | 581 EXPECT_TRUE(IPIsLoopback(IPAddress(in6addr_loopback))); |
579 } | 582 } |
580 | 583 |
581 // Verify that IPIsAny catches all cases of "any" address. | 584 // Verify that IPIsAny catches all cases of "any" address. |
582 TEST(IPAddressTest, TestIsAny) { | 585 TEST(IPAddressTest, TestIsAny) { |
583 IPAddress addr; | 586 IPAddress addr; |
584 | 587 |
585 EXPECT_TRUE(IPFromString(kIPv6AnyAddrString, &addr)); | 588 EXPECT_TRUE(IPFromString(kIPv6AnyAddrString, &addr)); |
586 EXPECT_TRUE(IPIsAny(addr)); | 589 EXPECT_TRUE(IPIsAny(addr)); |
587 | 590 |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 IPAddress *paddr1 = &addr1; | 953 IPAddress *paddr1 = &addr1; |
951 IPAddress *paddr4 = &addr4; | 954 IPAddress *paddr4 = &addr4; |
952 EXPECT_EQ(*paddr1, *paddr4); | 955 EXPECT_EQ(*paddr1, *paddr4); |
953 | 956 |
954 InterfaceAddress addr5(kIPv6LinkLocalAddr, | 957 InterfaceAddress addr5(kIPv6LinkLocalAddr, |
955 IPV6_ADDRESS_FLAG_TEMPORARY); | 958 IPV6_ADDRESS_FLAG_TEMPORARY); |
956 EXPECT_NE(addr1, addr5); | 959 EXPECT_NE(addr1, addr5); |
957 } | 960 } |
958 | 961 |
959 } // namespace rtc | 962 } // namespace rtc |
OLD | NEW |