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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 #include <string> 6 #include <string>
7 #include <sys/epoll.h> 7 #include <sys/epoll.h>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 // Force the client to write with a stream ID belonging to a nonexistent 1046 // Force the client to write with a stream ID belonging to a nonexistent
1047 // server-side stream. 1047 // server-side stream.
1048 QuicSessionPeer::SetNextOutgoingStreamId(client_->client()->session(), 2); 1048 QuicSessionPeer::SetNextOutgoingStreamId(client_->client()->session(), 2);
1049 1049
1050 client_->SendCustomSynchronousRequest(request); 1050 client_->SendCustomSynchronousRequest(request);
1051 // EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error()); 1051 // EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error());
1052 EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error()); 1052 EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error());
1053 EXPECT_EQ(QUIC_INVALID_STREAM_ID, client_->connection_error()); 1053 EXPECT_EQ(QUIC_INVALID_STREAM_ID, client_->connection_error());
1054 } 1054 }
1055 1055
1056 TEST_P(EndToEndTest, EarlyResponseWithQuicStreamNoError) {
1057 ASSERT_TRUE(Initialize());
1058 client_->client()->WaitForCryptoHandshakeConfirmed();
1059
1060 string large_body;
1061 GenerateBody(&large_body, 1024 * 1024);
1062
1063 HTTPMessage request(HttpConstants::HTTP_1_1, HttpConstants::POST, "/foo");
1064 request.AddBody(large_body, false);
1065
1066 // Insert an invalid content_length field in request to trigger an early
1067 // response from server.
1068 request.AddHeader("content-length", "-3");
1069
1070 request.set_skip_message_validation(true);
1071 client_->SendCustomSynchronousRequest(request);
1072 EXPECT_EQ("bad", client_->response_body());
1073 EXPECT_EQ(500u, client_->response_headers()->parsed_response_code());
1074 EXPECT_EQ(QUIC_STREAM_NO_ERROR, client_->stream_error());
1075 EXPECT_EQ(QUIC_NO_ERROR, client_->connection_error());
1076 }
1077
1056 // TODO(rch): this test seems to cause net_unittests timeouts :| 1078 // TODO(rch): this test seems to cause net_unittests timeouts :|
1057 TEST_P(EndToEndTest, DISABLED_MultipleTermination) { 1079 TEST_P(EndToEndTest, DISABLED_MultipleTermination) {
1058 ASSERT_TRUE(Initialize()); 1080 ASSERT_TRUE(Initialize());
1059 1081
1060 HTTPMessage request(HttpConstants::HTTP_1_1, HttpConstants::POST, "/foo"); 1082 HTTPMessage request(HttpConstants::HTTP_1_1, HttpConstants::POST, "/foo");
1061 request.AddHeader("content-length", "3"); 1083 request.AddHeader("content-length", "3");
1062 request.set_has_complete_message(false); 1084 request.set_has_complete_message(false);
1063 1085
1064 // Set the offset so we won't frame. Otherwise when we pick up termination 1086 // Set the offset so we won't frame. Otherwise when we pick up termination
1065 // before HTTP framing is complete, we send an error and close the stream, 1087 // before HTTP framing is complete, we send an error and close the stream,
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
2059 request.set_skip_message_validation(true); 2081 request.set_skip_message_validation(true);
2060 request.set_has_complete_message(false); 2082 request.set_has_complete_message(false);
2061 2083
2062 // Tell the client to not close the stream if it receives an early response. 2084 // Tell the client to not close the stream if it receives an early response.
2063 client_->set_allow_bidirectional_data(true); 2085 client_->set_allow_bidirectional_data(true);
2064 // Send the headers. 2086 // Send the headers.
2065 client_->SendMessage(request); 2087 client_->SendMessage(request);
2066 // Receive the response and let the server close writing. 2088 // Receive the response and let the server close writing.
2067 client_->WaitForInitialResponse(); 2089 client_->WaitForInitialResponse();
2068 EXPECT_EQ(500u, client_->response_headers()->parsed_response_code()); 2090 EXPECT_EQ(500u, client_->response_headers()->parsed_response_code());
2069 // Send a body larger than the stream flow control window.
2070 string body;
2071 GenerateBody(&body, kBodySize);
2072 client_->SendData(body, true);
2073 2091
2074 if (FLAGS_quic_implement_stop_reading) { 2092 if (negotiated_version_ <= QUIC_VERSION_28) {
2075 // Run the client to let any buffered data be sent. 2093 // Send a body larger than the stream flow control window.
2076 // (This is OK despite already waiting for a response.) 2094 string body;
2077 client_->WaitForResponse(); 2095 GenerateBody(&body, kBodySize);
2078 // There should be no buffered data to write in the client's stream. 2096 client_->SendData(body, true);
2097
2098 if (FLAGS_quic_implement_stop_reading) {
2099 // Run the client to let any buffered data be sent.
2100 // (This is OK despite already waiting for a response.)
2101 client_->WaitForResponse();
2102 // There should be no buffered data to write in the client's stream.
2103 ReliableQuicStream* stream = client_->client()->session()->GetStream(5);
2104 EXPECT_FALSE(stream != nullptr && stream->HasBufferedData());
2105 } else {
2106 // Run the client for 0.1 second to let any buffered data be sent.
2107 // Must have a timeout, as the stream will not close and cause a return.
2108 // (This is OK despite already waiting for a response.)
2109 client_->WaitForResponseForMs(100);
2110 // There will be buffered data to write in the client's stream.
2111 ReliableQuicStream* stream = client_->client()->session()->GetStream(5);
2112 EXPECT_TRUE(stream != nullptr && stream->HasBufferedData());
2113 }
2114 } else {
2115 client_->WaitForResponseForMs(100);
2079 ReliableQuicStream* stream = client_->client()->session()->GetStream(5); 2116 ReliableQuicStream* stream = client_->client()->session()->GetStream(5);
2080 EXPECT_FALSE(stream != nullptr && stream->HasBufferedData()); 2117 EXPECT_TRUE(stream == nullptr);
2081 } else {
2082 // Run the client for 0.1 second to let any buffered data be sent.
2083 // Must have a timeout, as the stream will not close and cause a return.
2084 // (This is OK despite already waiting for a response.)
2085 client_->WaitForResponseForMs(static_cast<int64>(100));
2086 // There will be buffered data to write in the client's stream.
2087 ReliableQuicStream* stream = client_->client()->session()->GetStream(5);
2088 EXPECT_TRUE(stream != nullptr && stream->HasBufferedData());
2089 } 2118 }
2090 } 2119 }
2091 2120
2092 } // namespace 2121 } // namespace
2093 } // namespace test 2122 } // namespace test
2094 } // namespace tools 2123 } // namespace tools
2095 } // namespace net 2124 } // namespace net
OLDNEW
« 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