| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 MOCK_METHOD0(OnCanWrite, void()); | 87 MOCK_METHOD0(OnCanWrite, void()); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 class TestStream : public QuicSpdyStream { | 90 class TestStream : public QuicSpdyStream { |
| 91 public: | 91 public: |
| 92 TestStream(QuicStreamId id, QuicSpdySession* session) | 92 TestStream(QuicStreamId id, QuicSpdySession* session) |
| 93 : QuicSpdyStream(id, session) {} | 93 : QuicSpdyStream(id, session) {} |
| 94 | 94 |
| 95 using QuicStream::CloseWriteSide; | 95 using QuicStream::CloseWriteSide; |
| 96 using QuicStream::SetIsDeletable; | |
| 97 | 96 |
| 98 void OnDataAvailable() override {} | 97 void OnDataAvailable() override {} |
| 99 | 98 |
| 100 MOCK_METHOD0(OnCanWrite, void()); | 99 MOCK_METHOD0(OnCanWrite, void()); |
| 101 }; | 100 }; |
| 102 | 101 |
| 103 // Poor man's functor for use as callback in a mock. | 102 // Poor man's functor for use as callback in a mock. |
| 104 class StreamBlocker { | 103 class StreamBlocker { |
| 105 public: | 104 public: |
| 106 StreamBlocker(QuicSession* session, QuicStreamId stream_id) | 105 StreamBlocker(QuicSession* session, QuicStreamId stream_id) |
| (...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1347 } else { | 1346 } else { |
| 1348 EXPECT_TRUE(session_.force_hol_blocking()); | 1347 EXPECT_TRUE(session_.force_hol_blocking()); |
| 1349 } | 1348 } |
| 1350 } | 1349 } |
| 1351 | 1350 |
| 1352 TEST_P(QuicSessionTestServer, ZombieStreams) { | 1351 TEST_P(QuicSessionTestServer, ZombieStreams) { |
| 1353 if (!session_.use_stream_notifier()) { | 1352 if (!session_.use_stream_notifier()) { |
| 1354 return; | 1353 return; |
| 1355 } | 1354 } |
| 1356 TestStream* stream2 = session_.CreateOutgoingDynamicStream(kDefaultPriority); | 1355 TestStream* stream2 = session_.CreateOutgoingDynamicStream(kDefaultPriority); |
| 1357 stream2->SetIsDeletable(false); | 1356 QuicStreamPeer::SetStreamBytesWritten(3, stream2); |
| 1357 EXPECT_TRUE(stream2->IsWaitingForAcks()); |
| 1358 | 1358 |
| 1359 EXPECT_CALL(*connection_, SendRstStream(2, _, _)); | 1359 EXPECT_CALL(*connection_, SendRstStream(2, _, _)); |
| 1360 session_.CloseStream(2); | 1360 session_.CloseStream(2); |
| 1361 EXPECT_TRUE(ContainsKey(session_.zombie_streams(), 2)); | 1361 EXPECT_TRUE(QuicContainsKey(session_.zombie_streams(), 2)); |
| 1362 EXPECT_TRUE(session_.closed_streams()->empty()); | 1362 EXPECT_TRUE(session_.closed_streams()->empty()); |
| 1363 stream2->SetIsDeletable(true); | 1363 session_.OnStreamDoneWaitingForAcks(2); |
| 1364 EXPECT_FALSE(ContainsKey(session_.zombie_streams(), 2)); | 1364 EXPECT_FALSE(QuicContainsKey(session_.zombie_streams(), 2)); |
| 1365 EXPECT_EQ(1u, session_.closed_streams()->size()); | 1365 EXPECT_EQ(1u, session_.closed_streams()->size()); |
| 1366 EXPECT_EQ(2u, session_.closed_streams()->front()->id()); | 1366 EXPECT_EQ(2u, session_.closed_streams()->front()->id()); |
| 1367 } | 1367 } |
| 1368 | 1368 |
| 1369 } // namespace | 1369 } // namespace |
| 1370 } // namespace test | 1370 } // namespace test |
| 1371 } // namespace net | 1371 } // namespace net |
| OLD | NEW |