| 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 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3056 client_->WaitForResponse(); | 3053 client_->WaitForResponse(); |
| 3057 EXPECT_EQ(kBarResponseBody, client_->response_body()); | 3054 EXPECT_EQ(kBarResponseBody, client_->response_body()); |
| 3058 QuicConnectionStats client_stats = | 3055 QuicConnectionStats client_stats = |
| 3059 client_->client()->session()->connection()->GetStats(); | 3056 client_->client()->session()->connection()->GetStats(); |
| 3060 EXPECT_EQ(0u, client_stats.packets_lost); | 3057 EXPECT_EQ(0u, client_stats.packets_lost); |
| 3061 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); | 3058 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); |
| 3062 } | 3059 } |
| 3063 } // namespace | 3060 } // namespace |
| 3064 } // namespace test | 3061 } // namespace test |
| 3065 } // namespace net | 3062 } // namespace net |
| OLD | NEW |