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

Side by Side Diff: net/tools/quic/end_to_end_test.cc

Issue 2916033003: Landing Recent QUIC changes until 03:18 AM, May 28, UTC (Closed)
Patch Set: A few more EXPORTs. Created 3 years, 6 months 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/test_tools/simulator/quic_endpoint_test.cc ('k') | no next file » | 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 <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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 // server_writer_->set_fake_reorder_percentage(reorder); 548 // server_writer_->set_fake_reorder_percentage(reorder);
549 } 549 }
550 550
551 // Verifies that the client and server connections were both free of packets 551 // Verifies that the client and server connections were both free of packets
552 // being discarded, based on connection stats. 552 // being discarded, based on connection stats.
553 // Calls server_thread_ Pause() and Resume(), which may only be called once 553 // Calls server_thread_ Pause() and Resume(), which may only be called once
554 // per test. 554 // per test.
555 void VerifyCleanConnection(bool had_packet_loss) { 555 void VerifyCleanConnection(bool had_packet_loss) {
556 QuicConnectionStats client_stats = 556 QuicConnectionStats client_stats =
557 client_->client()->session()->connection()->GetStats(); 557 client_->client()->session()->connection()->GetStats();
558 if (!had_packet_loss) { 558 // TODO(ianswett): Determine why this becomes even more flaky with BBR
559 // enabled. b/62141144
560 if (!had_packet_loss && !FLAGS_quic_reloadable_flag_quic_default_to_bbr) {
559 EXPECT_EQ(0u, client_stats.packets_lost); 561 EXPECT_EQ(0u, client_stats.packets_lost);
560 } 562 }
561 EXPECT_EQ(0u, client_stats.packets_discarded); 563 EXPECT_EQ(0u, client_stats.packets_discarded);
562 // When doing 0-RTT with stateless rejects, the encrypted requests cause 564 // When doing 0-RTT with stateless rejects, the encrypted requests cause
563 // a retranmission of the SREJ packets which are dropped by the client. 565 // a retranmission of the SREJ packets which are dropped by the client.
564 if (!BothSidesSupportStatelessRejects()) { 566 if (!BothSidesSupportStatelessRejects()) {
565 EXPECT_EQ(0u, client_stats.packets_dropped); 567 EXPECT_EQ(0u, client_stats.packets_dropped);
566 } 568 }
567 EXPECT_EQ(client_stats.packets_received, client_stats.packets_processed); 569 EXPECT_EQ(client_stats.packets_received, client_stats.packets_processed);
568 570
(...skipping 1674 matching lines...) Expand 10 before | Expand all | Expand 10 after
2243 QuicServerPeer::GetDispatcher(server_thread_->server()); 2245 QuicServerPeer::GetDispatcher(server_thread_->server());
2244 EXPECT_EQ(QUIC_NO_ERROR, 2246 EXPECT_EQ(QUIC_NO_ERROR,
2245 QuicDispatcherPeer::GetAndClearLastError(dispatcher)); 2247 QuicDispatcherPeer::GetAndClearLastError(dispatcher));
2246 server_thread_->Resume(); 2248 server_thread_->Resume();
2247 2249
2248 // The connection should not be terminated. 2250 // The connection should not be terminated.
2249 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); 2251 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo"));
2250 EXPECT_EQ("200", client_->response_headers()->find(":status")->second); 2252 EXPECT_EQ("200", client_->response_headers()->find(":status")->second);
2251 } 2253 }
2252 2254
2255 TEST_P(EndToEndTest, CanceledStreamDoesNotBecomeZombie) {
2256 ASSERT_TRUE(Initialize());
2257 if (!FLAGS_quic_reloadable_flag_quic_use_stream_notifier) {
2258 return;
2259 }
2260
2261 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed());
2262 // Lose the request.
2263 SetPacketLossPercentage(100);
2264 client_->SendRequest("/small_response");
2265 // Cancel the stream, and let the RST_STREAM go through.
2266 SetPacketLossPercentage(0);
2267 QuicSpdyClientStream* stream = client_->GetOrCreateStream();
2268 // Reset stream.
2269 stream->Reset(QUIC_STREAM_CANCELLED);
2270 QuicSession* session = client_->client()->session();
2271 // Verify canceled stream does not become zombie.
2272 EXPECT_TRUE(QuicSessionPeer::zombie_streams(session).empty());
2273 EXPECT_EQ(1u, QuicSessionPeer::closed_streams(session).size());
2274 }
2275
2253 // A test stream that gives |response_body_| as an error response body. 2276 // A test stream that gives |response_body_| as an error response body.
2254 class ServerStreamWithErrorResponseBody : public QuicSimpleServerStream { 2277 class ServerStreamWithErrorResponseBody : public QuicSimpleServerStream {
2255 public: 2278 public:
2256 ServerStreamWithErrorResponseBody(QuicStreamId id, 2279 ServerStreamWithErrorResponseBody(QuicStreamId id,
2257 QuicSpdySession* session, 2280 QuicSpdySession* session,
2258 QuicHttpResponseCache* response_cache, 2281 QuicHttpResponseCache* response_cache,
2259 string response_body) 2282 string response_body)
2260 : QuicSimpleServerStream(id, session, response_cache), 2283 : QuicSimpleServerStream(id, session, response_cache),
2261 response_body_(std::move(response_body)) {} 2284 response_body_(std::move(response_body)) {}
2262 2285
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
3092 client_->WaitForResponse(); 3115 client_->WaitForResponse();
3093 EXPECT_EQ(kBarResponseBody, client_->response_body()); 3116 EXPECT_EQ(kBarResponseBody, client_->response_body());
3094 QuicConnectionStats client_stats = 3117 QuicConnectionStats client_stats =
3095 client_->client()->session()->connection()->GetStats(); 3118 client_->client()->session()->connection()->GetStats();
3096 EXPECT_EQ(0u, client_stats.packets_lost); 3119 EXPECT_EQ(0u, client_stats.packets_lost);
3097 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); 3120 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos());
3098 } 3121 }
3099 } // namespace 3122 } // namespace
3100 } // namespace test 3123 } // namespace test
3101 } // namespace net 3124 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/simulator/quic_endpoint_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698