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 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 QuicTime::Delta::FromMicroseconds(500)); | 847 QuicTime::Delta::FromMicroseconds(500)); |
848 // Note: we do NOT ASSERT_TRUE: we may time out during initial handshake: | 848 // Note: we do NOT ASSERT_TRUE: we may time out during initial handshake: |
849 // that's enough to validate timeout in this case. | 849 // that's enough to validate timeout in this case. |
850 Initialize(); | 850 Initialize(); |
851 while (client_->client()->connected()) { | 851 while (client_->client()->connected()) { |
852 client_->client()->WaitForEvents(); | 852 client_->client()->WaitForEvents(); |
853 } | 853 } |
854 } | 854 } |
855 | 855 |
856 TEST_P(EndToEndTest, NegotiateMaxOpenStreams) { | 856 TEST_P(EndToEndTest, NegotiateMaxOpenStreams) { |
| 857 ValueRestore<bool> old_flag(&FLAGS_quic_allow_more_open_streams, true); |
| 858 |
857 // Negotiate 1 max open stream. | 859 // Negotiate 1 max open stream. |
858 client_config_.SetMaxStreamsPerConnection(1, 1); | 860 client_config_.SetMaxStreamsPerConnection(1, 1); |
859 ASSERT_TRUE(Initialize()); | 861 ASSERT_TRUE(Initialize()); |
860 client_->client()->WaitForCryptoHandshakeConfirmed(); | 862 client_->client()->WaitForCryptoHandshakeConfirmed(); |
861 | 863 |
862 // Make the client misbehave after negotiation. | 864 // Make the client misbehave after negotiation. |
863 QuicSessionPeer::SetMaxOpenStreams(client_->client()->session(), 10); | 865 const int kServerMaxStreams = kMaxStreamsMinimumIncrement + 1; |
| 866 QuicSessionPeer::SetMaxOpenStreams(client_->client()->session(), |
| 867 kServerMaxStreams + 1); |
864 | 868 |
865 HTTPMessage request(HttpConstants::HTTP_1_1, | 869 HTTPMessage request(HttpConstants::HTTP_1_1, HttpConstants::POST, "/foo"); |
866 HttpConstants::POST, "/foo"); | |
867 request.AddHeader("content-length", "3"); | 870 request.AddHeader("content-length", "3"); |
868 request.set_has_complete_message(false); | 871 request.set_has_complete_message(false); |
869 | 872 |
870 // Open two simultaneous streams. | 873 // The server supports a small number of additional streams beyond the |
871 client_->SendMessage(request); | 874 // negotiated limit. Open enough streams to go beyond that limit. |
872 client_->SendMessage(request); | 875 for (int i = 0; i < kServerMaxStreams + 1; ++i) { |
| 876 client_->SendMessage(request); |
| 877 } |
873 client_->WaitForResponse(); | 878 client_->WaitForResponse(); |
874 | 879 |
875 EXPECT_FALSE(client_->connected()); | 880 EXPECT_FALSE(client_->connected()); |
876 EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error()); | 881 EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error()); |
877 EXPECT_EQ(QUIC_TOO_MANY_OPEN_STREAMS, client_->connection_error()); | 882 EXPECT_EQ(QUIC_TOO_MANY_OPEN_STREAMS, client_->connection_error()); |
878 } | 883 } |
879 | 884 |
880 TEST_P(EndToEndTest, NegotiateCongestionControl) { | 885 TEST_P(EndToEndTest, NegotiateCongestionControl) { |
881 ASSERT_TRUE(Initialize()); | 886 ASSERT_TRUE(Initialize()); |
882 client_->client()->WaitForCryptoHandshakeConfirmed(); | 887 client_->client()->WaitForCryptoHandshakeConfirmed(); |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1357 QuicSession* session = dispatcher->session_map().begin()->second; | 1362 QuicSession* session = dispatcher->session_map().begin()->second; |
1358 EXPECT_EQ(0u, QuicSessionPeer::GetLocallyClosedStreamsHighestOffset( | 1363 EXPECT_EQ(0u, QuicSessionPeer::GetLocallyClosedStreamsHighestOffset( |
1359 session).size()); | 1364 session).size()); |
1360 server_thread_->Resume(); | 1365 server_thread_->Resume(); |
1361 } | 1366 } |
1362 | 1367 |
1363 } // namespace | 1368 } // namespace |
1364 } // namespace test | 1369 } // namespace test |
1365 } // namespace tools | 1370 } // namespace tools |
1366 } // namespace net | 1371 } // namespace net |
OLD | NEW |