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

Side by Side Diff: webrtc/api/webrtcsession_unittest.cc

Issue 1956453003: Relanding: Implement RTCConfiguration.iceCandidatePoolSize. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing uninitialized variable (noticed by msan) Created 4 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
« no previous file with comments | « webrtc/api/webrtcsession.cc ('k') | webrtc/p2p/base/candidate.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 10
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 void OnDataChannelOpenMessage(const std::string& label, 398 void OnDataChannelOpenMessage(const std::string& label,
399 const InternalDataChannelInit& config) { 399 const InternalDataChannelInit& config) {
400 last_data_channel_label_ = label; 400 last_data_channel_label_ = label;
401 last_data_channel_config_ = config; 401 last_data_channel_config_ = config;
402 } 402 }
403 403
404 void OnSessionDestroyed() { session_destroyed_ = true; } 404 void OnSessionDestroyed() { session_destroyed_ = true; }
405 405
406 void Init() { Init(nullptr); } 406 void Init() { Init(nullptr); }
407 407
408 void InitWithIceTransport(
409 PeerConnectionInterface::IceTransportsType ice_transport_type) {
410 configuration_.type = ice_transport_type;
411 Init();
412 }
413
414 void InitWithBundlePolicy( 408 void InitWithBundlePolicy(
415 PeerConnectionInterface::BundlePolicy bundle_policy) { 409 PeerConnectionInterface::BundlePolicy bundle_policy) {
416 configuration_.bundle_policy = bundle_policy; 410 configuration_.bundle_policy = bundle_policy;
417 Init(); 411 Init();
418 } 412 }
419 413
420 void InitWithRtcpMuxPolicy( 414 void InitWithRtcpMuxPolicy(
421 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy) { 415 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy) {
422 PeerConnectionInterface::RTCConfiguration configuration; 416 PeerConnectionInterface::RTCConfiguration configuration;
423 configuration_.rtcp_mux_policy = rtcp_mux_policy; 417 configuration_.rtcp_mux_policy = rtcp_mux_policy;
(...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after
1518 rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); 1512 rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
1519 Init(); 1513 Init();
1520 SendAudioVideoStream1(); 1514 SendAudioVideoStream1();
1521 InitiateCall(); 1515 InitiateCall();
1522 // Since kClientAddrHost1 is blocked, not expecting stun candidates for it. 1516 // Since kClientAddrHost1 is blocked, not expecting stun candidates for it.
1523 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout); 1517 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout);
1524 EXPECT_EQ(6u, observer_.mline_0_candidates_.size()); 1518 EXPECT_EQ(6u, observer_.mline_0_candidates_.size());
1525 EXPECT_EQ(6u, observer_.mline_1_candidates_.size()); 1519 EXPECT_EQ(6u, observer_.mline_1_candidates_.size());
1526 } 1520 }
1527 1521
1528 // Test session delivers no candidates gathered when constraint set to "none".
1529 TEST_F(WebRtcSessionTest, TestIceTransportsNone) {
1530 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
1531 InitWithIceTransport(PeerConnectionInterface::kNone);
1532 SendAudioVideoStream1();
1533 InitiateCall();
1534 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout);
1535 EXPECT_EQ(0u, observer_.mline_0_candidates_.size());
1536 EXPECT_EQ(0u, observer_.mline_1_candidates_.size());
1537 }
1538
1539 // Test session delivers only relay candidates gathered when constaint set to
1540 // "relay".
1541 TEST_F(WebRtcSessionTest, TestIceTransportsRelay) {
1542 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
1543 ConfigureAllocatorWithTurn();
1544 InitWithIceTransport(PeerConnectionInterface::kRelay);
1545 SendAudioVideoStream1();
1546 InitiateCall();
1547 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout);
1548 EXPECT_EQ(2u, observer_.mline_0_candidates_.size());
1549 EXPECT_EQ(2u, observer_.mline_1_candidates_.size());
1550 for (size_t i = 0; i < observer_.mline_0_candidates_.size(); ++i) {
1551 EXPECT_EQ(cricket::RELAY_PORT_TYPE,
1552 observer_.mline_0_candidates_[i].type());
1553 }
1554 for (size_t i = 0; i < observer_.mline_1_candidates_.size(); ++i) {
1555 EXPECT_EQ(cricket::RELAY_PORT_TYPE,
1556 observer_.mline_1_candidates_[i].type());
1557 }
1558 }
1559
1560 // Test session delivers all candidates gathered when constaint set to "all".
1561 TEST_F(WebRtcSessionTest, TestIceTransportsAll) {
1562 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
1563 InitWithIceTransport(PeerConnectionInterface::kAll);
1564 SendAudioVideoStream1();
1565 InitiateCall();
1566 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout);
1567 // Host + STUN. By default allocator is disabled to gather relay candidates.
1568 EXPECT_EQ(4u, observer_.mline_0_candidates_.size());
1569 EXPECT_EQ(4u, observer_.mline_1_candidates_.size());
1570 }
1571
1572 TEST_F(WebRtcSessionTest, SetSdpFailedOnInvalidSdp) { 1522 TEST_F(WebRtcSessionTest, SetSdpFailedOnInvalidSdp) {
1573 Init(); 1523 Init();
1574 SessionDescriptionInterface* offer = NULL; 1524 SessionDescriptionInterface* offer = NULL;
1575 // Since |offer| is NULL, there's no way to tell if it's an offer or answer. 1525 // Since |offer| is NULL, there's no way to tell if it's an offer or answer.
1576 std::string unknown_action; 1526 std::string unknown_action;
1577 SetLocalDescriptionExpectError(unknown_action, kInvalidSdp, offer); 1527 SetLocalDescriptionExpectError(unknown_action, kInvalidSdp, offer);
1578 SetRemoteDescriptionExpectError(unknown_action, kInvalidSdp, offer); 1528 SetRemoteDescriptionExpectError(unknown_action, kInvalidSdp, offer);
1579 } 1529 }
1580 1530
1581 // Test creating offers and receive answers and make sure the 1531 // Test creating offers and receive answers and make sure the
(...skipping 2822 matching lines...) Expand 10 before | Expand all | Expand 10 after
4404 } 4354 }
4405 4355
4406 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test 4356 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test
4407 // currently fails because upon disconnection and reconnection OnIceComplete is 4357 // currently fails because upon disconnection and reconnection OnIceComplete is
4408 // called more than once without returning to IceGatheringGathering. 4358 // called more than once without returning to IceGatheringGathering.
4409 4359
4410 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, 4360 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests,
4411 WebRtcSessionTest, 4361 WebRtcSessionTest,
4412 testing::Values(ALREADY_GENERATED, 4362 testing::Values(ALREADY_GENERATED,
4413 DTLS_IDENTITY_STORE)); 4363 DTLS_IDENTITY_STORE));
OLDNEW
« no previous file with comments | « webrtc/api/webrtcsession.cc ('k') | webrtc/p2p/base/candidate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698