| 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/core/quic_session.h" | 5 #include "net/quic/core/quic_session.h" |
| 6 | 6 |
| 7 #include <cstdint> | 7 #include <cstdint> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 QuicConsumedData SendLargeFakeData(QuicStream* stream, int bytes) { | 221 QuicConsumedData SendLargeFakeData(QuicStream* stream, int bytes) { |
| 222 DCHECK(writev_consumes_all_data_); | 222 DCHECK(writev_consumes_all_data_); |
| 223 struct iovec iov; | 223 struct iovec iov; |
| 224 iov.iov_base = nullptr; // should not be read. | 224 iov.iov_base = nullptr; // should not be read. |
| 225 iov.iov_len = static_cast<size_t>(bytes); | 225 iov.iov_len = static_cast<size_t>(bytes); |
| 226 return WritevData(stream, stream->id(), QuicIOVector(&iov, 1, bytes), 0, | 226 return WritevData(stream, stream->id(), QuicIOVector(&iov, 1, bytes), 0, |
| 227 FIN, nullptr); | 227 FIN, nullptr); |
| 228 } | 228 } |
| 229 | 229 |
| 230 using QuicSession::PostProcessAfterData; | 230 using QuicSession::PostProcessAfterData; |
| 231 using QuicSession::closed_streams; |
| 232 using QuicSession::zombie_streams; |
| 231 | 233 |
| 232 private: | 234 private: |
| 233 StrictMock<TestCryptoStream> crypto_stream_; | 235 StrictMock<TestCryptoStream> crypto_stream_; |
| 234 | 236 |
| 235 bool writev_consumes_all_data_; | 237 bool writev_consumes_all_data_; |
| 236 }; | 238 }; |
| 237 | 239 |
| 238 class QuicSessionTestBase : public QuicTestWithParam<QuicVersion> { | 240 class QuicSessionTestBase : public QuicTestWithParam<QuicVersion> { |
| 239 protected: | 241 protected: |
| 240 explicit QuicSessionTestBase(Perspective perspective) | 242 explicit QuicSessionTestBase(Perspective perspective) |
| (...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1339 TEST_P(QuicSessionTestClient, EnableFHOLThroughConfigOption) { | 1341 TEST_P(QuicSessionTestClient, EnableFHOLThroughConfigOption) { |
| 1340 session_.config()->SetForceHolBlocking(); | 1342 session_.config()->SetForceHolBlocking(); |
| 1341 session_.OnConfigNegotiated(); | 1343 session_.OnConfigNegotiated(); |
| 1342 if (version() != QUIC_VERSION_36) { | 1344 if (version() != QUIC_VERSION_36) { |
| 1343 EXPECT_FALSE(session_.force_hol_blocking()); | 1345 EXPECT_FALSE(session_.force_hol_blocking()); |
| 1344 } else { | 1346 } else { |
| 1345 EXPECT_TRUE(session_.force_hol_blocking()); | 1347 EXPECT_TRUE(session_.force_hol_blocking()); |
| 1346 } | 1348 } |
| 1347 } | 1349 } |
| 1348 | 1350 |
| 1351 TEST_P(QuicSessionTestServer, ZombieStreams) { |
| 1352 if (!session_.use_stream_notifier()) { |
| 1353 return; |
| 1354 } |
| 1355 TestStream* stream2 = session_.CreateOutgoingDynamicStream(kDefaultPriority); |
| 1356 QuicStreamPeer::SetStreamBytesWritten(3, stream2); |
| 1357 EXPECT_TRUE(stream2->IsWaitingForAcks()); |
| 1358 |
| 1359 EXPECT_CALL(*connection_, SendRstStream(2, _, _)); |
| 1360 session_.CloseStream(2); |
| 1361 EXPECT_TRUE(QuicContainsKey(session_.zombie_streams(), 2)); |
| 1362 EXPECT_TRUE(session_.closed_streams()->empty()); |
| 1363 session_.OnStreamDoneWaitingForAcks(2); |
| 1364 EXPECT_FALSE(QuicContainsKey(session_.zombie_streams(), 2)); |
| 1365 EXPECT_EQ(1u, session_.closed_streams()->size()); |
| 1366 EXPECT_EQ(2u, session_.closed_streams()->front()->id()); |
| 1367 } |
| 1368 |
| 1349 } // namespace | 1369 } // namespace |
| 1350 } // namespace test | 1370 } // namespace test |
| 1351 } // namespace net | 1371 } // namespace net |
| OLD | NEW |