chromium/net/third_party/quiche/src/quiche/quic/core/quic_stream_test.cc

// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "quiche/quic/core/quic_stream.h"

#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>

#include "absl/base/macros.h"
#include "absl/memory/memory.h"
#include "absl/strings/string_view.h"
#include "quiche/quic/core/crypto/null_encrypter.h"
#include "quiche/quic/core/frames/quic_connection_close_frame.h"
#include "quiche/quic/core/frames/quic_rst_stream_frame.h"
#include "quiche/quic/core/quic_connection.h"
#include "quiche/quic/core/quic_constants.h"
#include "quiche/quic/core/quic_error_codes.h"
#include "quiche/quic/core/quic_types.h"
#include "quiche/quic/core/quic_utils.h"
#include "quiche/quic/core/quic_versions.h"
#include "quiche/quic/core/quic_write_blocked_list.h"
#include "quiche/quic/platform/api/quic_expect_bug.h"
#include "quiche/quic/platform/api/quic_flags.h"
#include "quiche/quic/platform/api/quic_logging.h"
#include "quiche/quic/platform/api/quic_test.h"
#include "quiche/quic/test_tools/quic_config_peer.h"
#include "quiche/quic/test_tools/quic_connection_peer.h"
#include "quiche/quic/test_tools/quic_flow_controller_peer.h"
#include "quiche/quic/test_tools/quic_session_peer.h"
#include "quiche/quic/test_tools/quic_stream_peer.h"
#include "quiche/quic/test_tools/quic_stream_sequencer_peer.h"
#include "quiche/quic/test_tools/quic_test_utils.h"
#include "quiche/common/quiche_mem_slice_storage.h"

_;
AnyNumber;
AtLeast;
InSequence;
Invoke;
InvokeWithoutArgs;
Return;
StrictMock;

