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

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

Issue 2996933003: Add logging of host lookups made by TurnPort to the RtcEventLog. (Closed)
Patch Set: review Created 3 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
« no previous file with comments | « webrtc/p2p/base/turnport.cc ('k') | webrtc/p2p/client/basicportallocator.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 /* 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 254
255 // Version of CreateTurnPort that takes all possible parameters; all other 255 // Version of CreateTurnPort that takes all possible parameters; all other
256 // helper methods call this, such that "SetIceRole" and "ConnectSignals" (and 256 // helper methods call this, such that "SetIceRole" and "ConnectSignals" (and
257 // possibly other things in the future) only happen in one place. 257 // possibly other things in the future) only happen in one place.
258 void CreateTurnPortWithAllParams(rtc::Network* network, 258 void CreateTurnPortWithAllParams(rtc::Network* network,
259 const std::string& username, 259 const std::string& username,
260 const std::string& password, 260 const std::string& password,
261 const ProtocolAddress& server_address, 261 const ProtocolAddress& server_address,
262 const std::string& origin) { 262 const std::string& origin) {
263 RelayCredentials credentials(username, password); 263 RelayCredentials credentials(username, password);
264 webrtc::RtcEventLog* event_log = nullptr;
264 turn_port_.reset(TurnPort::Create(&main_, &socket_factory_, network, 0, 0, 265 turn_port_.reset(TurnPort::Create(&main_, &socket_factory_, network, 0, 0,
265 kIceUfrag1, kIcePwd1, server_address, 266 kIceUfrag1, kIcePwd1, server_address,
266 credentials, 0, origin)); 267 credentials, 0, origin, event_log));
267 // This TURN port will be the controlling. 268 // This TURN port will be the controlling.
268 turn_port_->SetIceRole(ICEROLE_CONTROLLING); 269 turn_port_->SetIceRole(ICEROLE_CONTROLLING);
269 ConnectSignals(); 270 ConnectSignals();
270 } 271 }
271 272
272 void CreateSharedTurnPort(const std::string& username, 273 void CreateSharedTurnPort(const std::string& username,
273 const std::string& password, 274 const std::string& password,
274 const ProtocolAddress& server_address) { 275 const ProtocolAddress& server_address) {
275 RTC_CHECK(server_address.proto == PROTO_UDP); 276 RTC_CHECK(server_address.proto == PROTO_UDP);
276 277
277 if (!socket_) { 278 if (!socket_) {
278 socket_.reset(socket_factory_.CreateUdpSocket( 279 socket_.reset(socket_factory_.CreateUdpSocket(
279 rtc::SocketAddress(kLocalAddr1.ipaddr(), 0), 0, 0)); 280 rtc::SocketAddress(kLocalAddr1.ipaddr(), 0), 0, 0));
280 ASSERT_TRUE(socket_ != NULL); 281 ASSERT_TRUE(socket_ != NULL);
281 socket_->SignalReadPacket.connect( 282 socket_->SignalReadPacket.connect(
282 this, &TurnPortTest::OnSocketReadPacket); 283 this, &TurnPortTest::OnSocketReadPacket);
283 } 284 }
284 285
285 RelayCredentials credentials(username, password); 286 RelayCredentials credentials(username, password);
286 turn_port_.reset(TurnPort::Create( 287 webrtc::RtcEventLog* event_log = nullptr;
287 &main_, &socket_factory_, MakeNetwork(kLocalAddr1), socket_.get(), 288 turn_port_.reset(
288 kIceUfrag1, kIcePwd1, server_address, credentials, 0, std::string())); 289 TurnPort::Create(&main_, &socket_factory_, MakeNetwork(kLocalAddr1),
290 socket_.get(), kIceUfrag1, kIcePwd1, server_address,
291 credentials, 0, std::string(), event_log));
289 // This TURN port will be the controlling. 292 // This TURN port will be the controlling.
290 turn_port_->SetIceRole(ICEROLE_CONTROLLING); 293 turn_port_->SetIceRole(ICEROLE_CONTROLLING);
291 ConnectSignals(); 294 ConnectSignals();
292 } 295 }
293 296
294 void ConnectSignals() { 297 void ConnectSignals() {
295 turn_port_->SignalPortComplete.connect(this, 298 turn_port_->SignalPortComplete.connect(this,
296 &TurnPortTest::OnTurnPortComplete); 299 &TurnPortTest::OnTurnPortComplete);
297 turn_port_->SignalPortError.connect(this, 300 turn_port_->SignalPortError.connect(this,
298 &TurnPortTest::OnTurnPortError); 301 &TurnPortTest::OnTurnPortError);
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 EXPECT_TRUE(turn_port_->Candidates().empty()); 1358 EXPECT_TRUE(turn_port_->Candidates().empty());
1356 turn_port_.reset(); 1359 turn_port_.reset();
1357 rtc::Thread::Current()->Post(RTC_FROM_HERE, this, MSG_TESTFINISH); 1360 rtc::Thread::Current()->Post(RTC_FROM_HERE, this, MSG_TESTFINISH);
1358 // Waiting for above message to be processed. 1361 // Waiting for above message to be processed.
1359 ASSERT_TRUE_SIMULATED_WAIT(test_finish_, 1, fake_clock_); 1362 ASSERT_TRUE_SIMULATED_WAIT(test_finish_, 1, fake_clock_);
1360 EXPECT_EQ(last_fd_count, GetFDCount()); 1363 EXPECT_EQ(last_fd_count, GetFDCount());
1361 } 1364 }
1362 #endif 1365 #endif
1363 1366
1364 } // namespace cricket 1367 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/p2p/base/turnport.cc ('k') | webrtc/p2p/client/basicportallocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698