| 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 988 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   999     } |   999     } | 
|  1000   } |  1000   } | 
|  1001  |  1001  | 
|  1002   // GetDefaultLocalAddress should return the valid default address after set. |  1002   // GetDefaultLocalAddress should return the valid default address after set. | 
|  1003   manager.set_default_local_addresses(GetLoopbackIP(AF_INET), |  1003   manager.set_default_local_addresses(GetLoopbackIP(AF_INET), | 
|  1004                                       GetLoopbackIP(AF_INET6)); |  1004                                       GetLoopbackIP(AF_INET6)); | 
|  1005   EXPECT_TRUE(manager.GetDefaultLocalAddress(AF_INET, &ip)); |  1005   EXPECT_TRUE(manager.GetDefaultLocalAddress(AF_INET, &ip)); | 
|  1006   EXPECT_EQ(ip, GetLoopbackIP(AF_INET)); |  1006   EXPECT_EQ(ip, GetLoopbackIP(AF_INET)); | 
|  1007   EXPECT_TRUE(manager.GetDefaultLocalAddress(AF_INET6, &ip)); |  1007   EXPECT_TRUE(manager.GetDefaultLocalAddress(AF_INET6, &ip)); | 
|  1008   EXPECT_EQ(ip, GetLoopbackIP(AF_INET6)); |  1008   EXPECT_EQ(ip, GetLoopbackIP(AF_INET6)); | 
 |  1009  | 
 |  1010   // More tests on GetDefaultLocalAddress with ipv6 addresses where the set | 
 |  1011   // default address may be different from the best IP address of any network. | 
 |  1012   InterfaceAddress ip1; | 
 |  1013   EXPECT_TRUE(IPFromString("abcd::1234:5678:abcd:1111", | 
 |  1014                            IPV6_ADDRESS_FLAG_TEMPORARY, &ip1)); | 
 |  1015   // Create a network with a prefix of ip1. | 
 |  1016   Network ipv6_network("test_eth0", "Test NetworkAdapter", TruncateIP(ip1, 64), | 
 |  1017                        64); | 
 |  1018   IPAddress ip2; | 
 |  1019   EXPECT_TRUE(IPFromString("abcd::1234:5678:abcd:2222", &ip2)); | 
 |  1020   ipv6_network.AddIP(ip1); | 
 |  1021   ipv6_network.AddIP(ip2); | 
 |  1022   BasicNetworkManager::NetworkList list(1, new Network(ipv6_network)); | 
 |  1023   bool changed; | 
 |  1024   MergeNetworkList(manager, list, &changed); | 
 |  1025   // If the set default address is not in any network, GetDefaultLocalAddress | 
 |  1026   // should return it. | 
 |  1027   IPAddress ip3; | 
 |  1028   EXPECT_TRUE(IPFromString("abcd::1234:5678:abcd:3333", &ip3)); | 
 |  1029   manager.set_default_local_addresses(GetLoopbackIP(AF_INET), ip3); | 
 |  1030   EXPECT_TRUE(manager.GetDefaultLocalAddress(AF_INET6, &ip)); | 
 |  1031   EXPECT_EQ(ip3, ip); | 
 |  1032   // If the set default address is in a network, GetDefaultLocalAddress will | 
 |  1033   // return the best IP in that network. | 
 |  1034   manager.set_default_local_addresses(GetLoopbackIP(AF_INET), ip2); | 
 |  1035   EXPECT_TRUE(manager.GetDefaultLocalAddress(AF_INET6, &ip)); | 
 |  1036   EXPECT_EQ(static_cast<IPAddress>(ip1), ip); | 
 |  1037  | 
|  1009   manager.StopUpdating(); |  1038   manager.StopUpdating(); | 
|  1010 } |  1039 } | 
|  1011  |  1040  | 
|  1012 }  // namespace rtc |  1041 }  // namespace rtc | 
| OLD | NEW |