Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2673)

Unified Diff: net/tools/quic/end_to_end_test.cc

Issue 1413373013: Quic streams honor RST_STREAM + NO_ERROR on the write side. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@106851267
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/reliable_quic_stream.cc ('k') | net/tools/quic/quic_spdy_server_stream_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
}
« no previous file with comments | « net/quic/reliable_quic_stream.cc ('k') | net/tools/quic/quic_spdy_server_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698