diff --git a/pc/test/integration_test_helpers.h b/pc/test/integration_test_helpers.h index 24d4616577..f408e0cd15 100644 --- a/pc/test/integration_test_helpers.h +++ b/pc/test/integration_test_helpers.h @@ -27,6 +27,7 @@ #include #include "absl/algorithm/container.h" +#include "absl/memory/memory.h" #include "absl/types/optional.h" #include "api/audio_options.h" #include "api/call/call_factory_interface.h" @@ -1045,9 +1046,12 @@ class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver, int sdp_mline_index, const std::string& msg) override { RTC_LOG(LS_INFO) << debug_name_ << ": ReceiveIceMessage"; - std::unique_ptr candidate( - webrtc::CreateIceCandidate(sdp_mid, sdp_mline_index, msg, nullptr)); - EXPECT_TRUE(pc()->AddIceCandidate(candidate.get())); + absl::optional result; + pc()->AddIceCandidate(absl::WrapUnique(webrtc::CreateIceCandidate( + sdp_mid, sdp_mline_index, msg, nullptr)), + [&result](RTCError r) { result = r; }); + EXPECT_TRUE_WAIT(result.has_value(), kDefaultTimeout); + EXPECT_TRUE(result.value().ok()); } // PeerConnectionObserver callbacks.