Commit 44441da8 authored by rjshade's avatar rjshade Committed by Commit bot

Fix flaky headers stream test in quic_session_test.

Randomly sized test headers would occasionally fit exactly in the stream flow control window, resulting in the stream being flow control blocked but without any pending queued data. Do one extra write after becoming blocked to ensure there is queued data.

BUG=423586

Review URL: https://codereview.chromium.org/669963003

Cr-Commit-Position: refs/heads/master@{#300684}
parent 19ae0a5c
......@@ -729,23 +729,26 @@ TEST_P(QuicSessionTest, HandshakeUnblocksFlowControlBlockedHeadersStream) {
EXPECT_FALSE(session_.IsStreamFlowControlBlocked());
QuicStreamId stream_id = 5;
// Write until the header stream is flow control blocked.
SpdyHeaderBlock headers;
while (!headers_stream->flow_controller()->IsBlocked() && stream_id < 2010) {
EXPECT_FALSE(session_.IsConnectionFlowControlBlocked());
EXPECT_FALSE(session_.IsStreamFlowControlBlocked());
SpdyHeaderBlock headers;
headers["header"] = base::Uint64ToString(base::RandUint64()) +
base::Uint64ToString(base::RandUint64()) +
base::Uint64ToString(base::RandUint64());
headers_stream->WriteHeaders(stream_id, headers, true, nullptr);
stream_id += 2;
}
// Write one more to ensure that the headers stream has buffered data. The
// random headers may have exactly filled the flow control window.
headers_stream->WriteHeaders(stream_id, headers, true, nullptr);
EXPECT_TRUE(headers_stream->HasBufferedData());
EXPECT_TRUE(headers_stream->flow_controller()->IsBlocked());
EXPECT_FALSE(crypto_stream->flow_controller()->IsBlocked());
EXPECT_FALSE(session_.IsConnectionFlowControlBlocked());
EXPECT_TRUE(session_.IsStreamFlowControlBlocked());
EXPECT_FALSE(session_.HasDataToWrite());
// TODO(rtenneti): crbug.com/423586 headers_stream->HasBufferedData is flaky.
// EXPECT_TRUE(headers_stream->HasBufferedData());
// Now complete the crypto handshake, resulting in an increased flow control
// send window.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment