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

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

Issue 2421403002: Eliminate use of StringPiece(nullptr, n) with non zero n. This constructor is unsupported in C++17'… (Closed)
Patch Set: 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 | « no previous file | no next file » | 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 // 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
667 // connection with error. 670 // connection with error.
668 StringPiece source(nullptr, 5u); 671 StringPiece source(nullptr, 5u);
669 QuicStreamFrame frame(kClientDataStreamId1, false, 1, source); 672 QuicStreamFrame frame(kClientDataStreamId1, false, 1, source);
670 EXPECT_CALL(stream_, CloseConnectionWithDetails( 673 EXPECT_CALL(stream_, CloseConnectionWithDetails(
671 QUIC_STREAM_SEQUENCER_INVALID_STATE, _)); 674 QUIC_STREAM_SEQUENCER_INVALID_STATE, _));
672 sequencer_->OnStreamFrame(frame); 675 sequencer_->OnStreamFrame(frame);
673 } 676 }
677 #endif
674 678
675 TEST_F(QuicStreamSequencerTest, ReadvError) { 679 TEST_F(QuicStreamSequencerTest, ReadvError) {
676 EXPECT_CALL(stream_, OnDataAvailable()); 680 EXPECT_CALL(stream_, OnDataAvailable());
677 string source(100, 'a'); 681 string source(100, 'a');
678 OnFrame(0u, source.data()); 682 OnFrame(0u, source.data());
679 EXPECT_EQ(source.length(), sequencer_->NumBytesBuffered()); 683 EXPECT_EQ(source.length(), sequencer_->NumBytesBuffered());
680 // Pass in a null iovec, expect to tear down connection. 684 // Pass in a null iovec, expect to tear down connection.
681 EXPECT_CALL(stream_, CloseConnectionWithDetails( 685 EXPECT_CALL(stream_, CloseConnectionWithDetails(
682 QUIC_STREAM_SEQUENCER_INVALID_STATE, _)); 686 QUIC_STREAM_SEQUENCER_INVALID_STATE, _));
683 iovec iov{nullptr, 512}; 687 iovec iov{nullptr, 512};
684 sequencer_->Readv(&iov, 1u); 688 sequencer_->Readv(&iov, 1u);
685 } 689 }
686 690
687 } // namespace 691 } // namespace
688 } // namespace test 692 } // namespace test
689 } // namespace net 693 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698