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

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

Issue 2387753002: Release read buffer of QuicCryptoStream when incoming message become less frequent. Protected by --… (Closed)
Patch Set: enable quic crypto stream release buffer Created 4 years, 2 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/quic/test_tools/reliable_quic_stream_peer.cc ('k') | no next file » | 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 <list> 8 #include <list>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 17 matching lines...) Expand all
28 #include "net/quic/core/quic_server_id.h" 28 #include "net/quic/core/quic_server_id.h"
29 #include "net/quic/core/quic_session.h" 29 #include "net/quic/core/quic_session.h"
30 #include "net/quic/core/quic_utils.h" 30 #include "net/quic/core/quic_utils.h"
31 #include "net/quic/test_tools/crypto_test_utils.h" 31 #include "net/quic/test_tools/crypto_test_utils.h"
32 #include "net/quic/test_tools/quic_config_peer.h" 32 #include "net/quic/test_tools/quic_config_peer.h"
33 #include "net/quic/test_tools/quic_connection_peer.h" 33 #include "net/quic/test_tools/quic_connection_peer.h"
34 #include "net/quic/test_tools/quic_flow_controller_peer.h" 34 #include "net/quic/test_tools/quic_flow_controller_peer.h"
35 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" 35 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h"
36 #include "net/quic/test_tools/quic_session_peer.h" 36 #include "net/quic/test_tools/quic_session_peer.h"
37 #include "net/quic/test_tools/quic_spdy_session_peer.h" 37 #include "net/quic/test_tools/quic_spdy_session_peer.h"
38 #include "net/quic/test_tools/quic_stream_sequencer_peer.h"
38 #include "net/quic/test_tools/quic_test_utils.h" 39 #include "net/quic/test_tools/quic_test_utils.h"
39 #include "net/quic/test_tools/reliable_quic_stream_peer.h" 40 #include "net/quic/test_tools/reliable_quic_stream_peer.h"
40 #include "net/test/gtest_util.h" 41 #include "net/test/gtest_util.h"
41 #include "net/tools/epoll_server/epoll_server.h" 42 #include "net/tools/epoll_server/epoll_server.h"
42 #include "net/tools/quic/quic_epoll_connection_helper.h" 43 #include "net/tools/quic/quic_epoll_connection_helper.h"
43 #include "net/tools/quic/quic_in_memory_cache.h" 44 #include "net/tools/quic/quic_in_memory_cache.h"
44 #include "net/tools/quic/quic_packet_writer_wrapper.h" 45 #include "net/tools/quic/quic_packet_writer_wrapper.h"
45 #include "net/tools/quic/quic_server.h" 46 #include "net/tools/quic/quic_server.h"
46 #include "net/tools/quic/quic_simple_server_stream.h" 47 #include "net/tools/quic/quic_simple_server_stream.h"
47 #include "net/tools/quic/quic_socket_utils.h" 48 #include "net/tools/quic/quic_socket_utils.h"
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 QuicTestServer::StreamFactory* stream_factory_; 653 QuicTestServer::StreamFactory* stream_factory_;
653 bool support_server_push_; 654 bool support_server_push_;
654 bool force_hol_blocking_; 655 bool force_hol_blocking_;
655 }; 656 };
656 657
657 // Run all end to end tests with all supported versions. 658 // Run all end to end tests with all supported versions.
658 INSTANTIATE_TEST_CASE_P(EndToEndTests, 659 INSTANTIATE_TEST_CASE_P(EndToEndTests,
659 EndToEndTest, 660 EndToEndTest,
660 ::testing::ValuesIn(GetTestParams())); 661 ::testing::ValuesIn(GetTestParams()));
661 662
663 TEST_P(EndToEndTest, HandshakeSuccessful) {
664 ASSERT_TRUE(Initialize());
665 client_->client()->WaitForCryptoHandshakeConfirmed();
666 QuicCryptoStream* crypto_stream =
667 QuicSessionPeer::GetCryptoStream(client_->client()->session());
668 QuicStreamSequencer* sequencer =
669 ReliableQuicStreamPeer::sequencer(crypto_stream);
670 EXPECT_NE(FLAGS_quic_release_crypto_stream_buffer &&
671 FLAGS_quic_reduce_sequencer_buffer_memory_life_time,
672 QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer));
673 server_thread_->Pause();
674 QuicDispatcher* dispatcher =
675 QuicServerPeer::GetDispatcher(server_thread_->server());
676 QuicSession* server_session = dispatcher->session_map().begin()->second;
677 crypto_stream = QuicSessionPeer::GetCryptoStream(server_session);
678 sequencer = ReliableQuicStreamPeer::sequencer(crypto_stream);
679 EXPECT_NE(FLAGS_quic_release_crypto_stream_buffer &&
680 FLAGS_quic_reduce_sequencer_buffer_memory_life_time,
681 QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer));
682 }
683
662 TEST_P(EndToEndTest, SimpleRequestResponse) { 684 TEST_P(EndToEndTest, SimpleRequestResponse) {
663 ASSERT_TRUE(Initialize()); 685 ASSERT_TRUE(Initialize());
664 686
665 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); 687 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo"));
666 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); 688 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code());
667 EXPECT_EQ(2, client_->client()->GetNumSentClientHellos()); 689 EXPECT_EQ(2, client_->client()->GetNumSentClientHellos());
668 } 690 }
669 691
670 TEST_P(EndToEndTest, SimpleRequestResponseWithLargeReject) { 692 TEST_P(EndToEndTest, SimpleRequestResponseWithLargeReject) {
671 chlo_multiplier_ = 1; 693 chlo_multiplier_ = 1;
(...skipping 2265 matching lines...) Expand 10 before | Expand all | Expand 10 after
2937 EXPECT_EQ(kBarResponseBody, client_->response_body()); 2959 EXPECT_EQ(kBarResponseBody, client_->response_body());
2938 QuicConnectionStats client_stats = 2960 QuicConnectionStats client_stats =
2939 client_->client()->session()->connection()->GetStats(); 2961 client_->client()->session()->connection()->GetStats();
2940 EXPECT_EQ(0u, client_stats.packets_lost); 2962 EXPECT_EQ(0u, client_stats.packets_lost);
2941 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); 2963 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos());
2942 } 2964 }
2943 2965
2944 } // namespace 2966 } // namespace
2945 } // namespace test 2967 } // namespace test
2946 } // namespace net 2968 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/reliable_quic_stream_peer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698