Use headers_decompressed() in QuicTestClient::response_headers().
Use headers_decompressed() in QuicTestClient::response_headers() instead of
stream_bytes_read() + header_bytes_read() as a criterion for whether the stream
has received headers. This is more robust against partially received headers,
especially in case the HEADERS frame header has arrived without the frame
payload by the time response_headers() is called.
This fixes ///gfe/gfe2/quic:end_to_end_server_push_trailers_test test for draft CL cr/231494986.
gfe-relnote: n/a. Test-only change.
PiperOrigin-RevId: 245253221
Change-Id: I35815ae191da6f5c5ea89df0c4cc61b0b4b2580a
diff --git a/quic/test_tools/quic_test_client.cc b/quic/test_tools/quic_test_client.cc
index fb76f7a..61553c8 100644
--- a/quic/test_tools/quic_test_client.cc
+++ b/quic/test_tools/quic_test_client.cc
@@ -651,9 +651,7 @@
const spdy::SpdyHeaderBlock* QuicTestClient::response_headers() const {
for (std::pair<QuicStreamId, QuicSpdyClientStream*> stream : open_streams_) {
- size_t bytes_read =
- stream.second->stream_bytes_read() + stream.second->header_bytes_read();
- if (bytes_read > 0) {
+ if (stream.second->headers_decompressed()) {
response_headers_ = stream.second->response_headers().Clone();
break;
}