Deflake RTCStatsIntegrationTest::GetStatsFromCallee

The test may sometimes fail because the round trip time has not been
estimated. Wait until the report contains the round trip time before
proceeding, or fail after 10 s.

Fixed: webrtc:14952
Change-Id: I9127b8ee6afa7454d061de96f002422d7d4af428
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/295724
Commit-Queue: Johannes Kron <kron@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39438}
This commit is contained in:
Johannes Kron 2023-03-01 12:25:50 +00:00 committed by WebRTC LUCI CQ
parent cec9d00769
commit bff2e27076

View file

@ -1165,7 +1165,17 @@ TEST_F(RTCStatsIntegrationTest, GetStatsFromCaller) {
TEST_F(RTCStatsIntegrationTest, GetStatsFromCallee) {
StartCall();
rtc::scoped_refptr<const RTCStatsReport> report = GetStatsFromCallee();
rtc::scoped_refptr<const RTCStatsReport> report;
// Wait for round trip time measurements to be defined.
constexpr int kMaxWaitMs = 10000;
auto GetStatsReportAndReturnTrueIfRttIsDefined = [&report, this] {
report = GetStatsFromCallee();
auto inbound_stats =
report->GetStatsOfType<RTCRemoteInboundRtpStreamStats>();
return !inbound_stats.empty() &&
inbound_stats.front()->round_trip_time_measurements.is_defined();
};
EXPECT_TRUE_WAIT(GetStatsReportAndReturnTrueIfRttIsDefined(), kMaxWaitMs);
RTCStatsReportVerifier(report.get()).VerifyReport({});
#if RTC_TRACE_EVENTS_ENABLED