Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(320)

Side by Side Diff: net/quic/core/quic_stream_sequencer_test.cc

Issue 2430973004: Landing Recent QUIC changes until 10:38 AM, Oct 17, 2016 UTC-4 (Closed)
Patch Set: Improving flagsaver logging Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/core/quic_stream_sequencer_buffer_test.cc ('k') | net/quic/core/quic_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 EXPECT_EQ(3u, sequencer_->NumBytesBuffered()); 655 EXPECT_EQ(3u, sequencer_->NumBytesBuffered());
656 656
657 EXPECT_TRUE(sequencer_->GetReadableRegion(iovecs, &timestamp)); 657 EXPECT_TRUE(sequencer_->GetReadableRegion(iovecs, &timestamp));
658 EXPECT_EQ(timestamp, t1); 658 EXPECT_EQ(timestamp, t1);
659 QuicStreamSequencerTest::ConsumeData(3); 659 QuicStreamSequencerTest::ConsumeData(3);
660 EXPECT_EQ(0u, NumBufferedBytes()); 660 EXPECT_EQ(0u, NumBufferedBytes());
661 EXPECT_EQ(6u, sequencer_->NumBytesConsumed()); 661 EXPECT_EQ(6u, sequencer_->NumBytesConsumed());
662 EXPECT_EQ(0u, sequencer_->NumBytesBuffered()); 662 EXPECT_EQ(0u, sequencer_->NumBytesBuffered());
663 } 663 }
664 664
665 // TODO(danzh): Figure out the way to implement this test case without the use
666 // of unsupported StringPiece constructor.
667 #if 0
665 TEST_F(QuicStreamSequencerTest, OnStreamFrameWithNullSource) { 668 TEST_F(QuicStreamSequencerTest, OnStreamFrameWithNullSource) {
666 FLAGS_quic_stream_sequencer_buffer_debug = true;
667 // Pass in a frame with data pointing to null address, expect to close 669 // Pass in a frame with data pointing to null address, expect to close
668 // connection with error. 670 // connection with error.
669 StringPiece source(nullptr, 5u); 671 StringPiece source(nullptr, 5u);
670 QuicStreamFrame frame(kClientDataStreamId1, false, 1, source); 672 QuicStreamFrame frame(kClientDataStreamId1, false, 1, source);
671 EXPECT_CALL(stream_, CloseConnectionWithDetails( 673 EXPECT_CALL(stream_, CloseConnectionWithDetails(
672 QUIC_STREAM_SEQUENCER_INVALID_STATE, _)); 674 QUIC_STREAM_SEQUENCER_INVALID_STATE, _));
673 sequencer_->OnStreamFrame(frame); 675 sequencer_->OnStreamFrame(frame);
674 } 676 }
677 #endif
675 678
676 TEST_F(QuicStreamSequencerTest, ReadvError) { 679 TEST_F(QuicStreamSequencerTest, ReadvError) {
677 FLAGS_quic_stream_sequencer_buffer_debug = true;
678 EXPECT_CALL(stream_, OnDataAvailable()); 680 EXPECT_CALL(stream_, OnDataAvailable());
679 string source(100, 'a'); 681 string source(100, 'a');
680 OnFrame(0u, source.data()); 682 OnFrame(0u, source.data());
681 EXPECT_EQ(source.length(), sequencer_->NumBytesBuffered()); 683 EXPECT_EQ(source.length(), sequencer_->NumBytesBuffered());
682 // Pass in a null iovec, expect to tear down connection. 684 // Pass in a null iovec, expect to tear down connection.
683 EXPECT_CALL(stream_, CloseConnectionWithDetails( 685 EXPECT_CALL(stream_, CloseConnectionWithDetails(
684 QUIC_STREAM_SEQUENCER_INVALID_STATE, _)); 686 QUIC_STREAM_SEQUENCER_INVALID_STATE, _));
685 iovec iov{nullptr, 512}; 687 iovec iov{nullptr, 512};
686 sequencer_->Readv(&iov, 1u); 688 sequencer_->Readv(&iov, 1u);
687 } 689 }
688 690
689 } // namespace 691 } // namespace
690 } // namespace test 692 } // namespace test
691 } // namespace net 693 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_stream_sequencer_buffer_test.cc ('k') | net/quic/core/quic_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698