| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "net/quic/quic_server_session_base.h" | 5 #include "net/quic/quic_server_session_base.h" |
| 6 | 6 |
| 7 #include <cstdint> | 7 #include <cstdint> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 | 293 |
| 294 // Open more streams: server should accept slightly more than the limit. | 294 // Open more streams: server should accept slightly more than the limit. |
| 295 for (size_t i = 0; i < kMaxStreamsMinimumIncrement; ++i) { | 295 for (size_t i = 0; i < kMaxStreamsMinimumIncrement; ++i) { |
| 296 EXPECT_TRUE(QuicServerSessionBasePeer::GetOrCreateDynamicStream( | 296 EXPECT_TRUE(QuicServerSessionBasePeer::GetOrCreateDynamicStream( |
| 297 session_.get(), stream_id)); | 297 session_.get(), stream_id)); |
| 298 stream_id += 2; | 298 stream_id += 2; |
| 299 } | 299 } |
| 300 | 300 |
| 301 // Now violate the server's internal stream limit. | 301 // Now violate the server's internal stream limit. |
| 302 stream_id += 2; | 302 stream_id += 2; |
| 303 if (connection_->version() <= QUIC_VERSION_27) { | 303 EXPECT_CALL(*connection_, CloseConnection(_, _, _)).Times(0); |
| 304 EXPECT_CALL(*connection_, | 304 EXPECT_CALL(*connection_, SendRstStream(stream_id, QUIC_REFUSED_STREAM, 0)); |
| 305 CloseConnection(QUIC_TOO_MANY_OPEN_STREAMS, _, _)); | |
| 306 EXPECT_CALL(*connection_, SendRstStream(_, _, _)).Times(0); | |
| 307 } else { | |
| 308 EXPECT_CALL(*connection_, CloseConnection(_, _, _)).Times(0); | |
| 309 EXPECT_CALL(*connection_, SendRstStream(stream_id, QUIC_REFUSED_STREAM, 0)); | |
| 310 } | |
| 311 // Even if the connection remains open, the stream creation should fail. | 305 // Even if the connection remains open, the stream creation should fail. |
| 312 EXPECT_FALSE(QuicServerSessionBasePeer::GetOrCreateDynamicStream( | 306 EXPECT_FALSE(QuicServerSessionBasePeer::GetOrCreateDynamicStream( |
| 313 session_.get(), stream_id)); | 307 session_.get(), stream_id)); |
| 314 } | 308 } |
| 315 | 309 |
| 316 TEST_P(QuicServerSessionBaseTest, MaxAvailableStreams) { | 310 TEST_P(QuicServerSessionBaseTest, MaxAvailableStreams) { |
| 317 // Test that the server closes the connection if a client makes too many data | 311 // Test that the server closes the connection if a client makes too many data |
| 318 // streams available. The server accepts slightly more than the negotiated | 312 // streams available. The server accepts slightly more than the negotiated |
| 319 // stream limit to deal with rare cases where a client FIN/RST is lost. | 313 // stream limit to deal with rare cases where a client FIN/RST is lost. |
| 320 | 314 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 EXPECT_FALSE( | 557 EXPECT_FALSE( |
| 564 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); | 558 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); |
| 565 session_->OnConfigNegotiated(); | 559 session_->OnConfigNegotiated(); |
| 566 EXPECT_FALSE( | 560 EXPECT_FALSE( |
| 567 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); | 561 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); |
| 568 } | 562 } |
| 569 | 563 |
| 570 } // namespace | 564 } // namespace |
| 571 } // namespace test | 565 } // namespace test |
| 572 } // namespace net | 566 } // namespace net |
| OLD | NEW |