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

Side by Side Diff: content/renderer/p2p/ipc_network_manager_unittest.cc

Issue 580283002: Interface change for net_util.h for WebRTC IPv6 support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: modify one extra test case for the new NetworkInterface constructor parameter Created 6 years, 2 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 | « content/common/p2p_messages.h ('k') | net/base/net_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "content/renderer/p2p/ipc_network_manager.h" 6 #include "content/renderer/p2p/ipc_network_manager.h"
7 #include "content/renderer/p2p/network_list_manager.h" 7 #include "content/renderer/p2p/network_list_manager.h"
8 #include "net/base/net_util.h" 8 #include "net/base/net_util.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 rtc::IPAddress ip_address; 55 rtc::IPAddress ip_address;
56 56
57 // Add 2 networks with the same prefix and prefix length. 57 // Add 2 networks with the same prefix and prefix length.
58 EXPECT_TRUE(net::ParseIPLiteralToNumber(kIPv6PublicAddrString1, &ip_number)); 58 EXPECT_TRUE(net::ParseIPLiteralToNumber(kIPv6PublicAddrString1, &ip_number));
59 list.push_back( 59 list.push_back(
60 net::NetworkInterface("em1", 60 net::NetworkInterface("em1",
61 "em1", 61 "em1",
62 0, 62 0,
63 net::NetworkChangeNotifier::CONNECTION_UNKNOWN, 63 net::NetworkChangeNotifier::CONNECTION_UNKNOWN,
64 ip_number, 64 ip_number,
65 64)); 65 64,
66 net::IP_ADDRESS_ATTRIBUTE_NONE));
66 67
67 EXPECT_TRUE(net::ParseIPLiteralToNumber(kIPv6PublicAddrString2, &ip_number)); 68 EXPECT_TRUE(net::ParseIPLiteralToNumber(kIPv6PublicAddrString2, &ip_number));
68 list.push_back( 69 list.push_back(
69 net::NetworkInterface("em1", 70 net::NetworkInterface("em1",
70 "em1", 71 "em1",
71 0, 72 0,
72 net::NetworkChangeNotifier::CONNECTION_UNKNOWN, 73 net::NetworkChangeNotifier::CONNECTION_UNKNOWN,
73 ip_number, 74 ip_number,
74 64)); 75 64,
76 net::IP_ADDRESS_ATTRIBUTE_NONE));
75 77
76 network_manager_->OnNetworkListChanged(list); 78 network_manager_->OnNetworkListChanged(list);
77 network_manager_->GetNetworks(&networks); 79 network_manager_->GetNetworks(&networks);
78 EXPECT_EQ(1uL, networks.size()); 80 EXPECT_EQ(1uL, networks.size());
79 EXPECT_EQ(2uL, networks[0]->GetIPs().size()); 81 EXPECT_EQ(2uL, networks[0]->GetIPs().size());
80 82
81 // Add another network with different prefix length, should result in 83 // Add another network with different prefix length, should result in
82 // a different network. 84 // a different network.
83 networks.clear(); 85 networks.clear();
84 list.push_back( 86 list.push_back(
85 net::NetworkInterface("em1", 87 net::NetworkInterface("em1",
86 "em1", 88 "em1",
87 0, 89 0,
88 net::NetworkChangeNotifier::CONNECTION_UNKNOWN, 90 net::NetworkChangeNotifier::CONNECTION_UNKNOWN,
89 ip_number, 91 ip_number,
90 48)); 92 48,
93 net::IP_ADDRESS_ATTRIBUTE_NONE));
91 94
92 network_manager_->OnNetworkListChanged(list); 95 network_manager_->OnNetworkListChanged(list);
93 96
94 network_manager_->GetNetworks(&networks); 97 network_manager_->GetNetworks(&networks);
95 98
96 // Verify we have 2 networks now. 99 // Verify we have 2 networks now.
97 EXPECT_EQ(2uL, networks.size()); 100 EXPECT_EQ(2uL, networks.size());
98 // Verify the network with prefix length of 64 has 2 IP addresses. 101 // Verify the network with prefix length of 64 has 2 IP addresses.
99 EXPECT_EQ(64, networks[1]->prefix_length()); 102 EXPECT_EQ(64, networks[1]->prefix_length());
100 EXPECT_EQ(2uL, networks[1]->GetIPs().size()); 103 EXPECT_EQ(2uL, networks[1]->GetIPs().size());
101 EXPECT_TRUE(rtc::IPFromString(kIPv6PublicAddrString1, &ip_address)); 104 EXPECT_TRUE(rtc::IPFromString(kIPv6PublicAddrString1, &ip_address));
102 EXPECT_EQ(networks[1]->GetIPs()[0], ip_address); 105 EXPECT_EQ(networks[1]->GetIPs()[0], ip_address);
103 EXPECT_TRUE(rtc::IPFromString(kIPv6PublicAddrString2, &ip_address)); 106 EXPECT_TRUE(rtc::IPFromString(kIPv6PublicAddrString2, &ip_address));
104 EXPECT_EQ(networks[1]->GetIPs()[1], ip_address); 107 EXPECT_EQ(networks[1]->GetIPs()[1], ip_address);
105 // Verify the network with prefix length of 48 has 2 IP addresses. 108 // Verify the network with prefix length of 48 has 2 IP addresses.
106 EXPECT_EQ(48, networks[0]->prefix_length()); 109 EXPECT_EQ(48, networks[0]->prefix_length());
107 EXPECT_EQ(1uL, networks[0]->GetIPs().size()); 110 EXPECT_EQ(1uL, networks[0]->GetIPs().size());
108 EXPECT_TRUE(rtc::IPFromString(kIPv6PublicAddrString2, &ip_address)); 111 EXPECT_TRUE(rtc::IPFromString(kIPv6PublicAddrString2, &ip_address));
109 EXPECT_EQ(networks[0]->GetIPs()[0], ip_address); 112 EXPECT_EQ(networks[0]->GetIPs()[0], ip_address);
110 } 113 }
111 114
112 } // namespace content 115 } // namespace content
OLDNEW
« no previous file with comments | « content/common/p2p_messages.h ('k') | net/base/net_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698