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_flow_controller_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::QuicFlowControllerPeer; |
53 using net::test::QuicSessionPeer; | 55 using net::test::QuicSessionPeer; |
54 using net::test::ReliableQuicStreamPeer; | 56 using net::test::ReliableQuicStreamPeer; |
| 57 using net::test::ValueRestore; |
55 using net::test::kClientDataStreamId1; | 58 using net::test::kClientDataStreamId1; |
56 using net::tools::test::PacketDroppingTestWriter; | 59 using net::tools::test::PacketDroppingTestWriter; |
57 using net::tools::test::QuicDispatcherPeer; | 60 using net::tools::test::QuicDispatcherPeer; |
58 using net::tools::test::QuicServerPeer; | 61 using net::tools::test::QuicServerPeer; |
59 using std::ostream; | 62 using std::ostream; |
60 using std::string; | 63 using std::string; |
61 using std::vector; | 64 using std::vector; |
62 | 65 |
63 namespace net { | 66 namespace net { |
64 namespace tools { | 67 namespace tools { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 } | 174 } |
172 if (negotiated_version_ >= QUIC_VERSION_19) { | 175 if (negotiated_version_ >= QUIC_VERSION_19) { |
173 FLAGS_enable_quic_connection_flow_control = true; | 176 FLAGS_enable_quic_connection_flow_control = true; |
174 } | 177 } |
175 VLOG(1) << "Using Configuration: " << GetParam(); | 178 VLOG(1) << "Using Configuration: " << GetParam(); |
176 | 179 |
177 client_config_.SetDefaults(); | 180 client_config_.SetDefaults(); |
178 server_config_.SetDefaults(); | 181 server_config_.SetDefaults(); |
179 | 182 |
180 // Use different flow control windows for client/server. | 183 // Use different flow control windows for client/server. |
181 client_initial_flow_control_receive_window_ = | 184 client_config_.SetInitialFlowControlWindowToSend( |
182 2 * kInitialFlowControlWindowForTest; | 185 2 * kInitialFlowControlWindowForTest); |
183 server_initial_flow_control_receive_window_ = | 186 server_config_.SetInitialFlowControlWindowToSend( |
184 3 * kInitialFlowControlWindowForTest; | 187 3 * kInitialFlowControlWindowForTest); |
185 | 188 |
186 QuicInMemoryCachePeer::ResetForTests(); | 189 QuicInMemoryCachePeer::ResetForTests(); |
187 AddToCache("GET", "https://www.google.com/foo", | 190 AddToCache("GET", "https://www.google.com/foo", |
188 "HTTP/1.1", "200", "OK", kFooResponseBody); | 191 "HTTP/1.1", "200", "OK", kFooResponseBody); |
189 AddToCache("GET", "https://www.google.com/bar", | 192 AddToCache("GET", "https://www.google.com/bar", |
190 "HTTP/1.1", "200", "OK", kBarResponseBody); | 193 "HTTP/1.1", "200", "OK", kBarResponseBody); |
191 } | 194 } |
192 | 195 |
193 virtual ~EndToEndTest() { | 196 virtual ~EndToEndTest() { |
194 // TODO(rtenneti): port RecycleUnusedPort if needed. | 197 // TODO(rtenneti): port RecycleUnusedPort if needed. |
195 // RecycleUnusedPort(server_address_.port()); | 198 // RecycleUnusedPort(server_address_.port()); |
196 QuicInMemoryCachePeer::ResetForTests(); | 199 QuicInMemoryCachePeer::ResetForTests(); |
197 } | 200 } |
198 | 201 |
199 QuicTestClient* CreateQuicClient(QuicPacketWriterWrapper* writer) { | 202 QuicTestClient* CreateQuicClient(QuicPacketWriterWrapper* writer) { |
200 QuicTestClient* client = new QuicTestClient( | 203 QuicTestClient* client = new QuicTestClient( |
201 server_address_, | 204 server_address_, |
202 server_hostname_, | 205 server_hostname_, |
203 false, // not secure | 206 false, // not secure |
204 client_config_, | 207 client_config_, |
205 client_supported_versions_, | 208 client_supported_versions_); |
206 client_initial_flow_control_receive_window_); | |
207 client->UseWriter(writer); | 209 client->UseWriter(writer); |
208 client->Connect(); | 210 client->Connect(); |
209 return client; | 211 return client; |
210 } | 212 } |
211 | 213 |
212 void set_client_initial_flow_control_receive_window(uint32 window) { | 214 void set_client_initial_flow_control_receive_window(uint32 window) { |
213 CHECK(client_.get() == NULL); | 215 CHECK(client_.get() == NULL); |
214 DVLOG(1) << "Setting client initial flow control window: " << window; | 216 DVLOG(1) << "Setting client initial flow control window: " << window; |
215 client_initial_flow_control_receive_window_ = window; | 217 client_config_.SetInitialFlowControlWindowToSend(window); |
216 } | 218 } |
217 | 219 |
218 void set_server_initial_flow_control_receive_window(uint32 window) { | 220 void set_server_initial_flow_control_receive_window(uint32 window) { |
219 CHECK(server_thread_.get() == NULL); | 221 CHECK(server_thread_.get() == NULL); |
220 DVLOG(1) << "Setting server initial flow control window: " << window; | 222 DVLOG(1) << "Setting server initial flow control window: " << window; |
221 server_initial_flow_control_receive_window_ = window; | 223 server_config_.SetInitialFlowControlWindowToSend(window); |
222 } | 224 } |
223 | 225 |
224 bool Initialize() { | 226 bool Initialize() { |
225 // Start the server first, because CreateQuicClient() attempts | 227 // Start the server first, because CreateQuicClient() attempts |
226 // to connect to the server. | 228 // to connect to the server. |
227 StartServer(); | 229 StartServer(); |
228 client_.reset(CreateQuicClient(client_writer_)); | 230 client_.reset(CreateQuicClient(client_writer_)); |
229 static EpollEvent event(EPOLLOUT, false); | 231 static EpollEvent event(EPOLLOUT, false); |
230 client_writer_->Initialize( | 232 client_writer_->Initialize( |
231 reinterpret_cast<QuicEpollConnectionHelper*>( | 233 reinterpret_cast<QuicEpollConnectionHelper*>( |
(...skipping 12 matching lines...) Expand all Loading... |
244 | 246 |
245 virtual void TearDown() OVERRIDE { | 247 virtual void TearDown() OVERRIDE { |
246 StopServer(); | 248 StopServer(); |
247 } | 249 } |
248 | 250 |
249 void StartServer() { | 251 void StartServer() { |
250 server_thread_.reset( | 252 server_thread_.reset( |
251 new ServerThread(server_address_, | 253 new ServerThread(server_address_, |
252 server_config_, | 254 server_config_, |
253 server_supported_versions_, | 255 server_supported_versions_, |
254 strike_register_no_startup_period_, | 256 strike_register_no_startup_period_)); |
255 server_initial_flow_control_receive_window_)); | |
256 server_thread_->Initialize(); | 257 server_thread_->Initialize(); |
257 server_address_ = IPEndPoint(server_address_.address(), | 258 server_address_ = IPEndPoint(server_address_.address(), |
258 server_thread_->GetPort()); | 259 server_thread_->GetPort()); |
259 QuicDispatcher* dispatcher = | 260 QuicDispatcher* dispatcher = |
260 QuicServerPeer::GetDispatcher(server_thread_->server()); | 261 QuicServerPeer::GetDispatcher(server_thread_->server()); |
261 QuicDispatcherPeer::UseWriter(dispatcher, server_writer_); | 262 QuicDispatcherPeer::UseWriter(dispatcher, server_writer_); |
262 server_writer_->Initialize( | 263 server_writer_->Initialize( |
263 QuicDispatcherPeer::GetHelper(dispatcher), | 264 QuicDispatcherPeer::GetHelper(dispatcher), |
264 new ServerDelegate(dispatcher)); | 265 new ServerDelegate(dispatcher)); |
265 server_thread_->Start(); | 266 server_thread_->Start(); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 scoped_ptr<QuicTestClient> client_; | 345 scoped_ptr<QuicTestClient> client_; |
345 PacketDroppingTestWriter* client_writer_; | 346 PacketDroppingTestWriter* client_writer_; |
346 PacketDroppingTestWriter* server_writer_; | 347 PacketDroppingTestWriter* server_writer_; |
347 bool server_started_; | 348 bool server_started_; |
348 QuicConfig client_config_; | 349 QuicConfig client_config_; |
349 QuicConfig server_config_; | 350 QuicConfig server_config_; |
350 QuicVersionVector client_supported_versions_; | 351 QuicVersionVector client_supported_versions_; |
351 QuicVersionVector server_supported_versions_; | 352 QuicVersionVector server_supported_versions_; |
352 QuicVersion negotiated_version_; | 353 QuicVersion negotiated_version_; |
353 bool strike_register_no_startup_period_; | 354 bool strike_register_no_startup_period_; |
354 uint32 client_initial_flow_control_receive_window_; | |
355 uint32 server_initial_flow_control_receive_window_; | |
356 }; | 355 }; |
357 | 356 |
358 // Run all end to end tests with all supported versions. | 357 // Run all end to end tests with all supported versions. |
359 INSTANTIATE_TEST_CASE_P(EndToEndTests, | 358 INSTANTIATE_TEST_CASE_P(EndToEndTests, |
360 EndToEndTest, | 359 EndToEndTest, |
361 ::testing::ValuesIn(GetTestParams())); | 360 ::testing::ValuesIn(GetTestParams())); |
362 | 361 |
363 TEST_P(EndToEndTest, SimpleRequestResponse) { | 362 TEST_P(EndToEndTest, SimpleRequestResponse) { |
364 ASSERT_TRUE(Initialize()); | 363 ASSERT_TRUE(Initialize()); |
365 | 364 |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 HTTPMessage request(HttpConstants::HTTP_1_1, | 681 HTTPMessage request(HttpConstants::HTTP_1_1, |
683 HttpConstants::POST, "/foo"); | 682 HttpConstants::POST, "/foo"); |
684 request.AddBody(body, true); | 683 request.AddBody(body, true); |
685 | 684 |
686 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); | 685 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); |
687 // This connection will not drop packets, because the buffer size is larger | 686 // This connection will not drop packets, because the buffer size is larger |
688 // than the default receive window. | 687 // than the default receive window. |
689 VerifyCleanConnection(false); | 688 VerifyCleanConnection(false); |
690 } | 689 } |
691 | 690 |
| 691 TEST_P(EndToEndTest, DoNotSetResumeWriteAlarmIfConnectionFlowControlBlocked) { |
| 692 // Regression test for b/14677858. |
| 693 // Test that the resume write alarm is not set in QuicConnection::OnCanWrite |
| 694 // if currently connection level flow control blocked. If set, this results in |
| 695 // an infinite loop in the EpollServer, as the alarm fires and is immediately |
| 696 // rescheduled. |
| 697 ASSERT_TRUE(Initialize()); |
| 698 if (negotiated_version_ < QUIC_VERSION_19) { |
| 699 return; |
| 700 } |
| 701 client_->client()->WaitForCryptoHandshakeConfirmed(); |
| 702 |
| 703 // Ensure both stream and connection level are flow control blocked by setting |
| 704 // the send window offset to 0. |
| 705 const uint64 kFlowControlWindow = |
| 706 server_config_.GetInitialFlowControlWindowToSend(); |
| 707 QuicSpdyClientStream* stream = client_->GetOrCreateStream(); |
| 708 QuicSession* session = client_->client()->session(); |
| 709 QuicFlowControllerPeer::SetSendWindowOffset(stream->flow_controller(), 0); |
| 710 QuicFlowControllerPeer::SetSendWindowOffset(session->flow_controller(), 0); |
| 711 EXPECT_TRUE(stream->flow_controller()->IsBlocked()); |
| 712 EXPECT_TRUE(session->flow_controller()->IsBlocked()); |
| 713 |
| 714 // Make sure that the stream has data pending so that it will be marked as |
| 715 // write blocked when it receives a stream level WINDOW_UPDATE. |
| 716 stream->SendBody("hello", false); |
| 717 |
| 718 // The stream now attempts to write, fails because it is still connection |
| 719 // level flow control blocked, and is added to the write blocked list. |
| 720 QuicWindowUpdateFrame window_update(stream->id(), 2 * kFlowControlWindow); |
| 721 stream->OnWindowUpdateFrame(window_update); |
| 722 |
| 723 // Prior to fixing b/14677858 this call would result in an infinite loop in |
| 724 // Chromium. As a proxy for detecting this, we now check whether the |
| 725 // resume_writes_alarm is set after OnCanWrite. It should not be, as the |
| 726 // connection is still flow control blocked. |
| 727 session->connection()->OnCanWrite(); |
| 728 |
| 729 QuicAlarm* resume_writes_alarm = |
| 730 QuicConnectionPeer::GetResumeWritesAlarm(session->connection()); |
| 731 EXPECT_FALSE(resume_writes_alarm->IsSet()); |
| 732 } |
| 733 |
692 TEST_P(EndToEndTest, InvalidStream) { | 734 TEST_P(EndToEndTest, InvalidStream) { |
693 ASSERT_TRUE(Initialize()); | 735 ASSERT_TRUE(Initialize()); |
694 client_->client()->WaitForCryptoHandshakeConfirmed(); | 736 client_->client()->WaitForCryptoHandshakeConfirmed(); |
695 | 737 |
696 string body; | 738 string body; |
697 GenerateBody(&body, kMaxPacketSize); | 739 GenerateBody(&body, kMaxPacketSize); |
698 | 740 |
699 HTTPMessage request(HttpConstants::HTTP_1_1, | 741 HTTPMessage request(HttpConstants::HTTP_1_1, |
700 HttpConstants::POST, "/foo"); | 742 HttpConstants::POST, "/foo"); |
701 request.AddBody(body, true); | 743 request.AddBody(body, true); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 QuicTime::Delta::FromMicroseconds(500), | 782 QuicTime::Delta::FromMicroseconds(500), |
741 QuicTime::Delta::FromMicroseconds(500)); | 783 QuicTime::Delta::FromMicroseconds(500)); |
742 // Note: we do NOT ASSERT_TRUE: we may time out during initial handshake: | 784 // Note: we do NOT ASSERT_TRUE: we may time out during initial handshake: |
743 // that's enough to validate timeout in this case. | 785 // that's enough to validate timeout in this case. |
744 Initialize(); | 786 Initialize(); |
745 while (client_->client()->connected()) { | 787 while (client_->client()->connected()) { |
746 client_->client()->WaitForEvents(); | 788 client_->client()->WaitForEvents(); |
747 } | 789 } |
748 } | 790 } |
749 | 791 |
| 792 TEST_P(EndToEndTest, NegotiateMaxOpenStreams) { |
| 793 // Negotiate 1 max open stream. |
| 794 client_config_.set_max_streams_per_connection(1, 1); |
| 795 ASSERT_TRUE(Initialize()); |
| 796 client_->client()->WaitForCryptoHandshakeConfirmed(); |
| 797 |
| 798 // Make the client misbehave after negotiation. |
| 799 QuicSessionPeer::SetMaxOpenStreams(client_->client()->session(), 10); |
| 800 |
| 801 HTTPMessage request(HttpConstants::HTTP_1_1, |
| 802 HttpConstants::POST, "/foo"); |
| 803 request.AddHeader("content-length", "3"); |
| 804 request.set_has_complete_message(false); |
| 805 |
| 806 // Open two simultaneous streams. |
| 807 client_->SendMessage(request); |
| 808 client_->SendMessage(request); |
| 809 client_->WaitForResponse(); |
| 810 |
| 811 EXPECT_FALSE(client_->connected()); |
| 812 EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error()); |
| 813 EXPECT_EQ(QUIC_TOO_MANY_OPEN_STREAMS, client_->connection_error()); |
| 814 } |
| 815 |
750 TEST_P(EndToEndTest, LimitMaxOpenStreams) { | 816 TEST_P(EndToEndTest, LimitMaxOpenStreams) { |
751 // Server limits the number of max streams to 2. | 817 // Server limits the number of max streams to 2. |
752 server_config_.set_max_streams_per_connection(2, 2); | 818 server_config_.set_max_streams_per_connection(2, 2); |
753 // Client tries to negotiate for 10. | 819 // Client tries to negotiate for 10. |
754 client_config_.set_max_streams_per_connection(10, 5); | 820 client_config_.set_max_streams_per_connection(10, 5); |
755 | 821 |
756 ASSERT_TRUE(Initialize()); | 822 ASSERT_TRUE(Initialize()); |
757 client_->client()->WaitForCryptoHandshakeConfirmed(); | 823 client_->client()->WaitForCryptoHandshakeConfirmed(); |
758 QuicConfig* client_negotiated_config = client_->client()->session()->config(); | 824 QuicConfig* client_negotiated_config = client_->client()->session()->config(); |
759 EXPECT_EQ(2u, client_negotiated_config->max_streams_per_connection()); | 825 EXPECT_EQ(2u, client_negotiated_config->max_streams_per_connection()); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 TEST_P(EndToEndTest, MaxInitialRTT) { | 882 TEST_P(EndToEndTest, MaxInitialRTT) { |
817 // Client tries to suggest twice the server's max initial rtt and the server | 883 // Client tries to suggest twice the server's max initial rtt and the server |
818 // uses the max. | 884 // uses the max. |
819 client_config_.SetInitialRoundTripTimeUsToSend( | 885 client_config_.SetInitialRoundTripTimeUsToSend( |
820 2 * kMaxInitialRoundTripTimeUs); | 886 2 * kMaxInitialRoundTripTimeUs); |
821 | 887 |
822 ASSERT_TRUE(Initialize()); | 888 ASSERT_TRUE(Initialize()); |
823 client_->client()->WaitForCryptoHandshakeConfirmed(); | 889 client_->client()->WaitForCryptoHandshakeConfirmed(); |
824 server_thread_->WaitForCryptoHandshakeConfirmed(); | 890 server_thread_->WaitForCryptoHandshakeConfirmed(); |
825 | 891 |
| 892 // Pause the server so we can access the server's internals without races. |
826 server_thread_->Pause(); | 893 server_thread_->Pause(); |
827 QuicDispatcher* dispatcher = | 894 QuicDispatcher* dispatcher = |
828 QuicServerPeer::GetDispatcher(server_thread_->server()); | 895 QuicServerPeer::GetDispatcher(server_thread_->server()); |
829 ASSERT_EQ(1u, dispatcher->session_map().size()); | 896 ASSERT_EQ(1u, dispatcher->session_map().size()); |
830 QuicSession* session = dispatcher->session_map().begin()->second; | 897 QuicSession* session = dispatcher->session_map().begin()->second; |
831 const QuicSentPacketManager& client_sent_packet_manager = | 898 const QuicSentPacketManager& client_sent_packet_manager = |
832 client_->client()->session()->connection()->sent_packet_manager(); | 899 client_->client()->session()->connection()->sent_packet_manager(); |
833 const QuicSentPacketManager& server_sent_packet_manager = | 900 const QuicSentPacketManager& server_sent_packet_manager = |
834 session->connection()->sent_packet_manager(); | 901 session->connection()->sent_packet_manager(); |
835 | 902 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 client_->SendSynchronousRequest("/bar"); | 1048 client_->SendSynchronousRequest("/bar"); |
982 | 1049 |
983 EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error()); | 1050 EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error()); |
984 EXPECT_EQ(QUIC_ERROR_MIGRATING_ADDRESS, client_->connection_error()); | 1051 EXPECT_EQ(QUIC_ERROR_MIGRATING_ADDRESS, client_->connection_error()); |
985 } | 1052 } |
986 | 1053 |
987 TEST_P(EndToEndTest, ConnectionMigrationClientPortChanged) { | 1054 TEST_P(EndToEndTest, ConnectionMigrationClientPortChanged) { |
988 // Tests that the client's port can change during an established QUIC | 1055 // Tests that the client's port can change during an established QUIC |
989 // connection, and that doing so does not result in the connection being | 1056 // connection, and that doing so does not result in the connection being |
990 // closed by the server. | 1057 // closed by the server. |
991 FLAGS_quic_allow_port_migration = true; | 1058 ValueRestore<bool> old_flag(&FLAGS_quic_allow_port_migration, true); |
992 | 1059 |
993 ASSERT_TRUE(Initialize()); | 1060 ASSERT_TRUE(Initialize()); |
994 | 1061 |
995 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); | 1062 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); |
996 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); | 1063 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); |
997 | 1064 |
998 // Store the client address which was used to send the first request. | 1065 // Store the client address which was used to send the first request. |
999 IPEndPoint old_address = client_->client()->client_address(); | 1066 IPEndPoint old_address = client_->client()->client_address(); |
1000 | 1067 |
1001 // Stop listening on the old FD. | 1068 // Stop listening on the old FD. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1067 QuicSession* session = dispatcher->session_map().begin()->second; | 1134 QuicSession* session = dispatcher->session_map().begin()->second; |
1068 EXPECT_EQ(kClientIFCW, | 1135 EXPECT_EQ(kClientIFCW, |
1069 session->config()->ReceivedInitialFlowControlWindowBytes()); | 1136 session->config()->ReceivedInitialFlowControlWindowBytes()); |
1070 server_thread_->Resume(); | 1137 server_thread_->Resume(); |
1071 } | 1138 } |
1072 | 1139 |
1073 } // namespace | 1140 } // namespace |
1074 } // namespace test | 1141 } // namespace test |
1075 } // namespace tools | 1142 } // namespace tools |
1076 } // namespace net | 1143 } // namespace net |
OLD | NEW |