Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: webrtc/base/ipaddress_unittest.cc

Issue 1274013002: Bug 4865: Enable connectivity when the remote peer is on public internet. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/base/ipaddress.cc ('k') | webrtc/p2p/client/portallocator_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 EXPECT_FALSE(IPIsPrivate(IPAddress(kIPv6PublicAddr))); 537 EXPECT_FALSE(IPIsPrivate(IPAddress(kIPv6PublicAddr)));
538 EXPECT_FALSE(IPIsPrivate(IPAddress(kIPv4MappedAnyAddr))); 538 EXPECT_FALSE(IPIsPrivate(IPAddress(kIPv4MappedAnyAddr)));
539 EXPECT_FALSE(IPIsPrivate(IPAddress(kIPv4MappedPublicAddr))); 539 EXPECT_FALSE(IPIsPrivate(IPAddress(kIPv4MappedPublicAddr)));
540 540
541 EXPECT_TRUE(IPIsPrivate(IPAddress(kIPv4RFC1918Addr))); 541 EXPECT_TRUE(IPIsPrivate(IPAddress(kIPv4RFC1918Addr)));
542 EXPECT_TRUE(IPIsPrivate(IPAddress(INADDR_LOOPBACK))); 542 EXPECT_TRUE(IPIsPrivate(IPAddress(INADDR_LOOPBACK)));
543 EXPECT_TRUE(IPIsPrivate(IPAddress(in6addr_loopback))); 543 EXPECT_TRUE(IPIsPrivate(IPAddress(in6addr_loopback)));
544 EXPECT_TRUE(IPIsPrivate(IPAddress(kIPv6LinkLocalAddr))); 544 EXPECT_TRUE(IPIsPrivate(IPAddress(kIPv6LinkLocalAddr)));
545 } 545 }
546 546
547 TEST(IPAddressTest, TestIsNil) {
548 IPAddress addr;
549 EXPECT_TRUE(IPAddress().IsNil());
550
551 EXPECT_TRUE(IPFromString(kIPv6AnyAddrString, &addr));
552 EXPECT_FALSE(addr.IsNil());
553
554 EXPECT_TRUE(IPFromString(kIPv4AnyAddrString, &addr));
555 EXPECT_FALSE(addr.IsNil());
556
557 EXPECT_FALSE(IPAddress(kIPv4PublicAddr).IsNil());
558 }
559
547 TEST(IPAddressTest, TestIsLoopback) { 560 TEST(IPAddressTest, TestIsLoopback) {
548 EXPECT_FALSE(IPIsLoopback(IPAddress(INADDR_ANY))); 561 EXPECT_FALSE(IPIsLoopback(IPAddress(INADDR_ANY)));
549 EXPECT_FALSE(IPIsLoopback(IPAddress(kIPv4PublicAddr))); 562 EXPECT_FALSE(IPIsLoopback(IPAddress(kIPv4PublicAddr)));
550 EXPECT_FALSE(IPIsLoopback(IPAddress(in6addr_any))); 563 EXPECT_FALSE(IPIsLoopback(IPAddress(in6addr_any)));
551 EXPECT_FALSE(IPIsLoopback(IPAddress(kIPv6PublicAddr))); 564 EXPECT_FALSE(IPIsLoopback(IPAddress(kIPv6PublicAddr)));
552 EXPECT_FALSE(IPIsLoopback(IPAddress(kIPv4MappedAnyAddr))); 565 EXPECT_FALSE(IPIsLoopback(IPAddress(kIPv4MappedAnyAddr)));
553 EXPECT_FALSE(IPIsLoopback(IPAddress(kIPv4MappedPublicAddr))); 566 EXPECT_FALSE(IPIsLoopback(IPAddress(kIPv4MappedPublicAddr)));
554 567
555 EXPECT_TRUE(IPIsLoopback(IPAddress(INADDR_LOOPBACK))); 568 EXPECT_TRUE(IPIsLoopback(IPAddress(INADDR_LOOPBACK)));
556 EXPECT_TRUE(IPIsLoopback(IPAddress(in6addr_loopback))); 569 EXPECT_TRUE(IPIsLoopback(IPAddress(in6addr_loopback)));
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 IPAddress *paddr1 = &addr1; 935 IPAddress *paddr1 = &addr1;
923 IPAddress *paddr4 = &addr4; 936 IPAddress *paddr4 = &addr4;
924 EXPECT_EQ(*paddr1, *paddr4); 937 EXPECT_EQ(*paddr1, *paddr4);
925 938
926 InterfaceAddress addr5(kIPv6LinkLocalAddr, 939 InterfaceAddress addr5(kIPv6LinkLocalAddr,
927 IPV6_ADDRESS_FLAG_TEMPORARY); 940 IPV6_ADDRESS_FLAG_TEMPORARY);
928 EXPECT_NE(addr1, addr5); 941 EXPECT_NE(addr1, addr5);
929 } 942 }
930 943
931 } // namespace rtc 944 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/ipaddress.cc ('k') | webrtc/p2p/client/portallocator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698