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

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

Issue 1983183002: Landing Recent QUIC changes until 5/14/2016 02:25:25 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: "first try to fix link error for win_clang build" Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/tools/quic/crypto_message_printer_bin.cc ('k') | net/tools/quic/quic_client_session_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 f8d95ae8aabc41854be62cbaf2f86b425bf91ba5..80c130797653d677d86c4a362db29db21a3a84cb 100644
--- a/net/tools/quic/end_to_end_test.cc
+++ b/net/tools/quic/end_to_end_test.cc
@@ -1771,6 +1771,36 @@ TEST_P(EndToEndTest, AckNotifierWithPacketLossAndBlockedSocket) {
server_thread_->Resume();
}
+// Send a public reset from the server.
+TEST_P(EndToEndTest, ServerSendPublicReset) {
+ ASSERT_TRUE(Initialize());
+
+ // Send the public reset.
+ QuicConnectionId connection_id =
+ client_->client()->session()->connection()->connection_id();
+ QuicPublicResetPacket header;
+ header.public_header.connection_id = connection_id;
+ header.public_header.reset_flag = true;
+ header.public_header.version_flag = false;
+ header.rejected_packet_number = 10101;
+ QuicFramer framer(server_supported_versions_, QuicTime::Zero(),
+ Perspective::IS_SERVER);
+ std::unique_ptr<QuicEncryptedPacket> packet(
+ framer.BuildPublicResetPacket(header));
+ // We must pause the server's thread in order to call WritePacket without
+ // race conditions.
+ server_thread_->Pause();
+ server_writer_->WritePacket(
+ packet->data(), packet->length(), server_address_.address(),
+ client_->client()->GetLatestClientAddress(), nullptr);
+ server_thread_->Resume();
+
+ // The request should fail.
+ EXPECT_EQ("", client_->SendSynchronousRequest("/foo"));
+ EXPECT_EQ(0u, client_->response_headers()->parsed_response_code());
+ EXPECT_EQ(QUIC_PUBLIC_RESET, client_->connection_error());
+}
+
// Send a public reset from the server for a different connection ID.
// It should be ignored.
TEST_P(EndToEndTest, ServerSendPublicResetWithDifferentConnectionId) {
« no previous file with comments | « net/tools/quic/crypto_message_printer_bin.cc ('k') | net/tools/quic/quic_client_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698