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

Side by Side Diff: webrtc/p2p/base/port_unittest.cc

Issue 1277263002: Add instrumentation to track the IceEndpointType. (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
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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 const StunErrorCodeAttribute* error_attr = last_stun_msg_->GetErrorCode(); 128 const StunErrorCodeAttribute* error_attr = last_stun_msg_->GetErrorCode();
129 if (error_attr) { 129 if (error_attr) {
130 code = error_attr->code(); 130 code = error_attr->code();
131 } 131 }
132 } 132 }
133 return code; 133 return code;
134 } 134 }
135 135
136 virtual void PrepareAddress() { 136 virtual void PrepareAddress() {
137 rtc::SocketAddress addr(ip(), min_port()); 137 rtc::SocketAddress addr(ip(), min_port());
138 AddAddress(addr, addr, rtc::SocketAddress(), "udp", "", Type(), 138 AddAddress(addr, addr, rtc::SocketAddress(), "udp", "", "", Type(),
139 ICE_TYPE_PREFERENCE_HOST, 0, true); 139 ICE_TYPE_PREFERENCE_HOST, 0, true);
140 } 140 }
141 141
142 // Exposed for testing candidate building. 142 // Exposed for testing candidate building.
143 void AddCandidateAddress(const rtc::SocketAddress& addr) { 143 void AddCandidateAddress(const rtc::SocketAddress& addr) {
144 AddAddress(addr, addr, rtc::SocketAddress(), "udp", "", Type(), 144 AddAddress(addr, addr, rtc::SocketAddress(), "udp", "", "", Type(),
145 type_preference_, 0, false); 145 type_preference_, 0, false);
146 } 146 }
147 void AddCandidateAddress(const rtc::SocketAddress& addr, 147 void AddCandidateAddress(const rtc::SocketAddress& addr,
148 const rtc::SocketAddress& base_address, 148 const rtc::SocketAddress& base_address,
149 const std::string& type, 149 const std::string& type,
150 int type_preference, 150 int type_preference,
151 bool final) { 151 bool final) {
152 AddAddress(addr, base_address, rtc::SocketAddress(), "udp", "", type, 152 AddAddress(addr, base_address, rtc::SocketAddress(), "udp", "", "", type,
153 type_preference, 0, final); 153 type_preference, 0, final);
154 } 154 }
155 155
156 virtual Connection* CreateConnection(const Candidate& remote_candidate, 156 virtual Connection* CreateConnection(const Candidate& remote_candidate,
157 CandidateOrigin origin) { 157 CandidateOrigin origin) {
158 Connection* conn = new ProxyConnection(this, 0, remote_candidate); 158 Connection* conn = new ProxyConnection(this, 0, remote_candidate);
159 AddConnection(conn); 159 AddConnection(conn);
160 // Set use-candidate attribute flag as this will add USE-CANDIDATE attribute 160 // Set use-candidate attribute flag as this will add USE-CANDIDATE attribute
161 // in STUN binding requests. 161 // in STUN binding requests.
162 conn->set_use_candidate_attr(true); 162 conn->set_use_candidate_attr(true);
(...skipping 2478 matching lines...) Expand 10 before | Expand all | Expand 10 after
2641 // Set up channels and ensure both ports will be deleted. 2641 // Set up channels and ensure both ports will be deleted.
2642 TestChannel ch1(port1, port2); 2642 TestChannel ch1(port1, port2);
2643 TestChannel ch2(port2, port1); 2643 TestChannel ch2(port2, port1);
2644 2644
2645 // Simulate a connection that succeeds, and then is destroyed. 2645 // Simulate a connection that succeeds, and then is destroyed.
2646 StartConnectAndStopChannels(&ch1, &ch2); 2646 StartConnectAndStopChannels(&ch1, &ch2);
2647 2647
2648 // The controlled port should be destroyed after 10 milliseconds. 2648 // The controlled port should be destroyed after 10 milliseconds.
2649 EXPECT_TRUE_WAIT(destroyed(), kTimeout); 2649 EXPECT_TRUE_WAIT(destroyed(), kTimeout);
2650 } 2650 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698