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_session_peer.h" | 28 #include "net/quic/test_tools/quic_session_peer.h" |
28 #include "net/quic/test_tools/quic_test_utils.h" | 29 #include "net/quic/test_tools/quic_test_utils.h" |
29 #include "net/quic/test_tools/reliable_quic_stream_peer.h" | 30 #include "net/quic/test_tools/reliable_quic_stream_peer.h" |
30 #include "net/test/gtest_util.h" | 31 #include "net/test/gtest_util.h" |
31 #include "net/tools/epoll_server/epoll_server.h" | 32 #include "net/tools/epoll_server/epoll_server.h" |
32 #include "net/tools/quic/quic_epoll_connection_helper.h" | 33 #include "net/tools/quic/quic_epoll_connection_helper.h" |
33 #include "net/tools/quic/quic_in_memory_cache.h" | 34 #include "net/tools/quic/quic_in_memory_cache.h" |
34 #include "net/tools/quic/quic_packet_writer_wrapper.h" | 35 #include "net/tools/quic/quic_packet_writer_wrapper.h" |
35 #include "net/tools/quic/quic_server.h" | 36 #include "net/tools/quic/quic_server.h" |
36 #include "net/tools/quic/quic_socket_utils.h" | 37 #include "net/tools/quic/quic_socket_utils.h" |
37 #include "net/tools/quic/quic_spdy_client_stream.h" | 38 #include "net/tools/quic/quic_spdy_client_stream.h" |
38 #include "net/tools/quic/test_tools/http_message.h" | 39 #include "net/tools/quic/test_tools/http_message.h" |
39 #include "net/tools/quic/test_tools/packet_dropping_test_writer.h" | 40 #include "net/tools/quic/test_tools/packet_dropping_test_writer.h" |
40 #include "net/tools/quic/test_tools/quic_client_peer.h" | 41 #include "net/tools/quic/test_tools/quic_client_peer.h" |
41 #include "net/tools/quic/test_tools/quic_dispatcher_peer.h" | 42 #include "net/tools/quic/test_tools/quic_dispatcher_peer.h" |
42 #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" |
43 #include "net/tools/quic/test_tools/quic_server_peer.h" | 44 #include "net/tools/quic/test_tools/quic_server_peer.h" |
44 #include "net/tools/quic/test_tools/quic_test_client.h" | 45 #include "net/tools/quic/test_tools/quic_test_client.h" |
45 #include "net/tools/quic/test_tools/server_thread.h" | 46 #include "net/tools/quic/test_tools/server_thread.h" |
46 #include "testing/gtest/include/gtest/gtest.h" | 47 #include "testing/gtest/include/gtest/gtest.h" |
47 | 48 |
48 using base::StringPiece; | 49 using base::StringPiece; |
49 using base::WaitableEvent; | 50 using base::WaitableEvent; |
50 using net::EpollServer; | 51 using net::EpollServer; |
51 using net::test::GenerateBody; | 52 using net::test::GenerateBody; |
52 using net::test::QuicConnectionPeer; | 53 using net::test::QuicConnectionPeer; |
| 54 using net::test::QuicPacketCreatorPeer; |
53 using net::test::QuicSessionPeer; | 55 using net::test::QuicSessionPeer; |
54 using net::test::ReliableQuicStreamPeer; | 56 using net::test::ReliableQuicStreamPeer; |
55 using net::tools::test::PacketDroppingTestWriter; | 57 using net::tools::test::PacketDroppingTestWriter; |
56 using net::tools::test::QuicDispatcherPeer; | 58 using net::tools::test::QuicDispatcherPeer; |
57 using net::tools::test::QuicServerPeer; | 59 using net::tools::test::QuicServerPeer; |
58 using std::ostream; | 60 using std::ostream; |
59 using std::string; | 61 using std::string; |
60 using std::vector; | 62 using std::vector; |
61 | 63 |
62 namespace net { | 64 namespace net { |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 | 639 |
638 TEST_P(EndToEndTest, LargePostFEC) { | 640 TEST_P(EndToEndTest, LargePostFEC) { |
639 // Connect without packet loss to avoid issues with losing handshake packets, | 641 // Connect without packet loss to avoid issues with losing handshake packets, |
640 // and then up the packet loss rate (b/10126687). | 642 // and then up the packet loss rate (b/10126687). |
641 ASSERT_TRUE(Initialize()); | 643 ASSERT_TRUE(Initialize()); |
642 | 644 |
643 // Wait for the server SHLO before upping the packet loss. | 645 // Wait for the server SHLO before upping the packet loss. |
644 client_->client()->WaitForCryptoHandshakeConfirmed(); | 646 client_->client()->WaitForCryptoHandshakeConfirmed(); |
645 SetPacketLossPercentage(30); | 647 SetPacketLossPercentage(30); |
646 | 648 |
647 client_->options()->max_packets_per_fec_group = 6; | 649 // Turn on FEC protection. |
| 650 QuicPacketCreator* creator = QuicConnectionPeer::GetPacketCreator( |
| 651 client_->client()->session()->connection()); |
| 652 EXPECT_TRUE(QuicPacketCreatorPeer::SwitchFecProtectionOn(creator, 6)); |
648 | 653 |
649 string body; | 654 string body; |
650 GenerateBody(&body, 10240); | 655 GenerateBody(&body, 10240); |
651 | 656 |
652 HTTPMessage request(HttpConstants::HTTP_1_1, | 657 HTTPMessage request(HttpConstants::HTTP_1_1, |
653 HttpConstants::POST, "/foo"); | 658 HttpConstants::POST, "/foo"); |
654 request.AddBody(body, true); | 659 request.AddBody(body, true); |
655 | 660 |
656 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); | 661 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); |
657 VerifyCleanConnection(true); | 662 VerifyCleanConnection(true); |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 QuicSession* session = dispatcher->session_map().begin()->second; | 1064 QuicSession* session = dispatcher->session_map().begin()->second; |
1060 EXPECT_EQ(kClientIFCW, | 1065 EXPECT_EQ(kClientIFCW, |
1061 session->config()->ReceivedInitialFlowControlWindowBytes()); | 1066 session->config()->ReceivedInitialFlowControlWindowBytes()); |
1062 server_thread_->Resume(); | 1067 server_thread_->Resume(); |
1063 } | 1068 } |
1064 | 1069 |
1065 } // namespace | 1070 } // namespace |
1066 } // namespace test | 1071 } // namespace test |
1067 } // namespace tools | 1072 } // namespace tools |
1068 } // namespace net | 1073 } // namespace net |
OLD | NEW |