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" |
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 | 863 |
864 // By default the stream protects itself from writes after terminte is set. | 864 // By default the stream protects itself from writes after terminte is set. |
865 // Override this to test the server handling buggy clients. | 865 // Override this to test the server handling buggy clients. |
866 ReliableQuicStreamPeer::SetWriteSideClosed( | 866 ReliableQuicStreamPeer::SetWriteSideClosed( |
867 false, client_->GetOrCreateStream()); | 867 false, client_->GetOrCreateStream()); |
868 | 868 |
869 EXPECT_DFATAL(client_->SendData("eep", true), "Fin already buffered"); | 869 EXPECT_DFATAL(client_->SendData("eep", true), "Fin already buffered"); |
870 } | 870 } |
871 | 871 |
872 TEST_P(EndToEndTest, Timeout) { | 872 TEST_P(EndToEndTest, Timeout) { |
873 client_config_.set_idle_connection_state_lifetime( | 873 client_config_.SetIdleConnectionStateLifetime( |
874 QuicTime::Delta::FromMicroseconds(500), | 874 QuicTime::Delta::FromMicroseconds(500), |
875 QuicTime::Delta::FromMicroseconds(500)); | 875 QuicTime::Delta::FromMicroseconds(500)); |
876 // Note: we do NOT ASSERT_TRUE: we may time out during initial handshake: | 876 // Note: we do NOT ASSERT_TRUE: we may time out during initial handshake: |
877 // that's enough to validate timeout in this case. | 877 // that's enough to validate timeout in this case. |
878 Initialize(); | 878 Initialize(); |
879 while (client_->client()->connected()) { | 879 while (client_->client()->connected()) { |
880 client_->client()->WaitForEvents(); | 880 client_->client()->WaitForEvents(); |
881 } | 881 } |
882 } | 882 } |
883 | 883 |
884 TEST_P(EndToEndTest, NegotiateMaxOpenStreams) { | 884 TEST_P(EndToEndTest, NegotiateMaxOpenStreams) { |
885 // Negotiate 1 max open stream. | 885 // Negotiate 1 max open stream. |
886 client_config_.set_max_streams_per_connection(1, 1); | 886 client_config_.SetMaxStreamsPerConnection(1, 1); |
887 ASSERT_TRUE(Initialize()); | 887 ASSERT_TRUE(Initialize()); |
888 client_->client()->WaitForCryptoHandshakeConfirmed(); | 888 client_->client()->WaitForCryptoHandshakeConfirmed(); |
889 | 889 |
890 // Make the client misbehave after negotiation. | 890 // Make the client misbehave after negotiation. |
891 QuicSessionPeer::SetMaxOpenStreams(client_->client()->session(), 10); | 891 QuicSessionPeer::SetMaxOpenStreams(client_->client()->session(), 10); |
892 | 892 |
893 HTTPMessage request(HttpConstants::HTTP_1_1, | 893 HTTPMessage request(HttpConstants::HTTP_1_1, |
894 HttpConstants::POST, "/foo"); | 894 HttpConstants::POST, "/foo"); |
895 request.AddHeader("content-length", "3"); | 895 request.AddHeader("content-length", "3"); |
896 request.set_has_complete_message(false); | 896 request.set_has_complete_message(false); |
(...skipping 28 matching lines...) Expand all Loading... |
925 } | 925 } |
926 | 926 |
927 EXPECT_EQ(expected_congestion_control_type, | 927 EXPECT_EQ(expected_congestion_control_type, |
928 QuicSentPacketManagerPeer::GetCongestionControlAlgorithm( | 928 QuicSentPacketManagerPeer::GetCongestionControlAlgorithm( |
929 *GetSentPacketManagerFromFirstServerSession()) | 929 *GetSentPacketManagerFromFirstServerSession()) |
930 ->GetCongestionControlType()); | 930 ->GetCongestionControlType()); |
931 } | 931 } |
932 | 932 |
933 TEST_P(EndToEndTest, LimitMaxOpenStreams) { | 933 TEST_P(EndToEndTest, LimitMaxOpenStreams) { |
934 // Server limits the number of max streams to 2. | 934 // Server limits the number of max streams to 2. |
935 server_config_.set_max_streams_per_connection(2, 2); | 935 server_config_.SetMaxStreamsPerConnection(2, 2); |
936 // Client tries to negotiate for 10. | 936 // Client tries to negotiate for 10. |
937 client_config_.set_max_streams_per_connection(10, 5); | 937 client_config_.SetMaxStreamsPerConnection(10, 5); |
938 | 938 |
939 ASSERT_TRUE(Initialize()); | 939 ASSERT_TRUE(Initialize()); |
940 client_->client()->WaitForCryptoHandshakeConfirmed(); | 940 client_->client()->WaitForCryptoHandshakeConfirmed(); |
941 QuicConfig* client_negotiated_config = client_->client()->session()->config(); | 941 QuicConfig* client_negotiated_config = client_->client()->session()->config(); |
942 EXPECT_EQ(2u, client_negotiated_config->max_streams_per_connection()); | 942 EXPECT_EQ(2u, client_negotiated_config->MaxStreamsPerConnection()); |
943 } | 943 } |
944 | 944 |
945 TEST_P(EndToEndTest, LimitCongestionWindowAndRTT) { | 945 TEST_P(EndToEndTest, LimitCongestionWindowAndRTT) { |
946 // Client tries to request twice the server's max initial window, and the | 946 // Client tries to request twice the server's max initial window, and the |
947 // server limits it to the max. | 947 // server limits it to the max. |
948 client_config_.SetInitialCongestionWindowToSend(2 * kMaxInitialWindow); | 948 client_config_.SetInitialCongestionWindowToSend(2 * kMaxInitialWindow); |
949 client_config_.SetInitialRoundTripTimeUsToSend(1000); | 949 client_config_.SetInitialRoundTripTimeUsToSend(1000); |
950 | 950 |
951 ASSERT_TRUE(Initialize()); | 951 ASSERT_TRUE(Initialize()); |
952 client_->client()->WaitForCryptoHandshakeConfirmed(); | 952 client_->client()->WaitForCryptoHandshakeConfirmed(); |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1385 QuicSession* session = dispatcher->session_map().begin()->second; | 1385 QuicSession* session = dispatcher->session_map().begin()->second; |
1386 EXPECT_EQ(0u, QuicSessionPeer::GetLocallyClosedStreamsHighestOffset( | 1386 EXPECT_EQ(0u, QuicSessionPeer::GetLocallyClosedStreamsHighestOffset( |
1387 session).size()); | 1387 session).size()); |
1388 server_thread_->Resume(); | 1388 server_thread_->Resume(); |
1389 } | 1389 } |
1390 | 1390 |
1391 } // namespace | 1391 } // namespace |
1392 } // namespace test | 1392 } // namespace test |
1393 } // namespace tools | 1393 } // namespace tools |
1394 } // namespace net | 1394 } // namespace net |
OLD | NEW |