| 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_stream_sequencer.h" | 5 #include "net/quic/quic_stream_sequencer.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 | 516 |
| 517 // Peek into the data. Only the first chunk should be readable because of the | 517 // Peek into the data. Only the first chunk should be readable because of the |
| 518 // missing data. | 518 // missing data. |
| 519 const char* expected[] = {"abc"}; | 519 const char* expected[] = {"abc"}; |
| 520 ASSERT_TRUE(VerifyReadableRegions(expected, arraysize(expected))); | 520 ASSERT_TRUE(VerifyReadableRegions(expected, arraysize(expected))); |
| 521 | 521 |
| 522 // Now, attempt to mark consumed more data than was readable and expect the | 522 // Now, attempt to mark consumed more data than was readable and expect the |
| 523 // stream to be closed. | 523 // stream to be closed. |
| 524 EXPECT_CALL(stream_, Reset(QUIC_ERROR_PROCESSING_STREAM)); | 524 EXPECT_CALL(stream_, Reset(QUIC_ERROR_PROCESSING_STREAM)); |
| 525 EXPECT_DFATAL(sequencer_->MarkConsumed(4), | 525 EXPECT_DFATAL(sequencer_->MarkConsumed(4), |
| 526 "Invalid argument to MarkConsumed. num_bytes_consumed_: 3 " | 526 "Invalid argument to MarkConsumed." |
| 527 "end_offset: 4 offset: 9 length: 17"); | 527 " expect to consume: 4, but not enough bytes available."); |
| 528 } | 528 } |
| 529 | 529 |
| 530 TEST_F(QuicStreamSequencerTest, MarkConsumedWithMissingPacket) { | 530 TEST_F(QuicStreamSequencerTest, MarkConsumedWithMissingPacket) { |
| 531 InSequence s; | 531 InSequence s; |
| 532 EXPECT_CALL(stream_, OnDataAvailable()); | 532 EXPECT_CALL(stream_, OnDataAvailable()); |
| 533 | 533 |
| 534 OnFrame(0, "abc"); | 534 OnFrame(0, "abc"); |
| 535 OnFrame(3, "def"); | 535 OnFrame(3, "def"); |
| 536 // Missing packet: 6, ghi. | 536 // Missing packet: 6, ghi. |
| 537 OnFrame(9, "jkl"); | 537 OnFrame(9, "jkl"); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 QuicStreamFrame frame2(kClientDataStreamId1, false, 2, StringPiece("hello")); | 591 QuicStreamFrame frame2(kClientDataStreamId1, false, 2, StringPiece("hello")); |
| 592 EXPECT_TRUE(FrameOverlapsBufferedData(frame2)); | 592 EXPECT_TRUE(FrameOverlapsBufferedData(frame2)); |
| 593 EXPECT_CALL(stream_, CloseConnectionWithDetails(QUIC_INVALID_STREAM_FRAME, _)) | 593 EXPECT_CALL(stream_, CloseConnectionWithDetails(QUIC_INVALID_STREAM_FRAME, _)) |
| 594 .Times(1); | 594 .Times(1); |
| 595 sequencer_->OnStreamFrame(frame2); | 595 sequencer_->OnStreamFrame(frame2); |
| 596 } | 596 } |
| 597 | 597 |
| 598 } // namespace | 598 } // namespace |
| 599 } // namespace test | 599 } // namespace test |
| 600 } // namespace net | 600 } // namespace net |
| OLD | NEW |