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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
219 server_supported_versions_, | 219 server_supported_versions_, |
220 strike_register_no_startup_period_)); | 220 strike_register_no_startup_period_)); |
221 server_thread_->Start(); | 221 server_thread_->Start(); |
222 server_thread_->WaitForServerStartup(); | 222 server_thread_->WaitForServerStartup(); |
223 server_address_ = IPEndPoint(server_address_.address(), | 223 server_address_ = IPEndPoint(server_address_.address(), |
224 server_thread_->GetPort()); | 224 server_thread_->GetPort()); |
225 QuicDispatcher* dispatcher = | 225 QuicDispatcher* dispatcher = |
226 QuicServerPeer::GetDispatcher(server_thread_->server()); | 226 QuicServerPeer::GetDispatcher(server_thread_->server()); |
227 server_writer_->SetConnectionHelper( | 227 server_writer_->SetConnectionHelper( |
228 QuicDispatcherPeer::GetHelper(dispatcher)); | 228 QuicDispatcherPeer::GetHelper(dispatcher)); |
229 // TODO(rtenneti): Enable server_thread's Pause/Resume. | |
230 // server_thread_->Pause(); | |
ramant (doing other things)
2014/01/08 03:04:20
Hi Ryan,
Would like to discuss with you how we c
Ryan Hamilton
2014/01/08 04:05:10
Sounds good.
| |
229 QuicDispatcherPeer::UseWriter(dispatcher, server_writer_); | 231 QuicDispatcherPeer::UseWriter(dispatcher, server_writer_); |
232 // TODO(rtenneti): Enable server_thread's Pause/Resume. | |
233 // server_thread_->Resume(); | |
230 server_started_ = true; | 234 server_started_ = true; |
231 } | 235 } |
232 | 236 |
233 void StopServer() { | 237 void StopServer() { |
234 if (!server_started_) | 238 if (!server_started_) |
235 return; | 239 return; |
236 if (server_thread_.get()) { | 240 if (server_thread_.get()) { |
237 server_thread_->Quit(); | 241 server_thread_->Quit(); |
238 server_thread_->Join(); | 242 server_thread_->Join(); |
239 } | 243 } |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
574 GenerateBody(&body, kMaxPacketSize); | 578 GenerateBody(&body, kMaxPacketSize); |
575 | 579 |
576 HTTPMessage request(HttpConstants::HTTP_1_1, | 580 HTTPMessage request(HttpConstants::HTTP_1_1, |
577 HttpConstants::POST, "/foo"); | 581 HttpConstants::POST, "/foo"); |
578 request.AddBody(body, true); | 582 request.AddBody(body, true); |
579 // Force the client to write with a stream ID belonging to a nonexistent | 583 // Force the client to write with a stream ID belonging to a nonexistent |
580 // server-side stream. | 584 // server-side stream. |
581 QuicSessionPeer::SetNextStreamId(client_->client()->session(), 2); | 585 QuicSessionPeer::SetNextStreamId(client_->client()->session(), 2); |
582 | 586 |
583 client_->SendCustomSynchronousRequest(request); | 587 client_->SendCustomSynchronousRequest(request); |
584 // EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error()); | 588 // EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error()); |
585 EXPECT_EQ(QUIC_PACKET_FOR_NONEXISTENT_STREAM, client_->connection_error()); | 589 EXPECT_EQ(QUIC_PACKET_FOR_NONEXISTENT_STREAM, client_->connection_error()); |
586 } | 590 } |
587 | 591 |
588 // TODO(rch): this test seems to cause net_unittests timeouts :| | 592 // TODO(rch): this test seems to cause net_unittests timeouts :| |
589 TEST_P(EndToEndTest, DISABLED_MultipleTermination) { | 593 TEST_P(EndToEndTest, DISABLED_MultipleTermination) { |
590 ASSERT_TRUE(Initialize()); | 594 ASSERT_TRUE(Initialize()); |
591 | 595 |
592 HTTPMessage request(HttpConstants::HTTP_1_1, | 596 HTTPMessage request(HttpConstants::HTTP_1_1, |
593 HttpConstants::POST, "/foo"); | 597 HttpConstants::POST, "/foo"); |
594 request.AddHeader("content-length", "3"); | 598 request.AddHeader("content-length", "3"); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
718 // Client tries to negotiate twice the server's max and negotiation settles | 722 // Client tries to negotiate twice the server's max and negotiation settles |
719 // on the max. | 723 // on the max. |
720 client_config_.set_initial_round_trip_time_us(2 * kMaxInitialRoundTripTimeUs, | 724 client_config_.set_initial_round_trip_time_us(2 * kMaxInitialRoundTripTimeUs, |
721 0); | 725 0); |
722 | 726 |
723 ASSERT_TRUE(Initialize()); | 727 ASSERT_TRUE(Initialize()); |
724 client_->client()->WaitForCryptoHandshakeConfirmed(); | 728 client_->client()->WaitForCryptoHandshakeConfirmed(); |
725 server_thread_->WaitForCryptoHandshakeConfirmed(); | 729 server_thread_->WaitForCryptoHandshakeConfirmed(); |
726 | 730 |
727 // Pause the server so we can access the server's internals without races. | 731 // Pause the server so we can access the server's internals without races. |
728 server_thread_->Pause(); | 732 // TODO(rtenneti): Enable server_thread's Pause/Resume. |
733 // server_thread_->Pause(); | |
729 QuicDispatcher* dispatcher = | 734 QuicDispatcher* dispatcher = |
730 QuicServerPeer::GetDispatcher(server_thread_->server()); | 735 QuicServerPeer::GetDispatcher(server_thread_->server()); |
731 ASSERT_EQ(1u, dispatcher->session_map().size()); | 736 ASSERT_EQ(1u, dispatcher->session_map().size()); |
732 QuicSession* session = dispatcher->session_map().begin()->second; | 737 QuicSession* session = dispatcher->session_map().begin()->second; |
733 QuicConfig* client_negotiated_config = client_->client()->session()->config(); | 738 QuicConfig* client_negotiated_config = client_->client()->session()->config(); |
734 QuicConfig* server_negotiated_config = session->config(); | 739 QuicConfig* server_negotiated_config = session->config(); |
735 const QuicSentPacketManager& client_sent_packet_manager = | 740 const QuicSentPacketManager& client_sent_packet_manager = |
736 client_->client()->session()->connection()->sent_packet_manager(); | 741 client_->client()->session()->connection()->sent_packet_manager(); |
737 const QuicSentPacketManager& server_sent_packet_manager = | 742 const QuicSentPacketManager& server_sent_packet_manager = |
738 session->connection()->sent_packet_manager(); | 743 session->connection()->sent_packet_manager(); |
739 | 744 |
740 EXPECT_EQ(kMaxInitialRoundTripTimeUs, | 745 EXPECT_EQ(kMaxInitialRoundTripTimeUs, |
741 client_negotiated_config->initial_round_trip_time_us()); | 746 client_negotiated_config->initial_round_trip_time_us()); |
742 EXPECT_EQ(kMaxInitialRoundTripTimeUs, | 747 EXPECT_EQ(kMaxInitialRoundTripTimeUs, |
743 server_negotiated_config->initial_round_trip_time_us()); | 748 server_negotiated_config->initial_round_trip_time_us()); |
744 // Now that acks have been exchanged, the RTT estimate has decreased on the | 749 // Now that acks have been exchanged, the RTT estimate has decreased on the |
745 // server and is not infinite on the client. | 750 // server and is not infinite on the client. |
746 EXPECT_FALSE(client_sent_packet_manager.SmoothedRtt().IsInfinite()); | 751 EXPECT_FALSE(client_sent_packet_manager.SmoothedRtt().IsInfinite()); |
747 EXPECT_GE(static_cast<int64>(kMaxInitialRoundTripTimeUs), | 752 EXPECT_GE(static_cast<int64>(kMaxInitialRoundTripTimeUs), |
748 server_sent_packet_manager.SmoothedRtt().ToMicroseconds()); | 753 server_sent_packet_manager.SmoothedRtt().ToMicroseconds()); |
754 // TODO(rtenneti): Enable server_thread's Pause/Resume. | |
755 // server_thread_->Resume(); | |
749 } | 756 } |
750 | 757 |
751 TEST_P(EndToEndTest, ResetConnection) { | 758 TEST_P(EndToEndTest, ResetConnection) { |
752 ASSERT_TRUE(Initialize()); | 759 ASSERT_TRUE(Initialize()); |
753 client_->client()->WaitForCryptoHandshakeConfirmed(); | 760 client_->client()->WaitForCryptoHandshakeConfirmed(); |
754 | 761 |
755 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); | 762 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); |
756 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); | 763 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); |
757 client_->ResetConnection(); | 764 client_->ResetConnection(); |
758 EXPECT_EQ(kBarResponseBody, client_->SendSynchronousRequest("/bar")); | 765 EXPECT_EQ(kBarResponseBody, client_->SendSynchronousRequest("/bar")); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
856 client_->SendSynchronousRequest("/bar"); | 863 client_->SendSynchronousRequest("/bar"); |
857 | 864 |
858 EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error()); | 865 EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error()); |
859 EXPECT_EQ(QUIC_ERROR_MIGRATING_ADDRESS, client_->connection_error()); | 866 EXPECT_EQ(QUIC_ERROR_MIGRATING_ADDRESS, client_->connection_error()); |
860 } | 867 } |
861 | 868 |
862 } // namespace | 869 } // namespace |
863 } // namespace test | 870 } // namespace test |
864 } // namespace tools | 871 } // namespace tools |
865 } // namespace net | 872 } // namespace net |
OLD | NEW |