Fix BandwidthSampler tests for OSS QUICHE and Chromium exports. - Fix Chromium failures on the two flag-off `EXPECT_QUIC_BUG` assertions from cl/1021256104: because cl/998854040 downgrades `BandwidthSampler`'s overflow `QUIC_BUG` to `WARNING` in OSS, no `DFATAL` is emitted for `EXPECT_QUIC_BUG` (`EXPECT_DFATAL` in Chromium) to match. Wrap both assertions (and the unused `quic_expect_bug.h` include) in Copybara directives so OSS runs the send calls without `EXPECT_QUIC_BUG` until cl/998854040 is reverted. - Silence uninteresting GMock warnings (`OnSerializedPacket`, `OnMinRttAvailable`, `RandBytes`) in `ClientIpAndPortChangesDoNotCauseBandwidthSamplerGrowth` so per-test output doesn't exceed Chromium's `TEST_EXCESSIVE_OUTPUT` limit. PiperOrigin-RevId: 1030090594
diff --git a/quiche/quic/core/quic_connection_test.cc b/quiche/quic/core/quic_connection_test.cc index 6ac2128..73bfb91 100644 --- a/quiche/quic/core/quic_connection_test.cc +++ b/quiche/quic/core/quic_connection_test.cc
@@ -2550,6 +2550,9 @@ EXPECT_CALL(visitor_, OnConnectionMigration(_)).Times(AnyNumber()); EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(AnyNumber()); EXPECT_CALL(visitor_, MaybeSendAddressToken()).Times(AnyNumber()); + EXPECT_CALL(connection_, OnSerializedPacket(_)).Times(AnyNumber()); + EXPECT_CALL(*loss_algorithm_, OnMinRttAvailable()).Times(AnyNumber()); + EXPECT_CALL(random_generator_, RandBytes(_, _)).Times(AnyNumber()); QuicConnectionPeer::SetAddressValidated(&connection_); QuicConnectionId server_cid0 = connection_.connection_id(); @@ -2638,10 +2641,9 @@ EXPECT_EQ(connection_.sent_packet_manager().GetSendAlgorithm(), unfixed_send_algorithm); connection_.SendStreamDataWithString(1, "a", stream_offset++, NO_FIN); - EXPECT_QUIC_BUG( - connection_.SendStreamDataWithString(1, "a", stream_offset++, NO_FIN), - "BandwidthSampler in-flight packet map has exceeded maximum number of " - "tracked packets"); + // In OSS, BandwidthSampler::OnPacketSent downgrades the tracked-packet + // overflow QUIC_BUG to QUIC_LOG_EVERY_N_SEC(WARNING, 600). + connection_.SendStreamDataWithString(1, "a", stream_offset++, NO_FIN); } TEST_P(QuicConnectionTest,
diff --git a/quiche/quic/core/quic_sent_packet_manager_test.cc b/quiche/quic/core/quic_sent_packet_manager_test.cc index 8fd3a6d..065876b 100644 --- a/quiche/quic/core/quic_sent_packet_manager_test.cc +++ b/quiche/quic/core/quic_sent_packet_manager_test.cc
@@ -36,7 +36,6 @@ #include "quiche/quic/core/quic_time.h" #include "quiche/quic/core/quic_types.h" #include "quiche/quic/core/quic_unacked_packet_map.h" -#include "quiche/quic/platform/api/quic_expect_bug.h" #include "quiche/quic/platform/api/quic_flags.h" #include "quiche/quic/platform/api/quic_test.h" #include "quiche/quic/test_tools/mock_clock.h" @@ -1588,10 +1587,10 @@ if (remove_obsolete) { send_packet(1102); } else { - EXPECT_QUIC_BUG( - send_packet(1102), - "BandwidthSampler in-flight packet map has exceeded maximum " - "number of tracked packets"); + // In OSS, BandwidthSampler::OnPacketSent downgrades the + // tracked-packet overflow QUIC_BUG to + // QUIC_LOG_EVERY_N_SEC(WARNING, 600). + send_packet(1102); } } }