| 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 "net/quic/quic_session.h" | 5 #include "net/quic/quic_session.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 } | 118 } |
| 119 | 119 |
| 120 private: | 120 private: |
| 121 QuicSession* const session_; | 121 QuicSession* const session_; |
| 122 const QuicStreamId stream_id_; | 122 const QuicStreamId stream_id_; |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 class TestSession : public QuicSession { | 125 class TestSession : public QuicSession { |
| 126 public: | 126 public: |
| 127 explicit TestSession(QuicConnection* connection) | 127 explicit TestSession(QuicConnection* connection) |
| 128 : QuicSession(connection, | 128 : QuicSession(connection, DefaultQuicConfig()), |
| 129 DefaultQuicConfig(), | |
| 130 false), | |
| 131 crypto_stream_(this), | 129 crypto_stream_(this), |
| 132 writev_consumes_all_data_(false) { | 130 writev_consumes_all_data_(false) { |
| 133 InitializeSession(); | 131 InitializeSession(); |
| 134 } | 132 } |
| 135 | 133 |
| 136 virtual TestCryptoStream* GetCryptoStream() override { | 134 virtual TestCryptoStream* GetCryptoStream() override { |
| 137 return &crypto_stream_; | 135 return &crypto_stream_; |
| 138 } | 136 } |
| 139 | 137 |
| 140 virtual TestStream* CreateOutgoingDataStream() override { | 138 virtual TestStream* CreateOutgoingDataStream() override { |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 | 571 |
| 574 TEST_P(QuicSessionTest, DoNotSendGoAwayTwice) { | 572 TEST_P(QuicSessionTest, DoNotSendGoAwayTwice) { |
| 575 EXPECT_CALL(*connection_, | 573 EXPECT_CALL(*connection_, |
| 576 SendGoAway(QUIC_PEER_GOING_AWAY, 0u, "Going Away.")).Times(1); | 574 SendGoAway(QUIC_PEER_GOING_AWAY, 0u, "Going Away.")).Times(1); |
| 577 session_.SendGoAway(QUIC_PEER_GOING_AWAY, "Going Away."); | 575 session_.SendGoAway(QUIC_PEER_GOING_AWAY, "Going Away."); |
| 578 EXPECT_TRUE(session_.goaway_sent()); | 576 EXPECT_TRUE(session_.goaway_sent()); |
| 579 session_.SendGoAway(QUIC_PEER_GOING_AWAY, "Going Away."); | 577 session_.SendGoAway(QUIC_PEER_GOING_AWAY, "Going Away."); |
| 580 } | 578 } |
| 581 | 579 |
| 582 TEST_P(QuicSessionTest, IncreasedTimeoutAfterCryptoHandshake) { | 580 TEST_P(QuicSessionTest, IncreasedTimeoutAfterCryptoHandshake) { |
| 583 EXPECT_EQ((FLAGS_quic_unified_timeouts ? | 581 EXPECT_EQ(kInitialIdleTimeoutSecs + 3, |
| 584 kInitialIdleTimeoutSecs : kDefaultIdleTimeoutSecs) + 3, | |
| 585 QuicConnectionPeer::GetNetworkTimeout(connection_).ToSeconds()); | 582 QuicConnectionPeer::GetNetworkTimeout(connection_).ToSeconds()); |
| 586 CryptoHandshakeMessage msg; | 583 CryptoHandshakeMessage msg; |
| 587 session_.GetCryptoStream()->OnHandshakeMessage(msg); | 584 session_.GetCryptoStream()->OnHandshakeMessage(msg); |
| 588 EXPECT_EQ(kMaximumIdleTimeoutSecs + 3, | 585 EXPECT_EQ(kMaximumIdleTimeoutSecs + 3, |
| 589 QuicConnectionPeer::GetNetworkTimeout(connection_).ToSeconds()); | 586 QuicConnectionPeer::GetNetworkTimeout(connection_).ToSeconds()); |
| 590 } | 587 } |
| 591 | 588 |
| 592 TEST_P(QuicSessionTest, RstStreamBeforeHeadersDecompressed) { | 589 TEST_P(QuicSessionTest, RstStreamBeforeHeadersDecompressed) { |
| 593 // Send two bytes of payload. | 590 // Send two bytes of payload. |
| 594 QuicStreamFrame data1(kClientDataStreamId1, false, 0, MakeIOVector("HT")); | 591 QuicStreamFrame data1(kClientDataStreamId1, false, 0, MakeIOVector("HT")); |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 } | 1016 } |
| 1020 | 1017 |
| 1021 // Called after any new data is received by the session, and triggers the call | 1018 // Called after any new data is received by the session, and triggers the call |
| 1022 // to close the connection. | 1019 // to close the connection. |
| 1023 session_.PostProcessAfterData(); | 1020 session_.PostProcessAfterData(); |
| 1024 } | 1021 } |
| 1025 | 1022 |
| 1026 } // namespace | 1023 } // namespace |
| 1027 } // namespace test | 1024 } // namespace test |
| 1028 } // namespace net | 1025 } // namespace net |
| OLD | NEW |