From 17ea068e8c72ec8ee31002eb6c23cf453c090d60 Mon Sep 17 00:00:00 2001 From: Harald Alvestrand Date: Fri, 13 Dec 2019 11:51:04 +0100 Subject: [PATCH] Integration test that verifies that data channels open. This is in preparation for writing tests that verify that they close, and that they close at the right times. Bug: chromium:1030631, webrtc:10360 Change-Id: I8129a9fc9731c1bfe1a660e82e23c1aeff1e5087 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/162181 Reviewed-by: Steve Anton Commit-Queue: Harald Alvestrand Cr-Commit-Position: refs/heads/master@{#30091} --- pc/peer_connection_integrationtest.cc | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/pc/peer_connection_integrationtest.cc b/pc/peer_connection_integrationtest.cc index ab617c685b..7a8d152abc 100644 --- a/pc/peer_connection_integrationtest.cc +++ b/pc/peer_connection_integrationtest.cc @@ -3556,6 +3556,7 @@ TEST_P(PeerConnectionIntegrationTest, SctpDataChannelToAudioVideoUpgrade) { static void MakeSpecCompliantSctpOffer(cricket::SessionDescription* desc) { cricket::SctpDataContentDescription* dcd_offer = GetFirstSctpDataContentDescription(desc); + // See https://crbug.com/webrtc/11211 - this function is a no-op ASSERT_TRUE(dcd_offer); dcd_offer->set_use_sctpmap(false); dcd_offer->set_protocol("UDP/DTLS/SCTP"); @@ -5967,15 +5968,25 @@ TEST_F(PeerConnectionIntegrationTestUnifiedPlan, caller()->CreateDataChannel(); caller()->AddAudioVideoTracks(); callee()->AddAudioVideoTracks(); - caller()->SetGeneratedSdpMunger(MakeSpecCompliantSctpOffer); caller()->CreateAndSetAndSignalOffer(); ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); - // Ensure that media and data are multiplexed on the same DTLS transport. - // This only works on Unified Plan, because transports are not exposed in plan - // B. - auto sctp_info = caller()->pc()->GetSctpTransport()->Information(); - EXPECT_EQ(sctp_info.dtls_transport(), - caller()->pc()->GetSenders()[0]->dtls_transport()); + ASSERT_EQ_WAIT(SctpTransportState::kConnected, + caller()->pc()->GetSctpTransport()->Information().state(), + kDefaultTimeout); + ASSERT_TRUE_WAIT(callee()->data_channel(), kDefaultTimeout); + ASSERT_TRUE_WAIT(callee()->data_observer()->IsOpen(), kDefaultTimeout); +} + +TEST_F(PeerConnectionIntegrationTestUnifiedPlan, + EndToEndCallWithDataChannelOnlyConnects) { + ASSERT_TRUE(CreatePeerConnectionWrappers()); + ConnectFakeSignaling(); + caller()->CreateDataChannel(); + caller()->CreateAndSetAndSignalOffer(); + ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); + ASSERT_TRUE_WAIT(callee()->data_channel(), kDefaultTimeout); + ASSERT_TRUE_WAIT(callee()->data_observer()->IsOpen(), kDefaultTimeout); + ASSERT_TRUE(caller()->data_observer()->IsOpen()); } #endif // HAVE_SCTP