Migrate last uses of gunit.h macros

Bug: webrtc:381524905
Change-Id: I9bf00a61dfcc00355e81fea34625119ef3ac61b6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374860
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43769}
This commit is contained in:
Evan Shrubsole 2025-01-20 09:18:30 +00:00 committed by WebRTC LUCI CQ
parent 4f56e15075
commit 2a858e21f6
3 changed files with 42 additions and 12 deletions

View File

@ -7448,8 +7448,12 @@ class P2PTransportChannelTestDtlsInStun : public P2PTransportChannelTestBase {
if (ep2_support) { if (ep2_support) {
ep2_ch1()->SetDtlsDataToPiggyback(dtls_data); ep2_ch1()->SetDtlsDataToPiggyback(dtls_data);
} }
EXPECT_TRUE_SIMULATED_WAIT(CheckConnected(ep1_ch1(), ep2_ch1()), EXPECT_THAT(
kDefaultTimeout, clock_); webrtc::WaitUntil(
[&] { return CheckConnected(ep1_ch1(), ep2_ch1()); }, IsTrue(),
{.timeout = webrtc::TimeDelta::Millis(kDefaultTimeout),
.clock = &clock_}),
webrtc::IsRtcOk());
} }
rtc::ScopedFakeClock clock_; rtc::ScopedFakeClock clock_;

View File

