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

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

Issue 2747443002: Landing recent QUIC changes until Sun Mar 5 09:18:09 2017 +0000 (Closed)
Patch Set: Fixed formatting errors in quic_error_mapping.cc Created 3 years, 9 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/tools/quic/chlo_extractor.cc ('k') | net/tools/quic/quic_client_session_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 <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 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 QuicDispatcher* dispatcher = 1315 QuicDispatcher* dispatcher =
1316 QuicServerPeer::GetDispatcher(server_thread_->server()); 1316 QuicServerPeer::GetDispatcher(server_thread_->server());
1317 QuicSession* server_session = dispatcher->session_map().begin()->second.get(); 1317 QuicSession* server_session = dispatcher->session_map().begin()->second.get();
1318 EXPECT_EQ(kClientMaxIncomingDynamicStreams, 1318 EXPECT_EQ(kClientMaxIncomingDynamicStreams,
1319 server_session->max_open_outgoing_streams()); 1319 server_session->max_open_outgoing_streams());
1320 server_thread_->Resume(); 1320 server_thread_->Resume();
1321 } 1321 }
1322 1322
1323 TEST_P(EndToEndTest, NegotiateCongestionControl) { 1323 TEST_P(EndToEndTest, NegotiateCongestionControl) {
1324 FLAGS_quic_reloadable_flag_quic_allow_new_bbr = true; 1324 FLAGS_quic_reloadable_flag_quic_allow_new_bbr = true;
1325 // Disable this flag because if connection uses multipath sent packet manager,
1326 // static_cast here does not work.
1327 FLAGS_quic_reloadable_flag_quic_enable_multipath = false;
1328 ASSERT_TRUE(Initialize()); 1325 ASSERT_TRUE(Initialize());
1329 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); 1326 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed());
1330 1327
1331 CongestionControlType expected_congestion_control_type = kReno; 1328 CongestionControlType expected_congestion_control_type = kReno;
1332 switch (GetParam().congestion_control_tag) { 1329 switch (GetParam().congestion_control_tag) {
1333 case kRENO: 1330 case kRENO:
1334 expected_congestion_control_type = kReno; 1331 expected_congestion_control_type = kReno;
1335 break; 1332 break;
1336 case kTBBR: 1333 case kTBBR:
1337 expected_congestion_control_type = kBBR; 1334 expected_congestion_control_type = kBBR;
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after
2198 // tear down the connection. 2195 // tear down the connection.
2199 TEST_P(EndToEndTest, BadEncryptedData) { 2196 TEST_P(EndToEndTest, BadEncryptedData) {
2200 ASSERT_TRUE(Initialize()); 2197 ASSERT_TRUE(Initialize());
2201 2198
2202 // Start the connection. 2199 // Start the connection.
2203 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); 2200 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo"));
2204 EXPECT_EQ("200", client_->response_headers()->find(":status")->second); 2201 EXPECT_EQ("200", client_->response_headers()->find(":status")->second);
2205 2202
2206 std::unique_ptr<QuicEncryptedPacket> packet(ConstructEncryptedPacket( 2203 std::unique_ptr<QuicEncryptedPacket> packet(ConstructEncryptedPacket(
2207 client_->client()->session()->connection()->connection_id(), false, false, 2204 client_->client()->session()->connection()->connection_id(), false, false,
2208 false, 1, "At least 20 characters.", PACKET_8BYTE_CONNECTION_ID, 2205 1, "At least 20 characters.", PACKET_8BYTE_CONNECTION_ID,
2209 PACKET_6BYTE_PACKET_NUMBER)); 2206 PACKET_6BYTE_PACKET_NUMBER));
2210 // Damage the encrypted data. 2207 // Damage the encrypted data.
2211 string damaged_packet(packet->data(), packet->length()); 2208 string damaged_packet(packet->data(), packet->length());
2212 damaged_packet[30] ^= 0x01; 2209 damaged_packet[30] ^= 0x01;
2213 QUIC_DLOG(INFO) << "Sending bad packet."; 2210 QUIC_DLOG(INFO) << "Sending bad packet.";
2214 client_writer_->WritePacket( 2211 client_writer_->WritePacket(
2215 damaged_packet.data(), damaged_packet.length(), 2212 damaged_packet.data(), damaged_packet.length(),
2216 client_->client()->GetLatestClientAddress().host(), server_address_, 2213 client_->client()->GetLatestClientAddress().host(), server_address_,
2217 nullptr); 2214 nullptr);
2218 // Give the server time to process the packet. 2215 // Give the server time to process the packet.
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
3002 // Tests that when client side has no active request and no waiting 2999 // Tests that when client side has no active request and no waiting
3003 // PUSH_PROMISE, its headers stream's sequencer buffer should be released. 3000 // PUSH_PROMISE, its headers stream's sequencer buffer should be released.
3004 ASSERT_TRUE(Initialize()); 3001 ASSERT_TRUE(Initialize());
3005 client_->SendSynchronousRequest("/foo"); 3002 client_->SendSynchronousRequest("/foo");
3006 QuicHeadersStream* headers_stream = 3003 QuicHeadersStream* headers_stream =
3007 QuicSpdySessionPeer::GetHeadersStream(client_->client()->session()); 3004 QuicSpdySessionPeer::GetHeadersStream(client_->client()->session());
3008 QuicStreamSequencer* sequencer = QuicStreamPeer::sequencer(headers_stream); 3005 QuicStreamSequencer* sequencer = QuicStreamPeer::sequencer(headers_stream);
3009 EXPECT_FALSE(QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer)); 3006 EXPECT_FALSE(QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer));
3010 } 3007 }
3011 3008
3009 TEST_P(EndToEndTest, WayTooLongRequestHeaders) {
3010 ASSERT_TRUE(Initialize());
3011 SpdyHeaderBlock headers;
3012 headers[":method"] = "GET";
3013 headers[":path"] = "/foo";
3014 headers[":scheme"] = "https";
3015 headers[":authority"] = server_hostname_;
3016 headers["key"] = string(64 * 1024, 'a');
3017
3018 client_->SendMessage(headers, "");
3019 client_->WaitForResponse();
3020 EXPECT_EQ(QUIC_HEADERS_STREAM_DATA_DECOMPRESS_FAILURE,
3021 client_->connection_error());
3022 }
3023
3012 class EndToEndBufferedPacketsTest : public EndToEndTest { 3024 class EndToEndBufferedPacketsTest : public EndToEndTest {
3013 public: 3025 public:
3014 void CreateClientWithWriter() override { 3026 void CreateClientWithWriter() override {
3015 QUIC_LOG(ERROR) << "create client with reorder_writer_ "; 3027 QUIC_LOG(ERROR) << "create client with reorder_writer_ ";
3016 reorder_writer_ = new PacketReorderingWriter(); 3028 reorder_writer_ = new PacketReorderingWriter();
3017 client_.reset(EndToEndTest::CreateQuicClient(reorder_writer_)); 3029 client_.reset(EndToEndTest::CreateQuicClient(reorder_writer_));
3018 } 3030 }
3019 3031
3020 void SetUp() override { 3032 void SetUp() override {
3021 // Don't initialize client writer in base class. 3033 // Don't initialize client writer in base class.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
3056 client_->WaitForResponse(); 3068 client_->WaitForResponse();
3057 EXPECT_EQ(kBarResponseBody, client_->response_body()); 3069 EXPECT_EQ(kBarResponseBody, client_->response_body());
3058 QuicConnectionStats client_stats = 3070 QuicConnectionStats client_stats =
3059 client_->client()->session()->connection()->GetStats(); 3071 client_->client()->session()->connection()->GetStats();
3060 EXPECT_EQ(0u, client_stats.packets_lost); 3072 EXPECT_EQ(0u, client_stats.packets_lost);
3061 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); 3073 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos());
3062 } 3074 }
3063 } // namespace 3075 } // namespace
3064 } // namespace test 3076 } // namespace test
3065 } // namespace net 3077 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/chlo_extractor.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