Index: net/tools/quic/end_to_end_test.cc |
diff --git a/net/tools/quic/end_to_end_test.cc b/net/tools/quic/end_to_end_test.cc |
index 0d82d6dc4baf731a03dd811d97f1d45d6e5792f7..735cbb2c469cdde237843e8b258b26e988c096ac 100644 |
--- a/net/tools/quic/end_to_end_test.cc |
+++ b/net/tools/quic/end_to_end_test.cc |
@@ -1053,6 +1053,28 @@ TEST_P(EndToEndTest, InvalidStream) { |
EXPECT_EQ(QUIC_INVALID_STREAM_ID, client_->connection_error()); |
} |
+TEST_P(EndToEndTest, EarlyResponseWithQuicStreamNoError) { |
+ ASSERT_TRUE(Initialize()); |
+ client_->client()->WaitForCryptoHandshakeConfirmed(); |
+ |
+ string large_body; |
+ GenerateBody(&large_body, 1024 * 1024); |
+ |
+ HTTPMessage request(HttpConstants::HTTP_1_1, HttpConstants::POST, "/foo"); |
+ request.AddBody(large_body, false); |
+ |
+ // Insert an invalid content_length field in request to trigger an early |
+ // response from server. |
+ request.AddHeader("content-length", "-3"); |
+ |
+ request.set_skip_message_validation(true); |
+ client_->SendCustomSynchronousRequest(request); |
+ EXPECT_EQ("bad", client_->response_body()); |
+ EXPECT_EQ(500u, client_->response_headers()->parsed_response_code()); |
+ EXPECT_EQ(QUIC_STREAM_NO_ERROR, client_->stream_error()); |
+ EXPECT_EQ(QUIC_NO_ERROR, client_->connection_error()); |
+} |
+ |
// TODO(rch): this test seems to cause net_unittests timeouts :| |
TEST_P(EndToEndTest, DISABLED_MultipleTermination) { |
ASSERT_TRUE(Initialize()); |
@@ -2066,26 +2088,33 @@ TEST_P(EndToEndTest, LargePostEarlyResponse) { |
// Receive the response and let the server close writing. |
client_->WaitForInitialResponse(); |
EXPECT_EQ(500u, client_->response_headers()->parsed_response_code()); |
- // Send a body larger than the stream flow control window. |
- string body; |
- GenerateBody(&body, kBodySize); |
- client_->SendData(body, true); |
- |
- if (FLAGS_quic_implement_stop_reading) { |
- // Run the client to let any buffered data be sent. |
- // (This is OK despite already waiting for a response.) |
- client_->WaitForResponse(); |
- // There should be no buffered data to write in the client's stream. |
- ReliableQuicStream* stream = client_->client()->session()->GetStream(5); |
- EXPECT_FALSE(stream != nullptr && stream->HasBufferedData()); |
+ |
+ if (negotiated_version_ <= QUIC_VERSION_28) { |
+ // Send a body larger than the stream flow control window. |
+ string body; |
+ GenerateBody(&body, kBodySize); |
+ client_->SendData(body, true); |
+ |
+ if (FLAGS_quic_implement_stop_reading) { |
+ // Run the client to let any buffered data be sent. |
+ // (This is OK despite already waiting for a response.) |
+ client_->WaitForResponse(); |
+ // There should be no buffered data to write in the client's stream. |
+ ReliableQuicStream* stream = client_->client()->session()->GetStream(5); |
+ EXPECT_FALSE(stream != nullptr && stream->HasBufferedData()); |
+ } else { |
+ // Run the client for 0.1 second to let any buffered data be sent. |
+ // Must have a timeout, as the stream will not close and cause a return. |
+ // (This is OK despite already waiting for a response.) |
+ client_->WaitForResponseForMs(100); |
+ // There will be buffered data to write in the client's stream. |
+ ReliableQuicStream* stream = client_->client()->session()->GetStream(5); |
+ EXPECT_TRUE(stream != nullptr && stream->HasBufferedData()); |
+ } |
} else { |
- // Run the client for 0.1 second to let any buffered data be sent. |
- // Must have a timeout, as the stream will not close and cause a return. |
- // (This is OK despite already waiting for a response.) |
- client_->WaitForResponseForMs(static_cast<int64>(100)); |
- // There will be buffered data to write in the client's stream. |
+ client_->WaitForResponseForMs(100); |
ReliableQuicStream* stream = client_->client()->session()->GetStream(5); |
- EXPECT_TRUE(stream != nullptr && stream->HasBufferedData()); |
+ EXPECT_TRUE(stream == nullptr); |
} |
} |