| 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 | 8 |
| 9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
| 10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 148 |
| 149 ReliableQuicStream* GetOrCreateDynamicStream(QuicStreamId stream_id) { | 149 ReliableQuicStream* GetOrCreateDynamicStream(QuicStreamId stream_id) { |
| 150 return QuicSpdySession::GetOrCreateDynamicStream(stream_id); | 150 return QuicSpdySession::GetOrCreateDynamicStream(stream_id); |
| 151 } | 151 } |
| 152 | 152 |
| 153 QuicConsumedData WritevData( | 153 QuicConsumedData WritevData( |
| 154 QuicStreamId id, | 154 QuicStreamId id, |
| 155 QuicIOVector data, | 155 QuicIOVector data, |
| 156 QuicStreamOffset offset, | 156 QuicStreamOffset offset, |
| 157 bool fin, | 157 bool fin, |
| 158 FecProtection fec_protection, | |
| 159 QuicAckListenerInterface* ack_notifier_delegate) override { | 158 QuicAckListenerInterface* ack_notifier_delegate) override { |
| 160 QuicConsumedData consumed(data.total_length, fin); | 159 QuicConsumedData consumed(data.total_length, fin); |
| 161 if (!writev_consumes_all_data_) { | 160 if (!writev_consumes_all_data_) { |
| 162 consumed = QuicSession::WritevData(id, data, offset, fin, fec_protection, | 161 consumed = |
| 163 ack_notifier_delegate); | 162 QuicSession::WritevData(id, data, offset, fin, ack_notifier_delegate); |
| 164 } | 163 } |
| 165 QuicSessionPeer::GetWriteBlockedStreams(this)->UpdateBytesForStream( | 164 QuicSessionPeer::GetWriteBlockedStreams(this)->UpdateBytesForStream( |
| 166 id, consumed.bytes_consumed); | 165 id, consumed.bytes_consumed); |
| 167 return consumed; | 166 return consumed; |
| 168 } | 167 } |
| 169 | 168 |
| 170 void set_writev_consumes_all_data(bool val) { | 169 void set_writev_consumes_all_data(bool val) { |
| 171 writev_consumes_all_data_ = val; | 170 writev_consumes_all_data_ = val; |
| 172 } | 171 } |
| 173 | 172 |
| 174 QuicConsumedData SendStreamData(QuicStreamId id) { | 173 QuicConsumedData SendStreamData(QuicStreamId id) { |
| 175 struct iovec iov; | 174 struct iovec iov; |
| 176 return WritevData(id, MakeIOVector("not empty", &iov), 0, true, | 175 return WritevData(id, MakeIOVector("not empty", &iov), 0, true, nullptr); |
| 177 MAY_FEC_PROTECT, nullptr); | |
| 178 } | 176 } |
| 179 | 177 |
| 180 QuicConsumedData SendLargeFakeData(QuicStreamId id, int bytes) { | 178 QuicConsumedData SendLargeFakeData(QuicStreamId id, int bytes) { |
| 181 DCHECK(writev_consumes_all_data_); | 179 DCHECK(writev_consumes_all_data_); |
| 182 struct iovec iov; | 180 struct iovec iov; |
| 183 iov.iov_base = nullptr; // should not be read. | 181 iov.iov_base = nullptr; // should not be read. |
| 184 iov.iov_len = static_cast<size_t>(bytes); | 182 iov.iov_len = static_cast<size_t>(bytes); |
| 185 return WritevData(id, QuicIOVector(&iov, 1, bytes), 0, true, | 183 return WritevData(id, QuicIOVector(&iov, 1, bytes), 0, true, nullptr); |
| 186 MAY_FEC_PROTECT, nullptr); | |
| 187 } | 184 } |
| 188 | 185 |
| 189 using QuicSession::PostProcessAfterData; | 186 using QuicSession::PostProcessAfterData; |
| 190 | 187 |
| 191 private: | 188 private: |
| 192 StrictMock<TestCryptoStream> crypto_stream_; | 189 StrictMock<TestCryptoStream> crypto_stream_; |
| 193 | 190 |
| 194 bool writev_consumes_all_data_; | 191 bool writev_consumes_all_data_; |
| 195 }; | 192 }; |
| 196 | 193 |
| (...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1199 session_.max_open_incoming_streams()); | 1196 session_.max_open_incoming_streams()); |
| 1200 } | 1197 } |
| 1201 | 1198 |
| 1202 EXPECT_EQ(session_.max_open_outgoing_streams(), | 1199 EXPECT_EQ(session_.max_open_outgoing_streams(), |
| 1203 kDefaultMaxStreamsPerConnection); | 1200 kDefaultMaxStreamsPerConnection); |
| 1204 } | 1201 } |
| 1205 | 1202 |
| 1206 } // namespace | 1203 } // namespace |
| 1207 } // namespace test | 1204 } // namespace test |
| 1208 } // namespace net | 1205 } // namespace net |
| OLD | NEW |