| 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/core/quic_server_session_base.h" | 5 #include "net/quic/core/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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 arg->min_rtt_ms() == reference.min_rtt_ms() && | 178 arg->min_rtt_ms() == reference.min_rtt_ms() && |
| 179 arg->previous_connection_state() == | 179 arg->previous_connection_state() == |
| 180 reference.previous_connection_state()); | 180 reference.previous_connection_state()); |
| 181 } | 181 } |
| 182 | 182 |
| 183 INSTANTIATE_TEST_CASE_P(Tests, | 183 INSTANTIATE_TEST_CASE_P(Tests, |
| 184 QuicServerSessionBaseTest, | 184 QuicServerSessionBaseTest, |
| 185 ::testing::ValuesIn(AllSupportedVersions())); | 185 ::testing::ValuesIn(AllSupportedVersions())); |
| 186 | 186 |
| 187 TEST_P(QuicServerSessionBaseTest, ServerPushDisabledByDefault) { | 187 TEST_P(QuicServerSessionBaseTest, ServerPushDisabledByDefault) { |
| 188 FLAGS_quic_enable_server_push_by_default = true; |
| 188 // Without the client explicitly sending kSPSH, server push will be disabled | 189 // Without the client explicitly sending kSPSH, server push will be disabled |
| 189 // at the server. | 190 // at the server, until version 35 when it is enabled by default. |
| 190 EXPECT_FALSE( | 191 EXPECT_FALSE( |
| 191 session_->config()->HasReceivedConnectionOptions() && | 192 session_->config()->HasReceivedConnectionOptions() && |
| 192 ContainsQuicTag(session_->config()->ReceivedConnectionOptions(), kSPSH)); | 193 ContainsQuicTag(session_->config()->ReceivedConnectionOptions(), kSPSH)); |
| 193 session_->OnConfigNegotiated(); | 194 session_->OnConfigNegotiated(); |
| 194 EXPECT_FALSE(session_->server_push_enabled()); | 195 if (GetParam() <= QUIC_VERSION_34) { |
| 196 EXPECT_FALSE(session_->server_push_enabled()); |
| 197 } else { |
| 198 EXPECT_TRUE(session_->server_push_enabled()); |
| 199 } |
| 195 } | 200 } |
| 196 | 201 |
| 197 TEST_P(QuicServerSessionBaseTest, CloseStreamDueToReset) { | 202 TEST_P(QuicServerSessionBaseTest, CloseStreamDueToReset) { |
| 198 // Open a stream, then reset it. | 203 // Open a stream, then reset it. |
| 199 // Send two bytes of payload to open it. | 204 // Send two bytes of payload to open it. |
| 200 QuicStreamFrame data1(kClientDataStreamId1, false, 0, StringPiece("HT")); | 205 QuicStreamFrame data1(kClientDataStreamId1, false, 0, StringPiece("HT")); |
| 201 session_->OnStreamFrame(data1); | 206 session_->OnStreamFrame(data1); |
| 202 EXPECT_EQ(1u, session_->GetNumOpenIncomingStreams()); | 207 EXPECT_EQ(1u, session_->GetNumOpenIncomingStreams()); |
| 203 | 208 |
| 204 // Send a reset (and expect the peer to send a RST in response). | 209 // Send a reset (and expect the peer to send a RST in response). |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 | 340 |
| 336 // A further available stream will result in connection close. | 341 // A further available stream will result in connection close. |
| 337 EXPECT_CALL(*connection_, | 342 EXPECT_CALL(*connection_, |
| 338 CloseConnection(QUIC_TOO_MANY_AVAILABLE_STREAMS, _, _)); | 343 CloseConnection(QUIC_TOO_MANY_AVAILABLE_STREAMS, _, _)); |
| 339 // This forces stream kLimitingStreamId + 2 to become available, which | 344 // This forces stream kLimitingStreamId + 2 to become available, which |
| 340 // violates the quota. | 345 // violates the quota. |
| 341 EXPECT_FALSE(QuicServerSessionBasePeer::GetOrCreateDynamicStream( | 346 EXPECT_FALSE(QuicServerSessionBasePeer::GetOrCreateDynamicStream( |
| 342 session_.get(), kLimitingStreamId + 4)); | 347 session_.get(), kLimitingStreamId + 4)); |
| 343 } | 348 } |
| 344 | 349 |
| 350 // TODO(ckrasic): remove this when |
| 351 // FLAGS_quic_enable_server_push_by_default is |
| 352 // deprecated. |
| 345 TEST_P(QuicServerSessionBaseTest, EnableServerPushThroughConnectionOption) { | 353 TEST_P(QuicServerSessionBaseTest, EnableServerPushThroughConnectionOption) { |
| 354 FLAGS_quic_enable_server_push_by_default = false; |
| 346 // Assume server received server push connection option. | 355 // Assume server received server push connection option. |
| 347 QuicTagVector copt; | 356 QuicTagVector copt; |
| 348 copt.push_back(kSPSH); | 357 copt.push_back(kSPSH); |
| 349 QuicConfigPeer::SetReceivedConnectionOptions(session_->config(), copt); | 358 QuicConfigPeer::SetReceivedConnectionOptions(session_->config(), copt); |
| 350 session_->OnConfigNegotiated(); | 359 session_->OnConfigNegotiated(); |
| 351 EXPECT_TRUE(session_->server_push_enabled()); | 360 EXPECT_TRUE(session_->server_push_enabled()); |
| 352 } | 361 } |
| 353 | 362 |
| 354 TEST_P(QuicServerSessionBaseTest, GetEvenIncomingError) { | 363 TEST_P(QuicServerSessionBaseTest, GetEvenIncomingError) { |
| 355 // Incoming streams on the server session must be odd. | 364 // Incoming streams on the server session must be odd. |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 EXPECT_FALSE( | 567 EXPECT_FALSE( |
| 559 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); | 568 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); |
| 560 session_->OnConfigNegotiated(); | 569 session_->OnConfigNegotiated(); |
| 561 EXPECT_FALSE( | 570 EXPECT_FALSE( |
| 562 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); | 571 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); |
| 563 } | 572 } |
| 564 | 573 |
| 565 } // namespace | 574 } // namespace |
| 566 } // namespace test | 575 } // namespace test |
| 567 } // namespace net | 576 } // namespace net |
| OLD | NEW |