| OLD | NEW |
| 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 <sys/epoll.h> | 6 #include <sys/epoll.h> |
| 7 | 7 |
| 8 #include <cstdint> | 8 #include <cstdint> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 2232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2243 QuicServerPeer::GetDispatcher(server_thread_->server()); | 2243 QuicServerPeer::GetDispatcher(server_thread_->server()); |
| 2244 EXPECT_EQ(QUIC_NO_ERROR, | 2244 EXPECT_EQ(QUIC_NO_ERROR, |
| 2245 QuicDispatcherPeer::GetAndClearLastError(dispatcher)); | 2245 QuicDispatcherPeer::GetAndClearLastError(dispatcher)); |
| 2246 server_thread_->Resume(); | 2246 server_thread_->Resume(); |
| 2247 | 2247 |
| 2248 // The connection should not be terminated. | 2248 // The connection should not be terminated. |
| 2249 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); | 2249 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); |
| 2250 EXPECT_EQ("200", client_->response_headers()->find(":status")->second); | 2250 EXPECT_EQ("200", client_->response_headers()->find(":status")->second); |
| 2251 } | 2251 } |
| 2252 | 2252 |
| 2253 TEST_P(EndToEndTest, CanceledStreamDoesNotBecomeZombie) { |
| 2254 ASSERT_TRUE(Initialize()); |
| 2255 if (!FLAGS_quic_reloadable_flag_quic_use_stream_notifier) { |
| 2256 return; |
| 2257 } |
| 2258 |
| 2259 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); |
| 2260 // Lose the request. |
| 2261 SetPacketLossPercentage(100); |
| 2262 client_->SendRequest("/small_response"); |
| 2263 // Cancel the stream, and let the RST_STREAM go through. |
| 2264 SetPacketLossPercentage(0); |
| 2265 QuicSpdyClientStream* stream = client_->GetOrCreateStream(); |
| 2266 // Reset stream. |
| 2267 stream->Reset(QUIC_STREAM_CANCELLED); |
| 2268 QuicSession* session = client_->client()->session(); |
| 2269 // Verify canceled stream does not become zombie. |
| 2270 EXPECT_TRUE(QuicSessionPeer::zombie_streams(session).empty()); |
| 2271 EXPECT_EQ(1u, QuicSessionPeer::closed_streams(session).size()); |
| 2272 } |
| 2273 |
| 2253 // A test stream that gives |response_body_| as an error response body. | 2274 // A test stream that gives |response_body_| as an error response body. |
| 2254 class ServerStreamWithErrorResponseBody : public QuicSimpleServerStream { | 2275 class ServerStreamWithErrorResponseBody : public QuicSimpleServerStream { |
| 2255 public: | 2276 public: |
| 2256 ServerStreamWithErrorResponseBody(QuicStreamId id, | 2277 ServerStreamWithErrorResponseBody(QuicStreamId id, |
| 2257 QuicSpdySession* session, | 2278 QuicSpdySession* session, |
| 2258 QuicHttpResponseCache* response_cache, | 2279 QuicHttpResponseCache* response_cache, |
| 2259 string response_body) | 2280 string response_body) |
| 2260 : QuicSimpleServerStream(id, session, response_cache), | 2281 : QuicSimpleServerStream(id, session, response_cache), |
| 2261 response_body_(std::move(response_body)) {} | 2282 response_body_(std::move(response_body)) {} |
| 2262 | 2283 |
| (...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3092 client_->WaitForResponse(); | 3113 client_->WaitForResponse(); |
| 3093 EXPECT_EQ(kBarResponseBody, client_->response_body()); | 3114 EXPECT_EQ(kBarResponseBody, client_->response_body()); |
| 3094 QuicConnectionStats client_stats = | 3115 QuicConnectionStats client_stats = |
| 3095 client_->client()->session()->connection()->GetStats(); | 3116 client_->client()->session()->connection()->GetStats(); |
| 3096 EXPECT_EQ(0u, client_stats.packets_lost); | 3117 EXPECT_EQ(0u, client_stats.packets_lost); |
| 3097 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); | 3118 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); |
| 3098 } | 3119 } |
| 3099 } // namespace | 3120 } // namespace |
| 3100 } // namespace test | 3121 } // namespace test |
| 3101 } // namespace net | 3122 } // namespace net |
| OLD | NEW |