| 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 <string> | 6 #include <string> |
| 7 #include <sys/epoll.h> | 7 #include <sys/epoll.h> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
| 13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/synchronization/waitable_event.h" | 14 #include "base/synchronization/waitable_event.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "net/base/ip_endpoint.h" | 16 #include "net/base/ip_endpoint.h" |
| 17 #include "net/quic/congestion_control/tcp_cubic_sender.h" | 17 #include "net/quic/congestion_control/tcp_cubic_sender.h" |
| 18 #include "net/quic/crypto/aes_128_gcm_12_encrypter.h" | 18 #include "net/quic/crypto/aes_128_gcm_12_encrypter.h" |
| 19 #include "net/quic/crypto/null_encrypter.h" | 19 #include "net/quic/crypto/null_encrypter.h" |
| 20 #include "net/quic/quic_flags.h" | 20 #include "net/quic/quic_flags.h" |
| 21 #include "net/quic/quic_framer.h" | 21 #include "net/quic/quic_framer.h" |
| 22 #include "net/quic/quic_packet_creator.h" | 22 #include "net/quic/quic_packet_creator.h" |
| 23 #include "net/quic/quic_protocol.h" | 23 #include "net/quic/quic_protocol.h" |
| 24 #include "net/quic/quic_sent_packet_manager.h" | 24 #include "net/quic/quic_sent_packet_manager.h" |
| 25 #include "net/quic/quic_server_id.h" | 25 #include "net/quic/quic_server_id.h" |
| 26 #include "net/quic/test_tools/quic_connection_peer.h" | 26 #include "net/quic/test_tools/quic_connection_peer.h" |
| 27 #include "net/quic/test_tools/quic_packet_creator_peer.h" | 27 #include "net/quic/test_tools/quic_packet_generator_peer.h" |
| 28 #include "net/quic/test_tools/quic_session_peer.h" | 28 #include "net/quic/test_tools/quic_session_peer.h" |
| 29 #include "net/quic/test_tools/quic_test_utils.h" | 29 #include "net/quic/test_tools/quic_test_utils.h" |
| 30 #include "net/quic/test_tools/reliable_quic_stream_peer.h" | 30 #include "net/quic/test_tools/reliable_quic_stream_peer.h" |
| 31 #include "net/test/gtest_util.h" | 31 #include "net/test/gtest_util.h" |
| 32 #include "net/tools/epoll_server/epoll_server.h" | 32 #include "net/tools/epoll_server/epoll_server.h" |
| 33 #include "net/tools/quic/quic_epoll_connection_helper.h" | 33 #include "net/tools/quic/quic_epoll_connection_helper.h" |
| 34 #include "net/tools/quic/quic_in_memory_cache.h" | 34 #include "net/tools/quic/quic_in_memory_cache.h" |
| 35 #include "net/tools/quic/quic_packet_writer_wrapper.h" | 35 #include "net/tools/quic/quic_packet_writer_wrapper.h" |
| 36 #include "net/tools/quic/quic_server.h" | 36 #include "net/tools/quic/quic_server.h" |
| 37 #include "net/tools/quic/quic_socket_utils.h" | 37 #include "net/tools/quic/quic_socket_utils.h" |
| 38 #include "net/tools/quic/quic_spdy_client_stream.h" | 38 #include "net/tools/quic/quic_spdy_client_stream.h" |
| 39 #include "net/tools/quic/test_tools/http_message.h" | 39 #include "net/tools/quic/test_tools/http_message.h" |
| 40 #include "net/tools/quic/test_tools/packet_dropping_test_writer.h" | 40 #include "net/tools/quic/test_tools/packet_dropping_test_writer.h" |
| 41 #include "net/tools/quic/test_tools/quic_client_peer.h" | 41 #include "net/tools/quic/test_tools/quic_client_peer.h" |
| 42 #include "net/tools/quic/test_tools/quic_dispatcher_peer.h" | 42 #include "net/tools/quic/test_tools/quic_dispatcher_peer.h" |
| 43 #include "net/tools/quic/test_tools/quic_in_memory_cache_peer.h" | 43 #include "net/tools/quic/test_tools/quic_in_memory_cache_peer.h" |
| 44 #include "net/tools/quic/test_tools/quic_server_peer.h" | 44 #include "net/tools/quic/test_tools/quic_server_peer.h" |
| 45 #include "net/tools/quic/test_tools/quic_test_client.h" | 45 #include "net/tools/quic/test_tools/quic_test_client.h" |
| 46 #include "net/tools/quic/test_tools/server_thread.h" | 46 #include "net/tools/quic/test_tools/server_thread.h" |
| 47 #include "testing/gtest/include/gtest/gtest.h" | 47 #include "testing/gtest/include/gtest/gtest.h" |
| 48 | 48 |
| 49 using base::StringPiece; | 49 using base::StringPiece; |
| 50 using base::WaitableEvent; | 50 using base::WaitableEvent; |
| 51 using net::EpollServer; | 51 using net::EpollServer; |
| 52 using net::test::GenerateBody; | 52 using net::test::GenerateBody; |
| 53 using net::test::QuicConnectionPeer; | 53 using net::test::QuicConnectionPeer; |
| 54 using net::test::QuicPacketCreatorPeer; | 54 using net::test::QuicPacketGeneratorPeer; |
| 55 using net::test::QuicSessionPeer; | 55 using net::test::QuicSessionPeer; |
| 56 using net::test::ReliableQuicStreamPeer; | 56 using net::test::ReliableQuicStreamPeer; |
| 57 using net::test::kClientDataStreamId1; | 57 using net::test::kClientDataStreamId1; |
| 58 using net::tools::test::PacketDroppingTestWriter; | 58 using net::tools::test::PacketDroppingTestWriter; |
| 59 using net::tools::test::QuicDispatcherPeer; | 59 using net::tools::test::QuicDispatcherPeer; |
| 60 using net::tools::test::QuicServerPeer; | 60 using net::tools::test::QuicServerPeer; |
| 61 using std::ostream; | 61 using std::ostream; |
| 62 using std::string; | 62 using std::string; |
| 63 using std::vector; | 63 using std::vector; |
| 64 | 64 |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 TEST_P(EndToEndTest, LargePostFEC) { | 641 TEST_P(EndToEndTest, LargePostFEC) { |
| 642 // Connect without packet loss to avoid issues with losing handshake packets, | 642 // Connect without packet loss to avoid issues with losing handshake packets, |
| 643 // and then up the packet loss rate (b/10126687). | 643 // and then up the packet loss rate (b/10126687). |
| 644 ASSERT_TRUE(Initialize()); | 644 ASSERT_TRUE(Initialize()); |
| 645 | 645 |
| 646 // Wait for the server SHLO before upping the packet loss. | 646 // Wait for the server SHLO before upping the packet loss. |
| 647 client_->client()->WaitForCryptoHandshakeConfirmed(); | 647 client_->client()->WaitForCryptoHandshakeConfirmed(); |
| 648 SetPacketLossPercentage(30); | 648 SetPacketLossPercentage(30); |
| 649 | 649 |
| 650 // Turn on FEC protection. | 650 // Turn on FEC protection. |
| 651 QuicPacketCreator* creator = QuicConnectionPeer::GetPacketCreator( | 651 QuicPacketGeneratorPeer::SwitchFecProtectionOn( |
| 652 client_->client()->session()->connection()); | 652 QuicConnectionPeer::GetPacketGenerator( |
| 653 EXPECT_TRUE(QuicPacketCreatorPeer::SwitchFecProtectionOn(creator, 6)); | 653 client_->client()->session()->connection()), 6); |
| 654 | 654 |
| 655 string body; | 655 string body; |
| 656 GenerateBody(&body, 10240); | 656 GenerateBody(&body, 10240); |
| 657 | 657 |
| 658 HTTPMessage request(HttpConstants::HTTP_1_1, | 658 HTTPMessage request(HttpConstants::HTTP_1_1, |
| 659 HttpConstants::POST, "/foo"); | 659 HttpConstants::POST, "/foo"); |
| 660 request.AddBody(body, true); | 660 request.AddBody(body, true); |
| 661 | 661 |
| 662 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); | 662 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); |
| 663 VerifyCleanConnection(true); | 663 VerifyCleanConnection(true); |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 QuicSession* session = dispatcher->session_map().begin()->second; | 1067 QuicSession* session = dispatcher->session_map().begin()->second; |
| 1068 EXPECT_EQ(kClientIFCW, | 1068 EXPECT_EQ(kClientIFCW, |
| 1069 session->config()->ReceivedInitialFlowControlWindowBytes()); | 1069 session->config()->ReceivedInitialFlowControlWindowBytes()); |
| 1070 server_thread_->Resume(); | 1070 server_thread_->Resume(); |
| 1071 } | 1071 } |
| 1072 | 1072 |
| 1073 } // namespace | 1073 } // namespace |
| 1074 } // namespace test | 1074 } // namespace test |
| 1075 } // namespace tools | 1075 } // namespace tools |
| 1076 } // namespace net | 1076 } // namespace net |
| OLD | NEW |