chromium/net/third_party/quiche/src/quiche/http2/adapter/oghttp2_adapter_test.cc

#include "quiche/http2/adapter/oghttp2_adapter.h"

#include <cstdint>
#include <limits>
#include <memory>
#include <string>
#include <vector>

#include "absl/strings/str_join.h"
#include "quiche/http2/adapter/http2_protocol.h"
#include "quiche/http2/adapter/http2_visitor_interface.h"
#include "quiche/http2/adapter/mock_http2_visitor.h"
#include "quiche/http2/adapter/oghttp2_util.h"
#include "quiche/http2/adapter/test_frame_sequence.h"
#include "quiche/http2/adapter/test_utils.h"
#include "quiche/common/http/http_header_block.h"
#include "quiche/common/platform/api/quiche_expect_bug.h"
#include "quiche/common/platform/api/quiche_test.h"

namespace http2 {
namespace adapter {
namespace test {
namespace {

ConnectionError;

SpdyFrameType;
_;

enum FrameType {};

TEST(OgHttp2AdapterTest, IsServerSession) {}

TEST(OgHttp2AdapterTest, ProcessBytes) {}

TEST(OgHttp2AdapterTest, HeaderValuesWithObsTextAllowedByDefault) {}

TEST(OgHttp2AdapterTest, HeaderValuesWithObsTextDisallowed) {}

TEST(OgHttp2AdapterTest, RequestPathWithSpaceOrTab) {}

TEST(OgHttp2AdapterTest, RequestPathWithSpaceOrTabNoPathValidation) {}

TEST(OgHttp2AdapterTest, InitialSettingsNoExtendedConnect) {}

TEST(OgHttp2AdapterTest, InitialSettings) {}

TEST(OgHttp2AdapterTest, AutomaticSettingsAndPingAcks) {}

TEST(OgHttp2AdapterTest, AutomaticPingAcksDisabled) {}

TEST(OgHttp2AdapterTest, InvalidMaxFrameSizeSetting) {}

TEST(OgHttp2AdapterTest, InvalidPushSetting) {}

TEST(OgHttp2AdapterTest, InvalidConnectProtocolSetting) {}

TEST(OgHttp2AdapterTest, ClientSetsRemoteMaxStreamOption) {}

TEST(OgHttp2AdapterTest, ClientHandles100Headers) {}

TEST(OgHttp2AdapterTest, QueuingWindowUpdateAffectsWindow) {}

TEST(OgHttp2AdapterTest, AckOfSettingInitialWindowSizeAffectsWindow) {}

TEST(OgHttp2AdapterTest, ClientRejects100HeadersWithFin) {}

TEST(OgHttp2AdapterTest, ClientRejects100HeadersWithContent) {}

TEST(OgHttp2AdapterTest, ClientRejects100HeadersWithContentLength) {}

TEST(OgHttp2AdapterTest, ClientHandlesResponseWithContentLengthAndPadding) {}

TEST(OgHttp2AdapterTest, ClientHandles204WithContent) {}

TEST(OgHttp2AdapterTest, ClientHandles304WithContent) {}

TEST(OgHttp2AdapterTest, ClientHandles304WithContentLength) {}

TEST(OgHttp2AdapterTest, ClientHandlesTrailers) {}

class OgHttp2AdapterDataTest : public quiche::test::QuicheTestWithParam<bool> {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(OgHttp2AdapterDataTest, ClientSendsTrailers) {}

TEST(OgHttp2AdapterTest, ClientRstStreamWhileHandlingHeaders) {}

TEST(OgHttp2AdapterTest, ClientConnectionErrorWhileHandlingHeaders) {}

TEST(OgHttp2AdapterTest, ClientConnectionErrorWhileHandlingHeadersOnly) {}

TEST(OgHttp2AdapterTest, ClientRejectsHeaders) {}

TEST(OgHttp2AdapterTest, ClientHandlesSmallerHpackHeaderTableSetting) {}

TEST(OgHttp2AdapterTest, ClientHandlesLargerHpackHeaderTableSetting) {}

TEST(OgHttp2AdapterTest, ClientSendsHpackHeaderTableSetting) {}

// TODO(birenroy): Validate headers and re-enable this test. The library should
// invoke OnErrorDebug() with an error message for the invalid header. The
// library should also invoke OnInvalidFrame() for the invalid HEADERS frame.
TEST(OgHttp2AdapterTest, DISABLED_ClientHandlesInvalidTrailers) {}

TEST(OgHttp2AdapterTest, ClientStartsShutdown) {}

TEST(OgHttp2AdapterTest, ClientReceivesGoAway) {}

TEST(OgHttp2AdapterTest, ClientReceivesMultipleGoAways) {}

TEST(OgHttp2AdapterTest, ClientReceivesMultipleGoAwaysWithIncreasingStreamId) {}

TEST(OgHttp2AdapterTest, ClientReceivesGoAwayWithPendingStreams) {}

TEST(OgHttp2AdapterTest, ClientFailsOnGoAway) {}

TEST(OgHttp2AdapterTest, ClientRejects101Response) {}

TEST_P(OgHttp2AdapterDataTest, ClientObeysMaxConcurrentStreams) {}

TEST_P(OgHttp2AdapterDataTest, ClientReceivesInitialWindowSetting) {}

TEST_P(OgHttp2AdapterDataTest,
       ClientReceivesInitialWindowSettingAfterStreamStart) {}

TEST(OgHttp2AdapterTest, InvalidInitialWindowSetting) {}

TEST(OggHttp2AdapterClientTest, InitialWindowSettingCausesOverflow) {}

TEST(OgHttp2AdapterTest, FailureSendingConnectionPreface) {}

TEST(OgHttp2AdapterTest, MaxFrameSizeSettingNotAppliedBeforeAck) {}

TEST(OgHttp2AdapterTest, MaxFrameSizeSettingAppliedAfterAck) {}

TEST(OgHttp2AdapterTest, ClientForbidsPushPromise) {}

TEST(OgHttp2AdapterTest, ClientForbidsPushStream) {}

TEST(OgHttp2AdapterTest, ClientReceivesDataOnClosedStream) {}

TEST_P(OgHttp2AdapterDataTest, ClientEncountersFlowControlBlock) {}

TEST_P(OgHttp2AdapterDataTest, ClientSendsTrailersAfterFlowControlBlock) {}

TEST(OgHttp2AdapterTest, ClientQueuesRequests) {}

TEST(OgHttp2AdapterTest, ClientAcceptsHeadResponseWithContentLength) {}

TEST(OgHttp2AdapterTest, GetSendWindowSize) {}

TEST(OgHttp2AdapterTest, WindowUpdateZeroDelta) {}

TEST(OgHttp2AdapterTest, WindowUpdateCausesWindowOverflow) {}

TEST(OgHttp2AdapterTest, WindowUpdateRaisesFlowControlWindowLimit) {}

TEST(OgHttp2AdapterTest, MarkDataConsumedForNonexistentStream) {}

TEST(OgHttp2AdapterTest, TestSerialize) {}

TEST(OgHttp2AdapterTest, TestPartialSerialize) {}

TEST(OgHttp2AdapterTest, TestStreamInitialWindowSizeUpdates) {}

TEST(OgHttp2AdapterTest, ConnectionErrorOnControlFrameSent) {}

TEST_P(OgHttp2AdapterDataTest, ConnectionErrorOnDataFrameSent) {}

TEST(OgHttp2AdapterTest, ClientSendsContinuation) {}

TEST_P(OgHttp2AdapterDataTest, RepeatedHeaderNames) {}

TEST_P(OgHttp2AdapterDataTest, ServerRespondsToRequestWithTrailers) {}

TEST(OgHttp2AdapterTest, ServerReceivesMoreHeaderBytesThanConfigured) {}

TEST(OgHttp2AdapterTest, ServerVisitorRejectsHeaders) {}

TEST_P(OgHttp2AdapterDataTest, ServerSubmitsResponseWithDataSourceError) {}

TEST(OgHttp2AdapterTest, CompleteRequestWithServerResponse) {}

TEST(OgHttp2AdapterTest, IncompleteRequestWithServerResponse) {}

TEST(OgHttp2AdapterTest, IncompleteRequestWithServerResponseRstStreamEnabled) {}

TEST(OgHttp2AdapterTest, ServerHandlesMultipleContentLength) {}

TEST_P(OgHttp2AdapterDataTest, ServerSendsInvalidTrailers) {}

TEST(OgHttp2AdapterTest, ServerHandlesDataWithPadding) {}

TEST(OgHttp2AdapterTest, ServerHandlesHostHeader) {}

TEST(OgHttp2AdapterTest, ServerHandlesHostHeaderWithLaxValidation) {}

// Tests the case where the response body is in the progress of being sent while
// trailers are queued.
TEST_P(OgHttp2AdapterDataTest, ServerSubmitsTrailersWhileDataDeferred) {}

// Tests the case where the response body and trailers become blocked by flow
// control while the stream is writing. Regression test for
// https://github.com/envoyproxy/envoy/issues/31710
TEST_P(OgHttp2AdapterDataTest, ServerSubmitsTrailersWithFlowControlBlockage) {}

TEST_P(OgHttp2AdapterDataTest, ServerSubmitsTrailersWithDataEndStream) {}

TEST_P(OgHttp2AdapterDataTest,
       ServerSubmitsTrailersWithDataEndStreamAndDeferral) {}

TEST(OgHttp2AdapterTest, ClientDisobeysConnectionFlowControl) {}

TEST(OgHttp2AdapterTest, ClientDisobeysConnectionFlowControlWithOneDataFrame) {}

TEST(OgHttp2AdapterTest, ClientDisobeysConnectionFlowControlAcrossReads) {}

TEST(OgHttp2AdapterTest, ClientDisobeysStreamFlowControl) {}

TEST(OgHttp2AdapterTest, ServerErrorWhileHandlingHeaders) {}

TEST(OgHttp2AdapterTest, ServerErrorWhileHandlingHeadersDropsFrames) {}

TEST(OgHttp2AdapterTest, ServerConnectionErrorWhileHandlingHeaders) {}

TEST(OgHttp2AdapterTest, ServerErrorAfterHandlingHeaders) {}

// Exercises the case when a visitor chooses to reject a frame based solely on
// the frame header, which is a fatal error for the connection.
TEST(OgHttp2AdapterTest, ServerRejectsFrameHeader) {}

TEST(OgHttp2AdapterTest, ServerRejectsBeginningOfData) {}

TEST(OgHttp2AdapterTest, ServerReceivesTooLargeHeader) {}

TEST(OgHttp2AdapterTest, ServerReceivesInvalidAuthority) {}

TEST(OgHttpAdapterTest, ServerReceivesGoAway) {}

TEST_P(OgHttp2AdapterDataTest, ServerSubmitResponse) {}

TEST_P(OgHttp2AdapterDataTest, ServerSubmitResponseWithResetFromClient) {}

TEST(OgHttp2AdapterTest, ServerRejectsStreamData) {}

OgHttp2AdapterInteractionDataTest;

INSTANTIATE_TEST_SUITE_P();
// Exercises a naive mutually recursive test client and server. This test fails
// without recursion guards in OgHttp2Session.
TEST_P(OgHttp2AdapterInteractionDataTest, ClientServerInteractionTest) {}

TEST(OgHttp2AdapterInteractionTest,
     ClientServerInteractionRepeatedHeaderNames) {}

TEST(OgHttp2AdapterInteractionTest, ClientServerInteractionWithCookies) {}

TEST(OgHttp2AdapterTest, ServerForbidsNewStreamBelowWatermark) {}

TEST(OgHttp2AdapterTest, ServerForbidsWindowUpdateOnIdleStream) {}

TEST(OgHttp2AdapterTest, ServerForbidsDataOnIdleStream) {}

TEST(OgHttp2AdapterTest, ServerForbidsRstStreamOnIdleStream) {}

TEST(OgHttp2AdapterTest, ServerForbidsNewStreamAboveStreamLimit) {}

TEST(OgHttp2AdapterTest, ServerRstStreamsNewStreamAboveStreamLimitBeforeAck) {}

TEST(OgHttp2AdapterTest, ServerForbidsProtocolPseudoheaderBeforeAck) {}

TEST(OgHttp2AdapterTest, ServerAllowsProtocolPseudoheaderAfterAck) {}

TEST_P(OgHttp2AdapterDataTest, SkipsSendingFramesForRejectedStream) {}

TEST(OgHttpAdapterServerTest, ServerStartsShutdown) {}

TEST(OgHttp2AdapterTest, ServerStartsShutdownAfterGoaway) {}

// Verifies that a connection-level processing error results in repeatedly
// returning a positive value for ProcessBytes() to mark all data as consumed
// when the blackhole option is enabled.
TEST(OgHttp2AdapterTest, ConnectionErrorWithBlackholingData) {}

// Verifies that a connection-level processing error results in returning a
// negative value for ProcessBytes() when the blackhole option is disabled.
TEST(OgHttp2AdapterTest, ConnectionErrorWithoutBlackholingData) {}

TEST_P(OgHttp2AdapterDataTest, ServerDoesNotSendFramesAfterImmediateGoAway) {}

TEST(OgHttp2AdapterTest, ServerHandlesContentLength) {}

TEST(OgHttp2AdapterTest, ServerHandlesContentLengthMismatch) {}

TEST(OgHttp2AdapterTest, ServerHandlesAsteriskPathForOptions) {}

TEST(OgHttp2AdapterTest, ServerHandlesInvalidPath) {}

TEST(OgHttp2AdapterTest, ServerHandlesTeHeader) {}

TEST(OgHttp2AdapterTest, ServerHandlesConnectionSpecificHeaders) {}

TEST(OgHttp2AdapterTest, ServerUsesCustomWindowUpdateStrategy) {}

TEST(OgHttp2AdapterTest, ServerConsumesDataWithPadding) {}

// Verifies that NoopHeaderValidator allows several header combinations that
// would otherwise be invalid.
TEST(OgHttp2AdapterTest, NoopHeaderValidatorTest) {}

TEST_P(OgHttp2AdapterDataTest, NegativeFlowControlStreamResumption) {}

// Verifies that Set-Cookie headers are not folded in either the sending or
// receiving direction.
TEST(OgHttp2AdapterTest, SetCookieRoundtrip) {}

}  // namespace
}  // namespace test
}  // namespace adapter
}  // namespace http2