Fixing flakiness in PeerConnectionIntegrationTest.

EndToEndConnectionTimeWithTurnTurnPair was failing intermittently due to
a DCHECK being hit in ports.cc. This was caused by the ScopedFakeClock
being destroyed before the ports. The ports miscalculated a large
negative number for the rtt of a STUN request/response due to the global
clock changing. This fixes the problem by closing the PeerConnections
before the ScopedFakeClock goes out of scope.

Bug: webrtc:9422
Change-Id: Ia4aa3f638dff5da4317a35cf1514ec61472d0d74
Reviewed-on: https://webrtc-review.googlesource.com/84241
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Commit-Queue: Seth Hampson <shampson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23670}
This commit is contained in:
Seth Hampson 2018-06-19 14:31:41 -07:00 committed by Commit Bot
parent 66cadcc6b9
commit 1d4a76da0a

View File

@ -3038,6 +3038,11 @@ TEST_P(PeerConnectionIntegrationTest,
MockDataChannelObserver new_observer(callee()->data_channel());
EXPECT_EQ_SIMULATED_WAIT(data, new_observer.last_message(), kDefaultTimeout,
fake_clock);
// Closing the PeerConnections destroys the ports before the ScopedFakeClock.
// If this is not done a DCHECK can be hit in ports.cc, because a large
// negative number is calculated for the rtt due to the global clock changing.
caller()->pc()->Close();
callee()->pc()->Close();
}
// This test sets up a call between two parties with audio, video and but only
@ -3934,6 +3939,11 @@ TEST_P(PeerConnectionIntegrationTest, EndToEndConnectionTimeWithTurnTurnPair) {
caller()->CreateAndSetAndSignalOffer();
EXPECT_TRUE_SIMULATED_WAIT(DtlsConnected(), total_connection_time_ms,
fake_clock);
// Closing the PeerConnections destroys the ports before the ScopedFakeClock.
// If this is not done a DCHECK can be hit in ports.cc, because a large
// negative number is calculated for the rtt due to the global clock changing.
caller()->pc()->Close();
callee()->pc()->Close();
}
// Verify that a TurnCustomizer passed in through RTCConfiguration