| 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_stream_sequencer.h" | 5 #include "net/quic/core/quic_stream_sequencer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cstdint> | 8 #include <cstdint> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 OnFrame(9, "jklmnopqrstuvwxyz"); | 541 OnFrame(9, "jklmnopqrstuvwxyz"); |
| 542 | 542 |
| 543 // Peek into the data. Only the first chunk should be readable because of the | 543 // Peek into the data. Only the first chunk should be readable because of the |
| 544 // missing data. | 544 // missing data. |
| 545 vector<string> expected{"abc"}; | 545 vector<string> expected{"abc"}; |
| 546 ASSERT_TRUE(VerifyReadableRegions(expected)); | 546 ASSERT_TRUE(VerifyReadableRegions(expected)); |
| 547 | 547 |
| 548 // Now, attempt to mark consumed more data than was readable and expect the | 548 // Now, attempt to mark consumed more data than was readable and expect the |
| 549 // stream to be closed. | 549 // stream to be closed. |
| 550 EXPECT_CALL(stream_, Reset(QUIC_ERROR_PROCESSING_STREAM)); | 550 EXPECT_CALL(stream_, Reset(QUIC_ERROR_PROCESSING_STREAM)); |
| 551 EXPECT_DFATAL(sequencer_->MarkConsumed(4), | 551 EXPECT_QUIC_BUG(sequencer_->MarkConsumed(4), |
| 552 "Invalid argument to MarkConsumed." | 552 "Invalid argument to MarkConsumed." |
| 553 " expect to consume: 4, but not enough bytes available."); | 553 " expect to consume: 4, but not enough bytes available."); |
| 554 } | 554 } |
| 555 | 555 |
| 556 TEST_F(QuicStreamSequencerTest, MarkConsumedWithMissingPacket) { | 556 TEST_F(QuicStreamSequencerTest, MarkConsumedWithMissingPacket) { |
| 557 InSequence s; | 557 InSequence s; |
| 558 EXPECT_CALL(stream_, OnDataAvailable()); | 558 EXPECT_CALL(stream_, OnDataAvailable()); |
| 559 | 559 |
| 560 OnFrame(0, "abc"); | 560 OnFrame(0, "abc"); |
| 561 OnFrame(3, "def"); | 561 OnFrame(3, "def"); |
| 562 // Missing packet: 6, ghi. | 562 // Missing packet: 6, ghi. |
| 563 OnFrame(9, "jkl"); | 563 OnFrame(9, "jkl"); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 EXPECT_EQ(timestamp, t1); | 660 EXPECT_EQ(timestamp, t1); |
| 661 QuicStreamSequencerTest::ConsumeData(3); | 661 QuicStreamSequencerTest::ConsumeData(3); |
| 662 EXPECT_EQ(0u, NumBufferedBytes()); | 662 EXPECT_EQ(0u, NumBufferedBytes()); |
| 663 EXPECT_EQ(6u, sequencer_->NumBytesConsumed()); | 663 EXPECT_EQ(6u, sequencer_->NumBytesConsumed()); |
| 664 EXPECT_EQ(0u, sequencer_->NumBytesBuffered()); | 664 EXPECT_EQ(0u, sequencer_->NumBytesBuffered()); |
| 665 } | 665 } |
| 666 | 666 |
| 667 } // namespace | 667 } // namespace |
| 668 } // namespace test | 668 } // namespace test |
| 669 } // namespace net | 669 } // namespace net |
| OLD | NEW |