| 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/tools/quic/quic_server_session_base.h" | 5 #include "net/tools/quic/quic_server_session_base.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "net/quic/crypto/quic_crypto_server_config.h" | 8 #include "net/quic/crypto/quic_crypto_server_config.h" |
| 9 #include "net/quic/crypto/quic_random.h" | 9 #include "net/quic/crypto/quic_random.h" |
| 10 #include "net/quic/proto/cached_network_parameters.pb.h" | 10 #include "net/quic/proto/cached_network_parameters.pb.h" |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 } | 320 } |
| 321 | 321 |
| 322 TEST_P(QuicServerSessionBaseTest, GetStreamDisconnected) { | 322 TEST_P(QuicServerSessionBaseTest, GetStreamDisconnected) { |
| 323 // Don't create new streams if the connection is disconnected. | 323 // Don't create new streams if the connection is disconnected. |
| 324 QuicConnectionPeer::CloseConnection(connection_); | 324 QuicConnectionPeer::CloseConnection(connection_); |
| 325 EXPECT_DFATAL( | 325 EXPECT_DFATAL( |
| 326 QuicServerSessionBasePeer::GetOrCreateDynamicStream(session_.get(), 5), | 326 QuicServerSessionBasePeer::GetOrCreateDynamicStream(session_.get(), 5), |
| 327 "ShouldCreateIncomingDynamicStream called when disconnected"); | 327 "ShouldCreateIncomingDynamicStream called when disconnected"); |
| 328 } | 328 } |
| 329 | 329 |
| 330 TEST_P(QuicServerSessionBaseTest, SetFecProtectionFromConfig) { | |
| 331 ValueRestore<bool> old_flag(&FLAGS_enable_quic_fec, true); | |
| 332 | |
| 333 // Set received config to have FEC connection option. | |
| 334 QuicTagVector copt; | |
| 335 copt.push_back(kFHDR); | |
| 336 QuicConfigPeer::SetReceivedConnectionOptions(session_->config(), copt); | |
| 337 session_->OnConfigNegotiated(); | |
| 338 | |
| 339 // Verify that headers stream is always protected and data streams are | |
| 340 // optionally protected. | |
| 341 EXPECT_EQ( | |
| 342 FEC_PROTECT_ALWAYS, | |
| 343 QuicSpdySessionPeer::GetHeadersStream(session_.get())->fec_policy()); | |
| 344 ReliableQuicStream* stream = | |
| 345 QuicServerSessionBasePeer::GetOrCreateDynamicStream(session_.get(), | |
| 346 kClientDataStreamId1); | |
| 347 ASSERT_TRUE(stream); | |
| 348 EXPECT_EQ(FEC_PROTECT_OPTIONAL, stream->fec_policy()); | |
| 349 } | |
| 350 | |
| 351 class MockQuicCryptoServerStream : public QuicCryptoServerStream { | 330 class MockQuicCryptoServerStream : public QuicCryptoServerStream { |
| 352 public: | 331 public: |
| 353 explicit MockQuicCryptoServerStream( | 332 explicit MockQuicCryptoServerStream( |
| 354 const QuicCryptoServerConfig* crypto_config, | 333 const QuicCryptoServerConfig* crypto_config, |
| 355 QuicSession* session) | 334 QuicSession* session) |
| 356 : QuicCryptoServerStream(crypto_config, session) {} | 335 : QuicCryptoServerStream(crypto_config, session) {} |
| 357 ~MockQuicCryptoServerStream() override {} | 336 ~MockQuicCryptoServerStream() override {} |
| 358 | 337 |
| 359 MOCK_METHOD1(SendServerConfigUpdate, | 338 MOCK_METHOD1(SendServerConfigUpdate, |
| 360 void(const CachedNetworkParameters* cached_network_parameters)); | 339 void(const CachedNetworkParameters* cached_network_parameters)); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 EXPECT_FALSE( | 509 EXPECT_FALSE( |
| 531 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); | 510 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); |
| 532 session_->OnConfigNegotiated(); | 511 session_->OnConfigNegotiated(); |
| 533 EXPECT_FALSE( | 512 EXPECT_FALSE( |
| 534 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); | 513 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); |
| 535 } | 514 } |
| 536 | 515 |
| 537 } // namespace | 516 } // namespace |
| 538 } // namespace test | 517 } // namespace test |
| 539 } // namespace net | 518 } // namespace net |
| OLD | NEW |