From 7145280954d4111230515d06e73f24c6d199b9ae Mon Sep 17 00:00:00 2001 From: deadbeef Date: Sun, 7 May 2017 17:21:01 -0700 Subject: [PATCH] Unflaking PeerConnectionIntegrationTest.DtmfSenderObserver. The test attempted to call InsertDtmf before verifying that the DTLS handshake was complete. Unlike a data channel, the DTMF sender doesn't do any buffering, so this isn't reliable. BUG=webrtc:7547 NOTRY=True Review-Url: https://codereview.webrtc.org/2855573004 Cr-Commit-Position: refs/heads/master@{#18041} --- webrtc/pc/peerconnection_integrationtest.cc | 31 ++++++++++++--------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/webrtc/pc/peerconnection_integrationtest.cc b/webrtc/pc/peerconnection_integrationtest.cc index 0ee4cbd719..2c19c8d93e 100644 --- a/webrtc/pc/peerconnection_integrationtest.cc +++ b/webrtc/pc/peerconnection_integrationtest.cc @@ -958,6 +958,20 @@ class PeerConnectionIntegrationTest : public testing::Test { return caller_->SignalingStateStable() && callee_->SignalingStateStable(); } + bool DtlsConnected() { + // TODO(deadbeef): kIceConnectionConnected currently means both ICE and DTLS + // are connected. This is an important distinction. Once we have separate + // ICE and DTLS state, this check needs to use the DTLS state. + return (callee()->ice_connection_state() == + webrtc::PeerConnectionInterface::kIceConnectionConnected || + callee()->ice_connection_state() == + webrtc::PeerConnectionInterface::kIceConnectionCompleted) && + (caller()->ice_connection_state() == + webrtc::PeerConnectionInterface::kIceConnectionConnected || + caller()->ice_connection_state() == + webrtc::PeerConnectionInterface::kIceConnectionCompleted); + } + bool CreatePeerConnectionWrappers() { return CreatePeerConnectionWrappersWithConfig( PeerConnectionInterface::RTCConfiguration(), @@ -1245,6 +1259,8 @@ TEST_F(PeerConnectionIntegrationTest, DtmfSenderObserver) { callee()->AddAudioOnlyMediaStream(); caller()->CreateAndSetAndSignalOffer(); ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); + // DTLS must finish before the DTMF sender can be used reliably. + ASSERT_TRUE_WAIT(DtlsConnected(), kDefaultTimeout); TestDtmfFromSenderToReceiver(caller(), callee()); TestDtmfFromSenderToReceiver(callee(), caller()); } @@ -2781,19 +2797,8 @@ TEST_F(PeerConnectionIntegrationTest, EndToEndConnectionTimeWithTurnTurnPair) { options.offer_to_receive_video = 1; caller()->SetOfferAnswerOptions(options); caller()->CreateAndSetAndSignalOffer(); - // TODO(deadbeef): kIceConnectionConnected currently means both ICE and DTLS - // are connected. This is an important distinction. Once we have separate ICE - // and DTLS state, this check needs to use the DTLS state. - EXPECT_TRUE_SIMULATED_WAIT( - (callee()->ice_connection_state() == - webrtc::PeerConnectionInterface::kIceConnectionConnected || - callee()->ice_connection_state() == - webrtc::PeerConnectionInterface::kIceConnectionCompleted) && - (caller()->ice_connection_state() == - webrtc::PeerConnectionInterface::kIceConnectionConnected || - caller()->ice_connection_state() == - webrtc::PeerConnectionInterface::kIceConnectionCompleted), - total_connection_time_ms, fake_clock); + EXPECT_TRUE_SIMULATED_WAIT(DtlsConnected(), total_connection_time_ms, + fake_clock); // Need to free the clients here since they're using things we created on // the stack. delete SetCallerPcWrapperAndReturnCurrent(nullptr);