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

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

Issue 1336553003: Revert change which removes GICE (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 3 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 2012 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2012 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 #if defined(WEBRTC_POSIX) 10 #if defined(WEBRTC_POSIX)
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 void CreateTurnPort(const rtc::SocketAddress& local_address, 194 void CreateTurnPort(const rtc::SocketAddress& local_address,
195 const std::string& username, 195 const std::string& username,
196 const std::string& password, 196 const std::string& password,
197 const cricket::ProtocolAddress& server_address) { 197 const cricket::ProtocolAddress& server_address) {
198 cricket::RelayCredentials credentials(username, password); 198 cricket::RelayCredentials credentials(username, password);
199 turn_port_.reset(TurnPort::Create(main_, &socket_factory_, &network_, 199 turn_port_.reset(TurnPort::Create(main_, &socket_factory_, &network_,
200 local_address.ipaddr(), 0, 0, 200 local_address.ipaddr(), 0, 0,
201 kIceUfrag1, kIcePwd1, 201 kIceUfrag1, kIcePwd1,
202 server_address, credentials, 0, 202 server_address, credentials, 0,
203 std::string())); 203 std::string()));
204 // Set ICE protocol type to ICEPROTO_RFC5245, as port by default will be
205 // in Hybrid mode. Protocol type is necessary to send correct type STUN ping
206 // messages.
204 // This TURN port will be the controlling. 207 // This TURN port will be the controlling.
208 turn_port_->SetIceProtocolType(cricket::ICEPROTO_RFC5245);
205 turn_port_->SetIceRole(cricket::ICEROLE_CONTROLLING); 209 turn_port_->SetIceRole(cricket::ICEROLE_CONTROLLING);
206 ConnectSignals(); 210 ConnectSignals();
207 } 211 }
208 212
209 // Should be identical to CreateTurnPort but specifies an origin value 213 // Should be identical to CreateTurnPort but specifies an origin value
210 // when creating the instance of TurnPort. 214 // when creating the instance of TurnPort.
211 void CreateTurnPortWithOrigin(const rtc::SocketAddress& local_address, 215 void CreateTurnPortWithOrigin(const rtc::SocketAddress& local_address,
212 const std::string& username, 216 const std::string& username,
213 const std::string& password, 217 const std::string& password,
214 const cricket::ProtocolAddress& server_address, 218 const cricket::ProtocolAddress& server_address,
215 const std::string& origin) { 219 const std::string& origin) {
216 cricket::RelayCredentials credentials(username, password); 220 cricket::RelayCredentials credentials(username, password);
217 turn_port_.reset(TurnPort::Create(main_, &socket_factory_, &network_, 221 turn_port_.reset(TurnPort::Create(main_, &socket_factory_, &network_,
218 local_address.ipaddr(), 0, 0, 222 local_address.ipaddr(), 0, 0,
219 kIceUfrag1, kIcePwd1, 223 kIceUfrag1, kIcePwd1,
220 server_address, credentials, 0, 224 server_address, credentials, 0,
221 origin)); 225 origin));
226 // Set ICE protocol type to ICEPROTO_RFC5245, as port by default will be
227 // in Hybrid mode. Protocol type is necessary to send correct type STUN ping
228 // messages.
222 // This TURN port will be the controlling. 229 // This TURN port will be the controlling.
230 turn_port_->SetIceProtocolType(cricket::ICEPROTO_RFC5245);
223 turn_port_->SetIceRole(cricket::ICEROLE_CONTROLLING); 231 turn_port_->SetIceRole(cricket::ICEROLE_CONTROLLING);
224 ConnectSignals(); 232 ConnectSignals();
225 } 233 }
226 234
227 void CreateSharedTurnPort(const std::string& username, 235 void CreateSharedTurnPort(const std::string& username,
228 const std::string& password, 236 const std::string& password,
229 const cricket::ProtocolAddress& server_address) { 237 const cricket::ProtocolAddress& server_address) {
230 ASSERT(server_address.proto == cricket::PROTO_UDP); 238 ASSERT(server_address.proto == cricket::PROTO_UDP);
231 239
232 if (!socket_) { 240 if (!socket_) {
233 socket_.reset(socket_factory_.CreateUdpSocket( 241 socket_.reset(socket_factory_.CreateUdpSocket(
234 rtc::SocketAddress(kLocalAddr1.ipaddr(), 0), 0, 0)); 242 rtc::SocketAddress(kLocalAddr1.ipaddr(), 0), 0, 0));
235 ASSERT_TRUE(socket_ != NULL); 243 ASSERT_TRUE(socket_ != NULL);
236 socket_->SignalReadPacket.connect( 244 socket_->SignalReadPacket.connect(
237 this, &TurnPortTest::OnSocketReadPacket); 245 this, &TurnPortTest::OnSocketReadPacket);
238 } 246 }
239 247
240 cricket::RelayCredentials credentials(username, password); 248 cricket::RelayCredentials credentials(username, password);
241 turn_port_.reset(cricket::TurnPort::Create( 249 turn_port_.reset(cricket::TurnPort::Create(
242 main_, &socket_factory_, &network_, socket_.get(), 250 main_, &socket_factory_, &network_, socket_.get(),
243 kIceUfrag1, kIcePwd1, server_address, credentials, 0, std::string())); 251 kIceUfrag1, kIcePwd1, server_address, credentials, 0, std::string()));
252 // Set ICE protocol type to ICEPROTO_RFC5245, as port by default will be
253 // in Hybrid mode. Protocol type is necessary to send correct type STUN ping
254 // messages.
244 // This TURN port will be the controlling. 255 // This TURN port will be the controlling.
256 turn_port_->SetIceProtocolType(cricket::ICEPROTO_RFC5245);
245 turn_port_->SetIceRole(cricket::ICEROLE_CONTROLLING); 257 turn_port_->SetIceRole(cricket::ICEROLE_CONTROLLING);
246 ConnectSignals(); 258 ConnectSignals();
247 } 259 }
248 260
249 void ConnectSignals() { 261 void ConnectSignals() {
250 turn_port_->SignalPortComplete.connect(this, 262 turn_port_->SignalPortComplete.connect(this,
251 &TurnPortTest::OnTurnPortComplete); 263 &TurnPortTest::OnTurnPortComplete);
252 turn_port_->SignalPortError.connect(this, 264 turn_port_->SignalPortError.connect(this,
253 &TurnPortTest::OnTurnPortError); 265 &TurnPortTest::OnTurnPortError);
254 turn_port_->SignalUnknownAddress.connect(this, 266 turn_port_->SignalUnknownAddress.connect(this,
255 &TurnPortTest::OnTurnUnknownAddress); 267 &TurnPortTest::OnTurnUnknownAddress);
256 turn_port_->SignalCreatePermissionResult.connect(this, 268 turn_port_->SignalCreatePermissionResult.connect(this,
257 &TurnPortTest::OnTurnCreatePermissionResult); 269 &TurnPortTest::OnTurnCreatePermissionResult);
258 } 270 }
259 void CreateUdpPort() { 271 void CreateUdpPort() {
260 udp_port_.reset(UDPPort::Create(main_, &socket_factory_, &network_, 272 udp_port_.reset(UDPPort::Create(main_, &socket_factory_, &network_,
261 kLocalAddr2.ipaddr(), 0, 0, 273 kLocalAddr2.ipaddr(), 0, 0,
262 kIceUfrag2, kIcePwd2, 274 kIceUfrag2, kIcePwd2,
263 std::string(), false)); 275 std::string(), false));
276 // Set protocol type to RFC5245, as turn port is also in same mode.
264 // UDP port will be controlled. 277 // UDP port will be controlled.
278 udp_port_->SetIceProtocolType(cricket::ICEPROTO_RFC5245);
265 udp_port_->SetIceRole(cricket::ICEROLE_CONTROLLED); 279 udp_port_->SetIceRole(cricket::ICEROLE_CONTROLLED);
266 udp_port_->SignalPortComplete.connect( 280 udp_port_->SignalPortComplete.connect(
267 this, &TurnPortTest::OnUdpPortComplete); 281 this, &TurnPortTest::OnUdpPortComplete);
268 } 282 }
269 283
270 void TestTurnAlternateServer(cricket::ProtocolType protocol_type) { 284 void TestTurnAlternateServer(cricket::ProtocolType protocol_type) {
271 std::vector<rtc::SocketAddress> redirect_addresses; 285 std::vector<rtc::SocketAddress> redirect_addresses;
272 redirect_addresses.push_back(kTurnAlternateIntAddr); 286 redirect_addresses.push_back(kTurnAlternateIntAddr);
273 287
274 cricket::TestTurnRedirector redirector(redirect_addresses); 288 cricket::TestTurnRedirector redirector(redirect_addresses);
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 turn_port_->PrepareAddress(); 821 turn_port_->PrepareAddress();
808 ASSERT_TRUE_WAIT(turn_error_, kTimeout); 822 ASSERT_TRUE_WAIT(turn_error_, kTimeout);
809 EXPECT_TRUE(turn_port_->Candidates().empty()); 823 EXPECT_TRUE(turn_port_->Candidates().empty());
810 turn_port_.reset(); 824 turn_port_.reset();
811 rtc::Thread::Current()->Post(this, MSG_TESTFINISH); 825 rtc::Thread::Current()->Post(this, MSG_TESTFINISH);
812 // Waiting for above message to be processed. 826 // Waiting for above message to be processed.
813 ASSERT_TRUE_WAIT(test_finish_, kTimeout); 827 ASSERT_TRUE_WAIT(test_finish_, kTimeout);
814 EXPECT_EQ(last_fd_count, GetFDCount()); 828 EXPECT_EQ(last_fd_count, GetFDCount());
815 } 829 }
816 #endif 830 #endif
OLDNEW
« no previous file with comments | « webrtc/p2p/base/transportdescriptionfactory_unittest.cc ('k') | webrtc/p2p/client/basicportallocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698