From bf2f569b220347c5d07d3c7d1e967bcaa0a3aad0 Mon Sep 17 00:00:00 2001 From: Taylor Brandstetter Date: Wed, 29 Jun 2016 11:22:47 -0700 Subject: [PATCH] Fixing flakiness of CreateDataChannelAfterNegotiate. Test worked by creating a dummy data channel just to trigger the SDP generation, then creating two data channels after negotiation. However the dummy data channel is then racing with the "real" data channel to get negotiated, so they could be signaled in the reverse of the expected order. Fixed this by simply waiting for the dummy data channel to be signaled before creating the other data channels. BUG=webrtc:3980 R=pthatcher@webrtc.org, skvlad@webrtc.org Review URL: https://codereview.webrtc.org/2112593002 . Cr-Commit-Position: refs/heads/master@{#13329} --- webrtc/api/peerconnectionendtoend_unittest.cc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/webrtc/api/peerconnectionendtoend_unittest.cc b/webrtc/api/peerconnectionendtoend_unittest.cc index 4ca73babdb..e01daa9439 100644 --- a/webrtc/api/peerconnectionendtoend_unittest.cc +++ b/webrtc/api/peerconnectionendtoend_unittest.cc @@ -215,14 +215,7 @@ TEST_F(PeerConnectionEndToEndTest, CreateDataChannelBeforeNegotiate) { // Verifies that a DataChannel created after the negotiation can transition to // "OPEN" and transfer data. -#if defined(MEMORY_SANITIZER) -// Fails under MemorySanitizer: -// See https://code.google.com/p/webrtc/issues/detail?id=3980. -#define MAYBE_CreateDataChannelAfterNegotiate DISABLED_CreateDataChannelAfterNegotiate -#else -#define MAYBE_CreateDataChannelAfterNegotiate CreateDataChannelAfterNegotiate -#endif -TEST_F(PeerConnectionEndToEndTest, MAYBE_CreateDataChannelAfterNegotiate) { +TEST_F(PeerConnectionEndToEndTest, CreateDataChannelAfterNegotiate) { MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); CreatePcs(); @@ -235,7 +228,10 @@ TEST_F(PeerConnectionEndToEndTest, MAYBE_CreateDataChannelAfterNegotiate) { Negotiate(); WaitForConnection(); - // Creates new DataChannels after the negotiation and verifies their states. + // Wait for the data channel created pre-negotiation to be opened. + WaitForDataChannelsToOpen(dummy, callee_signaled_data_channels_, 0); + + // Create new DataChannels after the negotiation and verify their states. rtc::scoped_refptr caller_dc( caller_->CreateDataChannel("hello", init)); rtc::scoped_refptr callee_dc(