#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "net/quic/quic_http_stream.h"
#include <stdint.h>
#include <memory>
#include <string_view>
#include <utility>
#include "base/containers/span.h"
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/time/default_tick_clock.h"
#include "base/time/time.h"
#include "net/base/chunked_upload_data_stream.h"
#include "net/base/connection_endpoint_metadata.h"
#include "net/base/elements_upload_data_stream.h"
#include "net/base/features.h"
#include "net/base/load_flags.h"
#include "net/base/load_timing_info.h"
#include "net/base/load_timing_info_test_util.h"
#include "net/base/net_errors.h"
#include "net/base/network_anonymization_key.h"
#include "net/base/privacy_mode.h"
#include "net/base/proxy_chain.h"
#include "net/base/session_usage.h"
#include "net/base/test_completion_callback.h"
#include "net/base/upload_bytes_element_reader.h"
#include "net/dns/public/host_resolver_results.h"
#include "net/dns/public/secure_dns_policy.h"
#include "net/http/http_response_headers.h"
#include "net/http/transport_security_state.h"
#include "net/log/net_log.h"
#include "net/log/net_log_event_type.h"
#include "net/log/test_net_log.h"
#include "net/log/test_net_log_util.h"
#include "net/quic/address_utils.h"
#include "net/quic/crypto/proof_verifier_chromium.h"
#include "net/quic/mock_crypto_client_stream_factory.h"
#include "net/quic/quic_chromium_alarm_factory.h"
#include "net/quic/quic_chromium_connection_helper.h"
#include "net/quic/quic_chromium_packet_reader.h"
#include "net/quic/quic_chromium_packet_writer.h"
#include "net/quic/quic_context.h"
#include "net/quic/quic_crypto_client_config_handle.h"
#include "net/quic/quic_http_utils.h"
#include "net/quic/quic_server_info.h"
#include "net/quic/quic_session_key.h"
#include "net/quic/quic_session_pool.h"
#include "net/quic/quic_test_packet_maker.h"
#include "net/quic/quic_test_packet_printer.h"
#include "net/quic/test_quic_crypto_client_config_handle.h"
#include "net/quic/test_task_runner.h"
#include "net/socket/socket_performance_watcher.h"
#include "net/socket/socket_tag.h"
#include "net/socket/socket_test_util.h"
#include "net/spdy/spdy_http_utils.h"
#include "net/ssl/ssl_config_service_defaults.h"
#include "net/test/cert_test_util.h"
#include "net/test/gtest_util.h"
#include "net/test/test_data_directory.h"
#include "net/test/test_with_task_environment.h"
#include "net/third_party/quiche/src/quiche/common/http/http_header_block.h"
#include "net/third_party/quiche/src/quiche/quic/core/congestion_control/send_algorithm_interface.h"
#include "net/third_party/quiche/src/quiche/quic/core/crypto/crypto_protocol.h"
#include "net/third_party/quiche/src/quiche/quic/core/crypto/quic_decrypter.h"
#include "net/third_party/quiche/src/quiche/quic/core/crypto/quic_encrypter.h"
#include "net/third_party/quiche/src/quiche/quic/core/quic_connection.h"
#include "net/third_party/quiche/src/quiche/quic/core/quic_utils.h"
#include "net/third_party/quiche/src/quiche/quic/core/quic_write_blocked_list.h"
#include "net/third_party/quiche/src/quiche/quic/core/tls_client_handshaker.h"
#include "net/third_party/quiche/src/quiche/quic/platform/api/quic_flags.h"
#include "net/third_party/quiche/src/quiche/quic/test_tools/crypto_test_utils.h"
#include "net/third_party/quiche/src/quiche/quic/test_tools/mock_clock.h"
#include "net/third_party/quiche/src/quiche/quic/test_tools/mock_connection_id_generator.h"
#include "net/third_party/quiche/src/quiche/quic/test_tools/mock_random.h"
#include "net/third_party/quiche/src/quiche/quic/test_tools/qpack/qpack_test_utils.h"
#include "net/third_party/quiche/src/quiche/quic/test_tools/quic_connection_peer.h"
#include "net/third_party/quiche/src/quiche/quic/test_tools/quic_spdy_session_peer.h"
#include "net/third_party/quiche/src/quiche/quic/test_tools/quic_test_utils.h"
#include "net/third_party/quiche/src/quiche/spdy/core/spdy_frame_builder.h"
#include "net/third_party/quiche/src/quiche/spdy/core/spdy_framer.h"
#include "net/third_party/quiche/src/quiche/spdy/core/spdy_protocol.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/scheme_host_port.h"
#include "url/url_constants.h"
string;
_;
AnyNumber;
Return;
namespace net::test {
namespace {
const char kUploadData[] = …;
const char kDefaultServerHostName[] = …;
const uint16_t kDefaultServerPort = …;
struct TestParams { … };
std::string PrintToString(const TestParams& p) { … }
std::vector<TestParams> GetTestParams() { … }
bool CheckHeader(const base::Value::Dict& params,
std::string_view key,
std::string_view expected_value) { … }
class TestQuicConnection : public quic::QuicConnection { … };
class ReadErrorUploadDataStream : public UploadDataStream { … };
class DeleteStreamCallback : public TestCompletionCallbackBase { … };
}
class QuicHttpStreamPeer { … };
class QuicHttpStreamTest : public ::testing::TestWithParam<TestParams>,
public WithTaskEnvironment { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(QuicHttpStreamTest, RenewStreamForAuth) { … }
TEST_P(QuicHttpStreamTest, CanReuseConnection) { … }
TEST_P(QuicHttpStreamTest, DisableConnectionMigrationForStream) { … }
TEST_P(QuicHttpStreamTest, GetRequest) { … }
TEST_P(QuicHttpStreamTest, LoadTimingTwoRequests) { … }
TEST_P(QuicHttpStreamTest, GetRequestWithTrailers) { … }
TEST_P(QuicHttpStreamTest, ElideHeadersInNetLog) { … }
TEST_P(QuicHttpStreamTest, GetRequestLargeResponse) { … }
TEST_P(QuicHttpStreamTest, SessionClosedBeforeSendRequest) { … }
TEST_P(QuicHttpStreamTest, GetSSLInfoAfterSessionClosed) { … }
TEST_P(QuicHttpStreamTest, GetAlternativeService) { … }
TEST_P(QuicHttpStreamTest, LogGranularQuicConnectionError) { … }
TEST_P(QuicHttpStreamTest, LogGranularQuicErrorIfHandshakeNotConfirmed) { … }
TEST_P(QuicHttpStreamTest, SessionClosedBeforeReadResponseHeaders) { … }
TEST_P(QuicHttpStreamTest, SendPostRequest) { … }
TEST_P(QuicHttpStreamTest, SendPostRequestAndReceiveSoloFin) { … }
TEST_P(QuicHttpStreamTest, SendChunkedPostRequest) { … }
TEST_P(QuicHttpStreamTest, SendChunkedPostRequestWithFinalEmptyDataPacket) { … }
TEST_P(QuicHttpStreamTest, SendChunkedPostRequestWithOneEmptyDataPacket) { … }
TEST_P(QuicHttpStreamTest, SendChunkedPostRequestAbortedByResetStream) { … }
TEST_P(QuicHttpStreamTest, DestroyedEarly) { … }
TEST_P(QuicHttpStreamTest, Priority) { … }
TEST_P(QuicHttpStreamTest, SessionClosedDuringDoLoop) { … }
TEST_P(QuicHttpStreamTest, SessionClosedBeforeSendHeadersComplete) { … }
TEST_P(QuicHttpStreamTest, SessionClosedBeforeSendHeadersCompleteReadResponse) { … }
TEST_P(QuicHttpStreamTest, SessionClosedBeforeSendBodyComplete) { … }
TEST_P(QuicHttpStreamTest, SessionClosedBeforeSendBundledBodyComplete) { … }
TEST_P(QuicHttpStreamTest, DataReadErrorSynchronous) { … }
TEST_P(QuicHttpStreamTest, DataReadErrorAsynchronous) { … }
TEST_P(QuicHttpStreamTest, GetAcceptChViaAlps) { … }
}