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 <algorithm> | 7 #include <algorithm> |
8 #include <cstdint> | 8 #include <cstdint> |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 } | 559 } |
560 | 560 |
561 TEST_F(QuicStreamSequencerTest, DontAcceptOverlappingFrames) { | 561 TEST_F(QuicStreamSequencerTest, DontAcceptOverlappingFrames) { |
562 // The peer should never send us non-identical stream frames which contain | 562 // The peer should never send us non-identical stream frames which contain |
563 // overlapping byte ranges - if they do, we close the connection. | 563 // overlapping byte ranges - if they do, we close the connection. |
564 | 564 |
565 QuicStreamFrame frame1(kClientDataStreamId1, false, 1, StringPiece("hello")); | 565 QuicStreamFrame frame1(kClientDataStreamId1, false, 1, StringPiece("hello")); |
566 sequencer_->OnStreamFrame(frame1); | 566 sequencer_->OnStreamFrame(frame1); |
567 | 567 |
568 QuicStreamFrame frame2(kClientDataStreamId1, false, 2, StringPiece("hello")); | 568 QuicStreamFrame frame2(kClientDataStreamId1, false, 2, StringPiece("hello")); |
569 EXPECT_CALL(stream_, CloseConnectionWithDetails( | 569 EXPECT_CALL(stream_, |
570 FLAGS_quic_consolidate_onstreamframe_errors | 570 CloseConnectionWithDetails(QUIC_OVERLAPPING_STREAM_DATA, _)) |
571 ? QUIC_OVERLAPPING_STREAM_DATA | |
572 : QUIC_EMPTY_STREAM_FRAME_NO_FIN, | |
573 _)) | |
574 .Times(1); | 571 .Times(1); |
575 sequencer_->OnStreamFrame(frame2); | 572 sequencer_->OnStreamFrame(frame2); |
576 } | 573 } |
577 | 574 |
578 TEST_F(QuicStreamSequencerTest, InOrderTimestamps) { | 575 TEST_F(QuicStreamSequencerTest, InOrderTimestamps) { |
579 // This test verifies that timestamps returned by | 576 // This test verifies that timestamps returned by |
580 // GetReadableRegion() are in the correct sequence when frames | 577 // GetReadableRegion() are in the correct sequence when frames |
581 // arrive at the sequencer in order. | 578 // arrive at the sequencer in order. |
582 EXPECT_CALL(stream_, OnDataAvailable()); | 579 EXPECT_CALL(stream_, OnDataAvailable()); |
583 | 580 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 EXPECT_EQ(timestamp, t1); | 650 EXPECT_EQ(timestamp, t1); |
654 QuicStreamSequencerTest::ConsumeData(3); | 651 QuicStreamSequencerTest::ConsumeData(3); |
655 EXPECT_EQ(0u, NumBufferedBytes()); | 652 EXPECT_EQ(0u, NumBufferedBytes()); |
656 EXPECT_EQ(6u, sequencer_->NumBytesConsumed()); | 653 EXPECT_EQ(6u, sequencer_->NumBytesConsumed()); |
657 EXPECT_EQ(0u, sequencer_->NumBytesBuffered()); | 654 EXPECT_EQ(0u, sequencer_->NumBytesBuffered()); |
658 } | 655 } |
659 | 656 |
660 } // namespace | 657 } // namespace |
661 } // namespace test | 658 } // namespace test |
662 } // namespace net | 659 } // namespace net |
OLD | NEW |