diff --git a/pc/peer_connection_integrationtest.cc b/pc/peer_connection_integrationtest.cc index 940d7fdc74..8afd807ff7 100644 --- a/pc/peer_connection_integrationtest.cc +++ b/pc/peer_connection_integrationtest.cc @@ -1797,7 +1797,7 @@ constexpr int kOnlyLocalPorts = cricket::PORTALLOCATOR_DISABLE_STUN | // Use a mock resolver to resolve the hostname back to the original IP on both // sides and check that the ICE connection connects. // TODO(bugs.webrtc.org/12590): Flaky on Windows and on Linux MSAN. -#if defined(WEBRTC_WIN) || defined(WEBRTC_LINUX) +#if defined(WEBRTC_WIN) #define MAYBE_IceStatesReachCompletionWithRemoteHostname \ DISABLED_IceStatesReachCompletionWithRemoteHostname #else @@ -1856,6 +1856,7 @@ TEST_P(PeerConnectionIntegrationTest, EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents( "WebRTC.PeerConnection.CandidatePairType_UDP", webrtc::kIceCandidatePairHostNameHostName)); + DestroyPeerConnections(); } #endif // !defined(THREAD_SANITIZER) diff --git a/pc/test/integration_test_helpers.h b/pc/test/integration_test_helpers.h index a1d3a548e5..e733bea5c7 100644 --- a/pc/test/integration_test_helpers.h +++ b/pc/test/integration_test_helpers.h @@ -1715,6 +1715,20 @@ class PeerConnectionIntegrationBaseTest : public ::testing::Test { PeerConnectionIntegrationWrapper* caller() { return caller_.get(); } + // Destroy peerconnections. + // This can be used to ensure that all pointers to on-stack mocks + // get dropped before exit. + void DestroyPeerConnections() { + if (caller_) { + caller_->pc()->Close(); + } + if (callee_) { + callee_->pc()->Close(); + } + caller_.reset(); + callee_.reset(); + } + // Set the `caller_` to the `wrapper` passed in and return the // original `caller_`. PeerConnectionIntegrationWrapper* SetCallerPcWrapperAndReturnCurrent(