namespace quic {
namespace test {
namespace {

const char kData1[] =;
const char kData2[] =;
const QuicByteCount kDataLen =;
const uint8_t kPacket0ByteConnectionId =;
const uint8_t kPacket8ByteConnectionId =;

class TestStream : public QuicStream {};

class QuicStreamTest : public QuicTestWithParam<ParsedQuicVersion> {};

INSTANTIATE_TEST_SUITE_P();

PendingStreamTest;

INSTANTIATE_TEST_SUITE_P();

TEST_P(PendingStreamTest, PendingStreamStaticness) {}

TEST_P(PendingStreamTest, PendingStreamType) {}

TEST_P(PendingStreamTest, PendingStreamTypeOnClient) {}

TEST_P(PendingStreamTest, PendingStreamTooMuchData) {}

TEST_P(PendingStreamTest, PendingStreamTooMuchDataInRstStream) {}

TEST_P(PendingStreamTest, PendingStreamRstStream) {}

TEST_P(PendingStreamTest, PendingStreamWindowUpdate) {}

TEST_P(PendingStreamTest, PendingStreamStopSending) {}

TEST_P(PendingStreamTest, FromPendingStream) {}

TEST_P(PendingStreamTest, FromPendingStreamThenData) {}

TEST_P(QuicStreamTest, WriteAllData) {}

TEST_P(QuicStreamTest, NoBlockingIfNoDataOrFin) {}

TEST_P(QuicStreamTest, BlockIfOnlySomeDataConsumed) {}

TEST_P(QuicStreamTest, BlockIfFinNotConsumedWithData) {}

TEST_P(QuicStreamTest, BlockIfSoloFinNotConsumed) {}

TEST_P(QuicStreamTest, CloseOnPartialWrite) {}

TEST_P(QuicStreamTest, WriteOrBufferData) {}

TEST_P(QuicStreamTest, WriteOrBufferDataReachStreamLimit) {}

TEST_P(QuicStreamTest, ConnectionCloseAfterStreamClose) {}

TEST_P(QuicStreamTest, RstAlwaysSentIfNoFinSent) {}

TEST_P(QuicStreamTest, RstNotSentIfFinSent) {}

TEST_P(QuicStreamTest, OnlySendOneRst) {}

TEST_P(QuicStreamTest, StreamFlowControlMultipleWindowUpdates) {}

TEST_P(QuicStreamTest, FrameStats) {}

// Verify that when we receive a packet which violates flow control (i.e. sends
// too much data on the stream) that the stream sequencer never sees this frame,
// as we check for violation and close the connection early.
TEST_P(QuicStreamTest, StreamSequencerNeverSeesPacketsViolatingFlowControl) {}

// Verify that after the consumer calls StopReading(), the stream still sends
// flow control updates.
TEST_P(QuicStreamTest, StopReadingSendsFlowControl) {}

TEST_P(QuicStreamTest, FinalByteOffsetFromFin) {}

TEST_P(QuicStreamTest, FinalByteOffsetFromRst) {}

TEST_P(QuicStreamTest, InvalidFinalByteOffsetFromRst) {}

TEST_P(QuicStreamTest, FinalByteOffsetFromZeroLengthStreamFrame) {}

TEST_P(QuicStreamTest, OnStreamResetOffsetOverflow) {}

TEST_P(QuicStreamTest, OnStreamFrameUpperLimit) {}

TEST_P(QuicStreamTest, StreamTooLong) {}

TEST_P(QuicStreamTest, SetDrainingIncomingOutgoing) {}

TEST_P(QuicStreamTest, SetDrainingOutgoingIncoming) {}

TEST_P(QuicStreamTest, EarlyResponseFinHandling) {}

TEST_P(QuicStreamTest, StreamWaitsForAcks) {}

TEST_P(QuicStreamTest, StreamDataGetAckedOutOfOrder) {}

TEST_P(QuicStreamTest, CancelStream) {}

TEST_P(QuicStreamTest, RstFrameReceivedStreamNotFinishSending) {}

TEST_P(QuicStreamTest, RstFrameReceivedStreamFinishSending) {}

TEST_P(QuicStreamTest, ConnectionClosed) {}

TEST_P(QuicStreamTest, CanWriteNewDataAfterData) {}

TEST_P(QuicStreamTest, WriteBufferedData) {}

TEST_P(QuicStreamTest, WritevDataReachStreamLimit) {}

TEST_P(QuicStreamTest, WriteMemSlices) {}

TEST_P(QuicStreamTest, WriteMemSlicesReachStreamLimit) {}

TEST_P(QuicStreamTest, StreamDataGetAckedMultipleTimes) {}

TEST_P(QuicStreamTest, OnStreamFrameLost) {}

TEST_P(QuicStreamTest, CannotBundleLostFin) {}

TEST_P(QuicStreamTest, MarkConnectionLevelWriteBlockedOnWindowUpdateFrame) {}

// Regression test for b/73282665.
TEST_P(QuicStreamTest,
       MarkConnectionLevelWriteBlockedOnWindowUpdateFrameWithNoBufferedData) {}

TEST_P(QuicStreamTest, RetransmitStreamData) {}

TEST_P(QuicStreamTest, ResetStreamOnTtlExpiresRetransmitLostData) {}

TEST_P(QuicStreamTest, ResetStreamOnTtlExpiresEarlyRetransmitData) {}

// Test that OnStreamReset does one-way (read) closes if version 99, two way
// (read and write) if not version 99.
TEST_P(QuicStreamTest, OnStreamResetReadOrReadWrite) {}

TEST_P(QuicStreamTest, WindowUpdateForReadOnlyStream) {}

TEST_P(QuicStreamTest, RstStreamFrameChangesCloseOffset) {}

// Regression test for b/176073284.
TEST_P(QuicStreamTest, EmptyStreamFrameWithNoFin) {}

TEST_P(QuicStreamTest, SendRstWithCustomIetfCode) {}

}  // namespace
}  // namespace test
}  // namespace quic