| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 const QuicPriority kHighestPriority = 0; | 48 const QuicPriority kHighestPriority = 0; |
| 49 const QuicPriority kSomeMiddlePriority = 3; | 49 const QuicPriority kSomeMiddlePriority = 3; |
| 50 | 50 |
| 51 class TestCryptoStream : public QuicCryptoStream { | 51 class TestCryptoStream : public QuicCryptoStream { |
| 52 public: | 52 public: |
| 53 explicit TestCryptoStream(QuicSession* session) | 53 explicit TestCryptoStream(QuicSession* session) |
| 54 : QuicCryptoStream(session) { | 54 : QuicCryptoStream(session) { |
| 55 } | 55 } |
| 56 | 56 |
| 57 virtual void OnHandshakeMessage( | 57 void OnHandshakeMessage(const CryptoHandshakeMessage& message) override { |
| 58 const CryptoHandshakeMessage& message) override { | |
| 59 encryption_established_ = true; | 58 encryption_established_ = true; |
| 60 handshake_confirmed_ = true; | 59 handshake_confirmed_ = true; |
| 61 CryptoHandshakeMessage msg; | 60 CryptoHandshakeMessage msg; |
| 62 string error_details; | 61 string error_details; |
| 63 session()->config()->SetInitialFlowControlWindowToSend( | 62 session()->config()->SetInitialFlowControlWindowToSend( |
| 64 kInitialSessionFlowControlWindowForTest); | 63 kInitialSessionFlowControlWindowForTest); |
| 65 session()->config()->SetInitialStreamFlowControlWindowToSend( | 64 session()->config()->SetInitialStreamFlowControlWindowToSend( |
| 66 kInitialStreamFlowControlWindowForTest); | 65 kInitialStreamFlowControlWindowForTest); |
| 67 session()->config()->SetInitialSessionFlowControlWindowToSend( | 66 session()->config()->SetInitialSessionFlowControlWindowToSend( |
| 68 kInitialSessionFlowControlWindowForTest); | 67 kInitialSessionFlowControlWindowForTest); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 87 }; | 86 }; |
| 88 | 87 |
| 89 class TestStream : public QuicDataStream { | 88 class TestStream : public QuicDataStream { |
| 90 public: | 89 public: |
| 91 TestStream(QuicStreamId id, QuicSession* session) | 90 TestStream(QuicStreamId id, QuicSession* session) |
| 92 : QuicDataStream(id, session) { | 91 : QuicDataStream(id, session) { |
| 93 } | 92 } |
| 94 | 93 |
| 95 using ReliableQuicStream::CloseWriteSide; | 94 using ReliableQuicStream::CloseWriteSide; |
| 96 | 95 |
| 97 virtual uint32 ProcessData(const char* data, uint32 data_len) override { | 96 uint32 ProcessData(const char* data, uint32 data_len) override { |
| 98 return data_len; | 97 return data_len; |
| 99 } | 98 } |
| 100 | 99 |
| 101 void SendBody(const string& data, bool fin) { | 100 void SendBody(const string& data, bool fin) { |
| 102 WriteOrBufferData(data, fin, nullptr); | 101 WriteOrBufferData(data, fin, nullptr); |
| 103 } | 102 } |
| 104 | 103 |
| 105 MOCK_METHOD0(OnCanWrite, void()); | 104 MOCK_METHOD0(OnCanWrite, void()); |
| 106 }; | 105 }; |
| 107 | 106 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 124 | 123 |
| 125 class TestSession : public QuicSession { | 124 class TestSession : public QuicSession { |
| 126 public: | 125 public: |
| 127 explicit TestSession(QuicConnection* connection) | 126 explicit TestSession(QuicConnection* connection) |
| 128 : QuicSession(connection, DefaultQuicConfig()), | 127 : QuicSession(connection, DefaultQuicConfig()), |
| 129 crypto_stream_(this), | 128 crypto_stream_(this), |
| 130 writev_consumes_all_data_(false) { | 129 writev_consumes_all_data_(false) { |
| 131 InitializeSession(); | 130 InitializeSession(); |
| 132 } | 131 } |
| 133 | 132 |
| 134 virtual TestCryptoStream* GetCryptoStream() override { | 133 TestCryptoStream* GetCryptoStream() override { return &crypto_stream_; } |
| 135 return &crypto_stream_; | |
| 136 } | |
| 137 | 134 |
| 138 virtual TestStream* CreateOutgoingDataStream() override { | 135 TestStream* CreateOutgoingDataStream() override { |
| 139 TestStream* stream = new TestStream(GetNextStreamId(), this); | 136 TestStream* stream = new TestStream(GetNextStreamId(), this); |
| 140 ActivateStream(stream); | 137 ActivateStream(stream); |
| 141 return stream; | 138 return stream; |
| 142 } | 139 } |
| 143 | 140 |
| 144 virtual TestStream* CreateIncomingDataStream(QuicStreamId id) override { | 141 TestStream* CreateIncomingDataStream(QuicStreamId id) override { |
| 145 return new TestStream(id, this); | 142 return new TestStream(id, this); |
| 146 } | 143 } |
| 147 | 144 |
| 148 bool IsClosedStream(QuicStreamId id) { | 145 bool IsClosedStream(QuicStreamId id) { |
| 149 return QuicSession::IsClosedStream(id); | 146 return QuicSession::IsClosedStream(id); |
| 150 } | 147 } |
| 151 | 148 |
| 152 QuicDataStream* GetIncomingDataStream(QuicStreamId stream_id) { | 149 QuicDataStream* GetIncomingDataStream(QuicStreamId stream_id) { |
| 153 return QuicSession::GetIncomingDataStream(stream_id); | 150 return QuicSession::GetIncomingDataStream(stream_id); |
| 154 } | 151 } |
| 155 | 152 |
| 156 virtual QuicConsumedData WritevData( | 153 QuicConsumedData WritevData( |
| 157 QuicStreamId id, | 154 QuicStreamId id, |
| 158 const IOVector& data, | 155 const IOVector& data, |
| 159 QuicStreamOffset offset, | 156 QuicStreamOffset offset, |
| 160 bool fin, | 157 bool fin, |
| 161 FecProtection fec_protection, | 158 FecProtection fec_protection, |
| 162 QuicAckNotifier::DelegateInterface* ack_notifier_delegate) override { | 159 QuicAckNotifier::DelegateInterface* ack_notifier_delegate) override { |
| 163 // Always consumes everything. | 160 // Always consumes everything. |
| 164 if (writev_consumes_all_data_) { | 161 if (writev_consumes_all_data_) { |
| 165 return QuicConsumedData(data.TotalBufferSize(), fin); | 162 return QuicConsumedData(data.TotalBufferSize(), fin); |
| 166 } else { | 163 } else { |
| (...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 } | 1013 } |
| 1017 | 1014 |
| 1018 // Called after any new data is received by the session, and triggers the call | 1015 // Called after any new data is received by the session, and triggers the call |
| 1019 // to close the connection. | 1016 // to close the connection. |
| 1020 session_.PostProcessAfterData(); | 1017 session_.PostProcessAfterData(); |
| 1021 } | 1018 } |
| 1022 | 1019 |
| 1023 } // namespace | 1020 } // namespace |
| 1024 } // namespace test | 1021 } // namespace test |
| 1025 } // namespace net | 1022 } // namespace net |
| OLD | NEW |