@ -17,6 +17,8 @@
#include "api/candidate.h" #include "api/candidate.h"
#include "api/crypto/crypto_options.h" #include "api/crypto/crypto_options.h"
#include "api/scoped_refptr.h" #include "api/scoped_refptr.h"
#include "api/test/rtc_error_matchers.h"
#include "api/units/time_delta.h"
#include "p2p/base/basic_packet_socket_factory.h" #include "p2p/base/basic_packet_socket_factory.h"
#include "p2p/base/ice_transport_internal.h" #include "p2p/base/ice_transport_internal.h"
#include "p2p/base/p2p_transport_channel.h" #include "p2p/base/p2p_transport_channel.h"
@ -26,7 +28,6 @@
#include "p2p/dtls/dtls_transport.h" #include "p2p/dtls/dtls_transport.h"
#include "rtc_base/fake_clock.h" #include "rtc_base/fake_clock.h"
#include "rtc_base/fake_network.h" #include "rtc_base/fake_network.h"
#include "rtc_base/gunit.h"
#include "rtc_base/rtc_certificate.h" #include "rtc_base/rtc_certificate.h"
#include "rtc_base/socket_address.h" #include "rtc_base/socket_address.h"
#include "rtc_base/ssl_fingerprint.h" #include "rtc_base/ssl_fingerprint.h"
@ -35,7 +36,9 @@
#include "rtc_base/third_party/sigslot/sigslot.h" #include "rtc_base/third_party/sigslot/sigslot.h"
#include "rtc_base/thread.h" #include "rtc_base/thread.h"
#include "rtc_base/virtual_socket_server.h" #include "rtc_base/virtual_socket_server.h"
#include "test/gmock.h"
#include "test/gtest.h" #include "test/gtest.h"
#include "test/wait_until.h"
namespace { namespace {
constexpr int kDefaultTimeout = 10000; constexpr int kDefaultTimeout = 10000;
@ -56,6 +59,8 @@ void SetRemoteFingerprintFromCert(
namespace cricket { namespace cricket {
using ::testing::IsTrue;
class DtlsIceIntegrationTest class DtlsIceIntegrationTest
: public ::testing::TestWithParam<std::tuple<bool, bool>>, : public ::testing::TestWithParam<std::tuple<bool, bool>>,
public sigslot::has_slots<> { public sigslot::has_slots<> {
@ -172,8 +177,13 @@ TEST_P(DtlsIceIntegrationTest, SmokeTest) {
server_ice_->MaybeStartGathering(); server_ice_->MaybeStartGathering();
// Note: this only reaches the pending piggybacking state. // Note: this only reaches the pending piggybacking state.
EXPECT_TRUE_SIMULATED_WAIT(client_dtls_.writable() && server_dtls_.writable(), EXPECT_THAT(
kDefaultTimeout, fake_clock_); webrtc::WaitUntil(
[&] { return client_dtls_.writable() && server_dtls_.writable(); },
IsTrue(),
{.timeout = webrtc::TimeDelta::Millis(kDefaultTimeout),
.clock = &fake_clock_}),
webrtc::IsRtcOk());
EXPECT_EQ(client_ice_->IsDtlsPiggybackSupportedByPeer(), EXPECT_EQ(client_ice_->IsDtlsPiggybackSupportedByPeer(),
client_dtls_stun_piggyback_ && server_dtls_stun_piggyback_); client_dtls_stun_piggyback_ && server_dtls_stun_piggyback_);
EXPECT_EQ(server_ice_->IsDtlsPiggybackSupportedByPeer(), EXPECT_EQ(server_ice_->IsDtlsPiggybackSupportedByPeer(),

View File

@ -32,7 +32,9 @@
#include "api/rtp_transceiver_direction.h" #include "api/rtp_transceiver_direction.h"
#include "api/rtp_transceiver_interface.h" #include "api/rtp_transceiver_interface.h"
#include "api/scoped_refptr.h" #include "api/scoped_refptr.h"
#include "api/test/rtc_error_matchers.h"
#include "api/uma_metrics.h" #include "api/uma_metrics.h"
#include "api/units/time_delta.h"
#include "api/video_codecs/sdp_video_format.h" #include "api/video_codecs/sdp_video_format.h"
#include "api/video_codecs/video_decoder_factory_template.h" #include "api/video_codecs/video_decoder_factory_template.h"
#include "api/video_codecs/video_decoder_factory_template_dav1d_adapter.h" #include "api/video_codecs/video_decoder_factory_template_dav1d_adapter.h"
@ -54,12 +56,12 @@
#include "pc/test/fake_rtc_certificate_generator.h" #include "pc/test/fake_rtc_certificate_generator.h"
#include "pc/test/integration_test_helpers.h" #include "pc/test/integration_test_helpers.h"
#include "pc/test/mock_peer_connection_observers.h" #include "pc/test/mock_peer_connection_observers.h"
#include "rtc_base/gunit.h"
#include "rtc_base/string_encode.h" #include "rtc_base/string_encode.h"
#include "rtc_base/thread.h" #include "rtc_base/thread.h"
#include "system_wrappers/include/metrics.h" #include "system_wrappers/include/metrics.h"
#include "test/gmock.h" #include "test/gmock.h"
#include "test/gtest.h" #include "test/gtest.h"
#include "test/wait_until.h"
// This file contains unit tests that relate to the behavior of the // This file contains unit tests that relate to the behavior of the
// SdpOfferAnswer module. // SdpOfferAnswer module.
@ -69,6 +71,8 @@
namespace webrtc { namespace webrtc {
using ::testing::Eq;
using ::testing::IsTrue;
using RTCConfiguration = PeerConnectionInterface::RTCConfiguration; using RTCConfiguration = PeerConnectionInterface::RTCConfiguration;
using ::testing::ElementsAre; using ::testing::ElementsAre;
using ::testing::Pair; using ::testing::Pair;
@ -1554,18 +1558,30 @@ TEST_F(SdpOfferAnswerMungingTest, DISABLED_ReportUMAMetricsWithNoMunging) {
metrics::Samples("WebRTC.PeerConnection.SdpMunging.Answer.Initial"), metrics::Samples("WebRTC.PeerConnection.SdpMunging.Answer.Initial"),
ElementsAre(Pair(SdpMungingType::kNoModification, 1))); ElementsAre(Pair(SdpMungingType::kNoModification, 1)));
EXPECT_TRUE_WAIT(caller->IsIceGatheringDone(), kDefaultTimeout); EXPECT_THAT(
EXPECT_TRUE_WAIT(callee->IsIceGatheringDone(), kDefaultTimeout); WaitUntil([&] { return caller->IsIceGatheringDone(); }, IsTrue(),
{.timeout = webrtc::TimeDelta::Millis(kDefaultTimeout)}),
IsRtcOk());
EXPECT_THAT(
WaitUntil([&] { return callee->IsIceGatheringDone(); }, IsTrue(),
{.timeout = webrtc::TimeDelta::Millis(kDefaultTimeout)}),
IsRtcOk());
for (const auto& candidate : caller->observer()->GetAllCandidates()) { for (const auto& candidate : caller->observer()->GetAllCandidates()) {
callee->pc()->AddIceCandidate(candidate); callee->pc()->AddIceCandidate(candidate);
} }
for (const auto& candidate : callee->observer()->GetAllCandidates()) { for (const auto& candidate : callee->observer()->GetAllCandidates()) {
caller->pc()->AddIceCandidate(candidate); caller->pc()->AddIceCandidate(candidate);
} }
EXPECT_EQ_WAIT(PeerConnectionInterface::PeerConnectionState::kConnected, EXPECT_THAT(
caller->pc()->peer_connection_state(), kDefaultTimeout); WaitUntil([&] { return caller->pc()->peer_connection_state(); },
EXPECT_EQ_WAIT(PeerConnectionInterface::PeerConnectionState::kConnected, Eq(PeerConnectionInterface::PeerConnectionState::kConnected),
callee->pc()->peer_connection_state(), kDefaultTimeout); {.timeout = webrtc::TimeDelta::Millis(kDefaultTimeout)}),
IsRtcOk());
EXPECT_THAT(
WaitUntil([&] { return callee->pc()->peer_connection_state(); },
Eq(PeerConnectionInterface::PeerConnectionState::kConnected),
{.timeout = webrtc::TimeDelta::Millis(kDefaultTimeout)}),
IsRtcOk());
caller->pc()->Close(); caller->pc()->Close();
callee->pc()->Close(); callee->pc()->Close();