Check that every dynamic entry reference is acknowledged.

Check that EncodingEndpoint receives acknowledgement of every dynamic entry
reference (in header blocks and on the encoder stream) at the end of the test,
in qpack_round_trip_fuzzer.cc.

gfe-relnote: n/a, test-only change.
PiperOrigin-RevId: 263542080
Change-Id: I47b3198a27853132a935b120a9b01755a3da5223
diff --git a/quic/core/qpack/fuzzer/qpack_round_trip_fuzzer.cc b/quic/core/qpack/fuzzer/qpack_round_trip_fuzzer.cc
index d2b8904..84c6948 100644
--- a/quic/core/qpack/fuzzer/qpack_round_trip_fuzzer.cc
+++ b/quic/core/qpack/fuzzer/qpack_round_trip_fuzzer.cc
@@ -19,6 +19,7 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_containers.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_fuzzed_data_provider.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_ptr_util.h"
+#include "net/third_party/quiche/src/quic/test_tools/qpack_encoder_peer.h"
 #include "net/third_party/quiche/src/spdy/core/spdy_header_block.h"
 
 namespace quic {
@@ -34,6 +35,12 @@
     encoder_.SetMaximumBlockedStreams(maximum_blocked_streams);
   }
 
+  ~EncodingEndpoint() {
+    // Every reference should be acknowledged.
+    CHECK_EQ(std::numeric_limits<uint64_t>::max(),
+             QpackEncoderPeer::smallest_blocking_index(&encoder_));
+  }
+
   void set_qpack_stream_sender_delegate(QpackStreamSenderDelegate* delegate) {
     encoder_.set_qpack_stream_sender_delegate(delegate);
   }
diff --git a/quic/test_tools/qpack_encoder_peer.cc b/quic/test_tools/qpack_encoder_peer.cc
index 4e4bb52..9719bdb 100644
--- a/quic/test_tools/qpack_encoder_peer.cc
+++ b/quic/test_tools/qpack_encoder_peer.cc
@@ -20,5 +20,11 @@
   return encoder->maximum_blocked_streams_;
 }
 
+// static
+uint64_t QpackEncoderPeer::smallest_blocking_index(
+    const QpackEncoder* encoder) {
+  return encoder->blocking_manager_.smallest_blocking_index();
+}
+
 }  // namespace test
 }  // namespace quic
diff --git a/quic/test_tools/qpack_encoder_peer.h b/quic/test_tools/qpack_encoder_peer.h
index b8a8cc7..2edf427 100644
--- a/quic/test_tools/qpack_encoder_peer.h
+++ b/quic/test_tools/qpack_encoder_peer.h
@@ -20,6 +20,7 @@
 
   static QpackHeaderTable* header_table(QpackEncoder* encoder);
   static uint64_t maximum_blocked_streams(const QpackEncoder* encoder);
+  static uint64_t smallest_blocking_index(const QpackEncoder* encoder);
 };
 
 }  // namespace test