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/pc/webrtcsession_unittest.cc

Issue 2794943002: Delete MediaController class, move Call ownership to PeerConnection. (Closed)
Patch Set: Hack for injecting a FakeCall, and re-enable TestPacketOptionsAndOnPacketSent test. Created 3 years, 7 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
« webrtc/pc/webrtcsession.h ('K') | « webrtc/pc/webrtcsession.cc ('k') | no next file » | 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 10
(...skipping 23 matching lines...) Expand all
34 #include "webrtc/media/base/mediachannel.h" 34 #include "webrtc/media/base/mediachannel.h"
35 #include "webrtc/media/engine/fakewebrtccall.h" 35 #include "webrtc/media/engine/fakewebrtccall.h"
36 #include "webrtc/media/sctp/sctptransportinternal.h" 36 #include "webrtc/media/sctp/sctptransportinternal.h"
37 #include "webrtc/p2p/base/packettransportinternal.h" 37 #include "webrtc/p2p/base/packettransportinternal.h"
38 #include "webrtc/p2p/base/stunserver.h" 38 #include "webrtc/p2p/base/stunserver.h"
39 #include "webrtc/p2p/base/teststunserver.h" 39 #include "webrtc/p2p/base/teststunserver.h"
40 #include "webrtc/p2p/base/testturnserver.h" 40 #include "webrtc/p2p/base/testturnserver.h"
41 #include "webrtc/p2p/client/basicportallocator.h" 41 #include "webrtc/p2p/client/basicportallocator.h"
42 #include "webrtc/pc/audiotrack.h" 42 #include "webrtc/pc/audiotrack.h"
43 #include "webrtc/pc/channelmanager.h" 43 #include "webrtc/pc/channelmanager.h"
44 #include "webrtc/pc/fakemediacontroller.h"
45 #include "webrtc/pc/mediasession.h" 44 #include "webrtc/pc/mediasession.h"
46 #include "webrtc/pc/peerconnection.h" 45 #include "webrtc/pc/peerconnection.h"
47 #include "webrtc/pc/sctputils.h" 46 #include "webrtc/pc/sctputils.h"
48 #include "webrtc/pc/test/fakertccertificategenerator.h" 47 #include "webrtc/pc/test/fakertccertificategenerator.h"
49 #include "webrtc/pc/videotrack.h" 48 #include "webrtc/pc/videotrack.h"
50 #include "webrtc/pc/webrtcsession.h" 49 #include "webrtc/pc/webrtcsession.h"
51 #include "webrtc/pc/webrtcsessiondescriptionfactory.h" 50 #include "webrtc/pc/webrtcsessiondescriptionfactory.h"
52 51
53 using cricket::FakeVoiceMediaChannel; 52 using cricket::FakeVoiceMediaChannel;
54 using cricket::TransportInfo; 53 using cricket::TransportInfo;
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 return last_fake_sctp_transport_; 247 return last_fake_sctp_transport_;
249 } 248 }
250 249
251 private: 250 private:
252 FakeSctpTransport* last_fake_sctp_transport_ = nullptr; 251 FakeSctpTransport* last_fake_sctp_transport_ = nullptr;
253 }; 252 };
254 253
255 class WebRtcSessionForTest : public webrtc::WebRtcSession { 254 class WebRtcSessionForTest : public webrtc::WebRtcSession {
256 public: 255 public:
257 WebRtcSessionForTest( 256 WebRtcSessionForTest(
258 webrtc::MediaControllerInterface* media_controller, 257 cricket::ChannelManager* channel_manager,
258 const cricket::MediaConfig& media_config,
259 webrtc::RtcEventLog* event_log,
259 rtc::Thread* network_thread, 260 rtc::Thread* network_thread,
260 rtc::Thread* worker_thread, 261 rtc::Thread* worker_thread,
261 rtc::Thread* signaling_thread, 262 rtc::Thread* signaling_thread,
262 cricket::PortAllocator* port_allocator, 263 cricket::PortAllocator* port_allocator,
263 webrtc::IceObserver* ice_observer, 264 webrtc::IceObserver* ice_observer,
264 std::unique_ptr<cricket::TransportController> transport_controller, 265 std::unique_ptr<cricket::TransportController> transport_controller,
265 std::unique_ptr<FakeSctpTransportFactory> sctp_factory) 266 std::unique_ptr<FakeSctpTransportFactory> sctp_factory,
266 : WebRtcSession(media_controller, 267 webrtc::Call*fake_call)
268 : WebRtcSession(channel_manager, media_config, event_log,
267 network_thread, 269 network_thread,
268 worker_thread, 270 worker_thread,
269 signaling_thread, 271 signaling_thread,
270 port_allocator, 272 port_allocator,
271 std::move(transport_controller), 273 std::move(transport_controller),
272 std::move(sctp_factory)) { 274 std::move(sctp_factory)),
275 fake_call_(fake_call) {
273 RegisterIceObserver(ice_observer); 276 RegisterIceObserver(ice_observer);
274 } 277 }
275 virtual ~WebRtcSessionForTest() {} 278 virtual ~WebRtcSessionForTest() {}
276 279
277 // Note that these methods are only safe to use if the signaling thread 280 // Note that these methods are only safe to use if the signaling thread
278 // is the same as the worker thread 281 // is the same as the worker thread
279 rtc::PacketTransportInternal* voice_rtp_transport_channel() { 282 rtc::PacketTransportInternal* voice_rtp_transport_channel() {
280 return rtp_transport_channel(voice_channel()); 283 return rtp_transport_channel(voice_channel());
281 } 284 }
282 285
283 rtc::PacketTransportInternal* voice_rtcp_transport_channel() { 286 rtc::PacketTransportInternal* voice_rtcp_transport_channel() {
284 return rtcp_transport_channel(voice_channel()); 287 return rtcp_transport_channel(voice_channel());
285 } 288 }
286 289
287 rtc::PacketTransportInternal* video_rtp_transport_channel() { 290 rtc::PacketTransportInternal* video_rtp_transport_channel() {
288 return rtp_transport_channel(video_channel()); 291 return rtp_transport_channel(video_channel());
289 } 292 }
290 293
291 rtc::PacketTransportInternal* video_rtcp_transport_channel() { 294 rtc::PacketTransportInternal* video_rtcp_transport_channel() {
292 return rtcp_transport_channel(video_channel()); 295 return rtcp_transport_channel(video_channel());
293 } 296 }
294 297
295 private: 298 private:
299 webrtc::Call* call() override {
300 if (fake_call_)
301 return fake_call_;
302 return WebRtcSession::call();
303 }
304
296 rtc::PacketTransportInternal* rtp_transport_channel( 305 rtc::PacketTransportInternal* rtp_transport_channel(
297 cricket::BaseChannel* ch) { 306 cricket::BaseChannel* ch) {
298 if (!ch) { 307 if (!ch) {
299 return nullptr; 308 return nullptr;
300 } 309 }
301 return ch->rtp_dtls_transport(); 310 return ch->rtp_dtls_transport();
302 } 311 }
303 312
304 rtc::PacketTransportInternal* rtcp_transport_channel( 313 rtc::PacketTransportInternal* rtcp_transport_channel(
305 cricket::BaseChannel* ch) { 314 cricket::BaseChannel* ch) {
306 if (!ch) { 315 if (!ch) {
307 return nullptr; 316 return nullptr;
308 } 317 }
309 return ch->rtcp_dtls_transport(); 318 return ch->rtcp_dtls_transport();
310 } 319 }
320
321 webrtc::Call* fake_call_ = nullptr;
311 }; 322 };
312 323
313 class WebRtcSessionCreateSDPObserverForTest 324 class WebRtcSessionCreateSDPObserverForTest
314 : public rtc::RefCountedObject<CreateSessionDescriptionObserver> { 325 : public rtc::RefCountedObject<CreateSessionDescriptionObserver> {
315 public: 326 public:
316 enum State { 327 enum State {
317 kInit, 328 kInit,
318 kFailed, 329 kFailed,
319 kSucceeded, 330 kSucceeded,
320 }; 331 };
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 // TODO Investigate why ChannelManager crashes, if it's created 379 // TODO Investigate why ChannelManager crashes, if it's created
369 // after stun_server. 380 // after stun_server.
370 WebRtcSessionTest() 381 WebRtcSessionTest()
371 : media_engine_(new cricket::FakeMediaEngine()), 382 : media_engine_(new cricket::FakeMediaEngine()),
372 data_engine_(new cricket::FakeDataEngine()), 383 data_engine_(new cricket::FakeDataEngine()),
373 channel_manager_(new cricket::ChannelManager( 384 channel_manager_(new cricket::ChannelManager(
374 std::unique_ptr<cricket::MediaEngineInterface>(media_engine_), 385 std::unique_ptr<cricket::MediaEngineInterface>(media_engine_),
375 std::unique_ptr<cricket::DataEngineInterface>(data_engine_), 386 std::unique_ptr<cricket::DataEngineInterface>(data_engine_),
376 rtc::Thread::Current())), 387 rtc::Thread::Current())),
377 fake_call_(webrtc::Call::Config(&event_log_)), 388 fake_call_(webrtc::Call::Config(&event_log_)),
378 media_controller_(
379 webrtc::MediaControllerInterface::Create(cricket::MediaConfig(),
380 rtc::Thread::Current(),
381 channel_manager_.get(),
382 &event_log_)),
383 tdesc_factory_(new cricket::TransportDescriptionFactory()), 389 tdesc_factory_(new cricket::TransportDescriptionFactory()),
384 desc_factory_( 390 desc_factory_(
385 new cricket::MediaSessionDescriptionFactory(channel_manager_.get(), 391 new cricket::MediaSessionDescriptionFactory(channel_manager_.get(),
386 tdesc_factory_.get())), 392 tdesc_factory_.get())),
387 pss_(new rtc::PhysicalSocketServer), 393 pss_(new rtc::PhysicalSocketServer),
388 vss_(new rtc::VirtualSocketServer(pss_.get())), 394 vss_(new rtc::VirtualSocketServer(pss_.get())),
389 fss_(new rtc::FirewallSocketServer(vss_.get())), 395 fss_(new rtc::FirewallSocketServer(vss_.get())),
390 ss_scope_(fss_.get()), 396 ss_scope_(fss_.get()),
391 stun_socket_addr_( 397 stun_socket_addr_(
392 rtc::SocketAddress(kStunAddrHost, cricket::STUN_SERVER_PORT)), 398 rtc::SocketAddress(kStunAddrHost, cricket::STUN_SERVER_PORT)),
(...skipping 21 matching lines...) Expand all
414 network_manager_.RemoveInterface(addr); 420 network_manager_.RemoveInterface(addr);
415 } 421 }
416 422
417 // If |cert_generator| != null or |rtc_configuration| contains |certificates| 423 // If |cert_generator| != null or |rtc_configuration| contains |certificates|
418 // then DTLS will be enabled unless explicitly disabled by |rtc_configuration| 424 // then DTLS will be enabled unless explicitly disabled by |rtc_configuration|
419 // options. When DTLS is enabled a certificate will be used if provided, 425 // options. When DTLS is enabled a certificate will be used if provided,
420 // otherwise one will be generated using the |cert_generator|. 426 // otherwise one will be generated using the |cert_generator|.
421 void Init( 427 void Init(
422 std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator, 428 std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator,
423 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy, 429 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy,
424 const rtc::CryptoOptions& crypto_options) { 430 const rtc::CryptoOptions& crypto_options,
431 webrtc::Call* fake_call) {
425 ASSERT_TRUE(session_.get() == NULL); 432 ASSERT_TRUE(session_.get() == NULL);
426 fake_sctp_transport_factory_ = new FakeSctpTransportFactory(); 433 fake_sctp_transport_factory_ = new FakeSctpTransportFactory();
427 session_.reset(new WebRtcSessionForTest( 434 session_.reset(new WebRtcSessionForTest(
428 media_controller_.get(), rtc::Thread::Current(), rtc::Thread::Current(), 435 channel_manager_.get(), cricket::MediaConfig(), &event_log_,
436 rtc::Thread::Current(), rtc::Thread::Current(),
429 rtc::Thread::Current(), allocator_.get(), &observer_, 437 rtc::Thread::Current(), allocator_.get(), &observer_,
430 std::unique_ptr<cricket::TransportController>( 438 std::unique_ptr<cricket::TransportController>(
431 new cricket::TransportController( 439 new cricket::TransportController(
432 rtc::Thread::Current(), rtc::Thread::Current(), 440 rtc::Thread::Current(), rtc::Thread::Current(),
433 allocator_.get(), 441 allocator_.get(),
434 /*redetermine_role_on_ice_restart=*/true, crypto_options)), 442 /*redetermine_role_on_ice_restart=*/true, crypto_options)),
435 std::unique_ptr<FakeSctpTransportFactory>( 443 std::unique_ptr<FakeSctpTransportFactory>(
436 fake_sctp_transport_factory_))); 444 fake_sctp_transport_factory_),
445 fake_call));
437 session_->SignalDataChannelOpenMessage.connect( 446 session_->SignalDataChannelOpenMessage.connect(
438 this, &WebRtcSessionTest::OnDataChannelOpenMessage); 447 this, &WebRtcSessionTest::OnDataChannelOpenMessage);
439 448
440 configuration_.rtcp_mux_policy = rtcp_mux_policy; 449 configuration_.rtcp_mux_policy = rtcp_mux_policy;
441 EXPECT_EQ(PeerConnectionInterface::kIceConnectionNew, 450 EXPECT_EQ(PeerConnectionInterface::kIceConnectionNew,
442 observer_.ice_connection_state_); 451 observer_.ice_connection_state_);
443 EXPECT_EQ(PeerConnectionInterface::kIceGatheringNew, 452 EXPECT_EQ(PeerConnectionInterface::kIceGatheringNew,
444 observer_.ice_gathering_state_); 453 observer_.ice_gathering_state_);
445 454
446 EXPECT_TRUE(session_->Initialize(options_, std::move(cert_generator), 455 EXPECT_TRUE(session_->Initialize(options_, std::move(cert_generator),
447 configuration_)); 456 configuration_));
448 session_->set_metrics_observer(metrics_observer_); 457 session_->set_metrics_observer(metrics_observer_);
449 crypto_options_ = crypto_options; 458 crypto_options_ = crypto_options;
450 } 459 }
451 460
452 void OnDataChannelOpenMessage(const std::string& label, 461 void OnDataChannelOpenMessage(const std::string& label,
453 const InternalDataChannelInit& config) { 462 const InternalDataChannelInit& config) {
454 last_data_channel_label_ = label; 463 last_data_channel_label_ = label;
455 last_data_channel_config_ = config; 464 last_data_channel_config_ = config;
456 } 465 }
457 466
458 void Init() { 467 void Init() {
459 Init(nullptr, PeerConnectionInterface::kRtcpMuxPolicyNegotiate, 468 Init(nullptr, PeerConnectionInterface::kRtcpMuxPolicyNegotiate,
460 rtc::CryptoOptions()); 469 rtc::CryptoOptions(), nullptr);
470 }
471
472 void InitWithFakeCall(webrtc::Call* fake_call) {
473 Init(nullptr, PeerConnectionInterface::kRtcpMuxPolicyNegotiate,
474 rtc::CryptoOptions(), fake_call);
461 } 475 }
462 476
463 void InitWithBundlePolicy( 477 void InitWithBundlePolicy(
464 PeerConnectionInterface::BundlePolicy bundle_policy) { 478 PeerConnectionInterface::BundlePolicy bundle_policy) {
465 configuration_.bundle_policy = bundle_policy; 479 configuration_.bundle_policy = bundle_policy;
466 Init(); 480 Init();
467 } 481 }
468 482
469 void InitWithRtcpMuxPolicy( 483 void InitWithRtcpMuxPolicy(
470 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy) { 484 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy) {
471 PeerConnectionInterface::RTCConfiguration configuration; 485 PeerConnectionInterface::RTCConfiguration configuration;
472 Init(nullptr, rtcp_mux_policy, rtc::CryptoOptions()); 486 Init(nullptr, rtcp_mux_policy, rtc::CryptoOptions(), nullptr);
473 } 487 }
474 488
475 void InitWithCryptoOptions(const rtc::CryptoOptions& crypto_options) { 489 void InitWithCryptoOptions(const rtc::CryptoOptions& crypto_options) {
476 Init(nullptr, PeerConnectionInterface::kRtcpMuxPolicyNegotiate, 490 Init(nullptr, PeerConnectionInterface::kRtcpMuxPolicyNegotiate,
477 crypto_options); 491 crypto_options, nullptr);
478 } 492 }
479 493
480 // Successfully init with DTLS; with a certificate generated and supplied or 494 // Successfully init with DTLS; with a certificate generated and supplied or
481 // with a store that generates it for us. 495 // with a store that generates it for us.
482 void InitWithDtls(RTCCertificateGenerationMethod cert_gen_method) { 496 void InitWithDtls(RTCCertificateGenerationMethod cert_gen_method) {
483 std::unique_ptr<FakeRTCCertificateGenerator> cert_generator; 497 std::unique_ptr<FakeRTCCertificateGenerator> cert_generator;
484 if (cert_gen_method == ALREADY_GENERATED) { 498 if (cert_gen_method == ALREADY_GENERATED) {
485 configuration_.certificates.push_back( 499 configuration_.certificates.push_back(
486 FakeRTCCertificateGenerator::GenerateCertificate()); 500 FakeRTCCertificateGenerator::GenerateCertificate());
487 } else if (cert_gen_method == DTLS_IDENTITY_STORE) { 501 } else if (cert_gen_method == DTLS_IDENTITY_STORE) {
488 cert_generator.reset(new FakeRTCCertificateGenerator()); 502 cert_generator.reset(new FakeRTCCertificateGenerator());
489 cert_generator->set_should_fail(false); 503 cert_generator->set_should_fail(false);
490 } else { 504 } else {
491 RTC_CHECK(false); 505 RTC_CHECK(false);
492 } 506 }
493 Init(std::move(cert_generator), 507 Init(std::move(cert_generator),
494 PeerConnectionInterface::kRtcpMuxPolicyNegotiate, 508 PeerConnectionInterface::kRtcpMuxPolicyNegotiate,
495 rtc::CryptoOptions()); 509 rtc::CryptoOptions(), nullptr);
496 } 510 }
497 511
498 // Init with DTLS with a store that will fail to generate a certificate. 512 // Init with DTLS with a store that will fail to generate a certificate.
499 void InitWithDtlsIdentityGenFail() { 513 void InitWithDtlsIdentityGenFail() {
500 std::unique_ptr<FakeRTCCertificateGenerator> cert_generator( 514 std::unique_ptr<FakeRTCCertificateGenerator> cert_generator(
501 new FakeRTCCertificateGenerator()); 515 new FakeRTCCertificateGenerator());
502 cert_generator->set_should_fail(true); 516 cert_generator->set_should_fail(true);
503 Init(std::move(cert_generator), 517 Init(std::move(cert_generator),
504 PeerConnectionInterface::kRtcpMuxPolicyNegotiate, 518 PeerConnectionInterface::kRtcpMuxPolicyNegotiate,
505 rtc::CryptoOptions()); 519 rtc::CryptoOptions(), nullptr);
506 } 520 }
507 521
508 void InitWithGcm() { 522 void InitWithGcm() {
509 rtc::CryptoOptions crypto_options; 523 rtc::CryptoOptions crypto_options;
510 crypto_options.enable_gcm_crypto_suites = true; 524 crypto_options.enable_gcm_crypto_suites = true;
511 InitWithCryptoOptions(crypto_options); 525 InitWithCryptoOptions(crypto_options);
512 } 526 }
513 527
514 void SendAudioVideoStream1() { 528 void SendAudioVideoStream1() {
515 send_stream_1_ = true; 529 send_stream_1_ = true;
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 // This code is placed in a method so that it can be invoked 1314 // This code is placed in a method so that it can be invoked
1301 // by multiple tests with different allocators (e.g. with and without BUNDLE). 1315 // by multiple tests with different allocators (e.g. with and without BUNDLE).
1302 // While running the call, this method also checks if the session goes through 1316 // While running the call, this method also checks if the session goes through
1303 // the correct sequence of ICE states when a connection is established, 1317 // the correct sequence of ICE states when a connection is established,
1304 // broken, and re-established. 1318 // broken, and re-established.
1305 // The Connection state should go: 1319 // The Connection state should go:
1306 // New -> Checking -> (Connected) -> Completed -> Disconnected -> Completed 1320 // New -> Checking -> (Connected) -> Completed -> Disconnected -> Completed
1307 // -> Failed. 1321 // -> Failed.
1308 // The Gathering state should go: New -> Gathering -> Completed. 1322 // The Gathering state should go: New -> Gathering -> Completed.
1309 1323
1310 void SetupLoopbackCall() { 1324 void SetupLoopbackCall(webrtc::Call* fake_call = nullptr) {
1311 Init(); 1325 InitWithFakeCall(fake_call);
1312 SendAudioVideoStream1(); 1326 SendAudioVideoStream1();
1313 SessionDescriptionInterface* offer = CreateOffer(); 1327 SessionDescriptionInterface* offer = CreateOffer();
1314 1328
1315 EXPECT_EQ(PeerConnectionInterface::kIceGatheringNew, 1329 EXPECT_EQ(PeerConnectionInterface::kIceGatheringNew,
1316 observer_.ice_gathering_state_); 1330 observer_.ice_gathering_state_);
1317 SetLocalDescriptionWithoutError(offer); 1331 SetLocalDescriptionWithoutError(offer);
1318 EXPECT_EQ(PeerConnectionInterface::kIceConnectionNew, 1332 EXPECT_EQ(PeerConnectionInterface::kIceConnectionNew,
1319 observer_.ice_connection_state_); 1333 observer_.ice_connection_state_);
1320 EXPECT_EQ_WAIT(PeerConnectionInterface::kIceGatheringGathering, 1334 EXPECT_EQ_WAIT(PeerConnectionInterface::kIceGatheringGathering,
1321 observer_.ice_gathering_state_, kIceCandidatesTimeout); 1335 observer_.ice_gathering_state_, kIceCandidatesTimeout);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1373 observer_.ice_connection_state_, 1387 observer_.ice_connection_state_,
1374 kIceCandidatesTimeout + port_timeout); 1388 kIceCandidatesTimeout + port_timeout);
1375 } 1389 }
1376 1390
1377 void TestLoopbackCall() { 1391 void TestLoopbackCall() {
1378 LoopbackNetworkConfiguration config; 1392 LoopbackNetworkConfiguration config;
1379 TestLoopbackCall(config); 1393 TestLoopbackCall(config);
1380 } 1394 }
1381 1395
1382 void TestPacketOptions() { 1396 void TestPacketOptions() {
1383 media_controller_.reset(
1384 new cricket::FakeMediaController(channel_manager_.get(), &fake_call_));
1385 LoopbackNetworkConfiguration config; 1397 LoopbackNetworkConfiguration config;
1386 LoopbackNetworkManager loopback_network_manager(this, config); 1398 LoopbackNetworkManager loopback_network_manager(this, config);
1387 1399
1388 SetupLoopbackCall(); 1400 SetupLoopbackCall(&fake_call_);
1389 1401
1390 // Wait for channel to be ready for sending. 1402 // Wait for channel to be ready for sending.
1391 EXPECT_TRUE_WAIT(media_engine_->GetVideoChannel(0)->sending(), 100); 1403 EXPECT_TRUE_WAIT(media_engine_->GetVideoChannel(0)->sending(), 100);
1392 uint8_t test_packet[15] = {0}; 1404 uint8_t test_packet[15] = {0};
1393 rtc::PacketOptions options; 1405 rtc::PacketOptions options;
1394 options.packet_id = 10; 1406 options.packet_id = 10;
1395 media_engine_->GetVideoChannel(0) 1407 media_engine_->GetVideoChannel(0)
1396 ->SendRtp(test_packet, sizeof(test_packet), options); 1408 ->SendRtp(test_packet, sizeof(test_packet), options);
1397 1409
1398 const int kPacketTimeout = 2000; 1410 const int kPacketTimeout = 2000;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1508 1520
1509 webrtc::RtcEventLogNullImpl event_log_; 1521 webrtc::RtcEventLogNullImpl event_log_;
1510 // |media_engine_| and |data_engine_| are actually owned by 1522 // |media_engine_| and |data_engine_| are actually owned by
1511 // |channel_manager_|. 1523 // |channel_manager_|.
1512 cricket::FakeMediaEngine* media_engine_; 1524 cricket::FakeMediaEngine* media_engine_;
1513 cricket::FakeDataEngine* data_engine_; 1525 cricket::FakeDataEngine* data_engine_;
1514 // Actually owned by session_. 1526 // Actually owned by session_.
1515 FakeSctpTransportFactory* fake_sctp_transport_factory_ = nullptr; 1527 FakeSctpTransportFactory* fake_sctp_transport_factory_ = nullptr;
1516 std::unique_ptr<cricket::ChannelManager> channel_manager_; 1528 std::unique_ptr<cricket::ChannelManager> channel_manager_;
1517 cricket::FakeCall fake_call_; 1529 cricket::FakeCall fake_call_;
1518 std::unique_ptr<webrtc::MediaControllerInterface> media_controller_;
1519 std::unique_ptr<cricket::TransportDescriptionFactory> tdesc_factory_; 1530 std::unique_ptr<cricket::TransportDescriptionFactory> tdesc_factory_;
1520 std::unique_ptr<cricket::MediaSessionDescriptionFactory> desc_factory_; 1531 std::unique_ptr<cricket::MediaSessionDescriptionFactory> desc_factory_;
1521 std::unique_ptr<rtc::PhysicalSocketServer> pss_; 1532 std::unique_ptr<rtc::PhysicalSocketServer> pss_;
1522 std::unique_ptr<rtc::VirtualSocketServer> vss_; 1533 std::unique_ptr<rtc::VirtualSocketServer> vss_;
1523 std::unique_ptr<rtc::FirewallSocketServer> fss_; 1534 std::unique_ptr<rtc::FirewallSocketServer> fss_;
1524 rtc::SocketServerScope ss_scope_; 1535 rtc::SocketServerScope ss_scope_;
1525 rtc::SocketAddress stun_socket_addr_; 1536 rtc::SocketAddress stun_socket_addr_;
1526 std::unique_ptr<cricket::TestStunServer> stun_server_; 1537 std::unique_ptr<cricket::TestStunServer> stun_server_;
1527 cricket::TestTurnServer turn_server_; 1538 cricket::TestTurnServer turn_server_;
1528 rtc::FakeNetworkManager network_manager_; 1539 rtc::FakeNetworkManager network_manager_;
(...skipping 2818 matching lines...) Expand 10 before | Expand all | Expand 10 after
4347 } 4358 }
4348 4359
4349 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test 4360 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test
4350 // currently fails because upon disconnection and reconnection OnIceComplete is 4361 // currently fails because upon disconnection and reconnection OnIceComplete is
4351 // called more than once without returning to IceGatheringGathering. 4362 // called more than once without returning to IceGatheringGathering.
4352 4363
4353 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, 4364 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests,
4354 WebRtcSessionTest, 4365 WebRtcSessionTest,
4355 testing::Values(ALREADY_GENERATED, 4366 testing::Values(ALREADY_GENERATED,
4356 DTLS_IDENTITY_STORE)); 4367 DTLS_IDENTITY_STORE));
OLDNEW
« webrtc/pc/webrtcsession.h ('K') | « webrtc/pc/webrtcsession.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698