#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "net/http/http_stream_parser.h"
#include <stdint.h>
#include <algorithm>
#include <memory>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include "base/containers/span.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/task_environment.h"
#include "net/base/chunked_upload_data_stream.h"
#include "net/base/elements_upload_data_stream.h"
#include "net/base/io_buffer.h"
#include "net/base/load_flags.h"
#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
#include "net/base/upload_bytes_element_reader.h"
#include "net/base/upload_data_stream.h"
#include "net/base/upload_file_element_reader.h"
#include "net/http/http_connection_info.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_response_info.h"
#include "net/socket/socket_test_util.h"
#include "net/socket/stream_socket.h"
#include "net/test/gtest_util.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/gurl.h"
IsError;
IsOk;
namespace net {
namespace {
const size_t kOutputSize = …;
const size_t kMaxPayloadSize = …;
std::unique_ptr<StreamSocket> CreateConnectedSocket(SequencedSocketData* data) { … }
class ReadErrorUploadDataStream : public UploadDataStream { … };
TEST(HttpStreamParser, DataReadErrorSynchronous) { … }
TEST(HttpStreamParser, DataReadErrorAsynchronous) { … }
class InitAsyncUploadDataStream : public ChunkedUploadDataStream { … };
TEST(HttpStreamParser, InitAsynchronousUploadDataStream) { … }
TEST(HttpStreamParser, EncodeChunk_EmptyPayload) { … }
TEST(HttpStreamParser, EncodeChunk_ShortPayload) { … }
TEST(HttpStreamParser, EncodeChunk_LargePayload) { … }
TEST(HttpStreamParser, EncodeChunk_FullPayload) { … }
TEST(HttpStreamParser, EncodeChunk_TooLargePayload) { … }
TEST(HttpStreamParser, ShouldMergeRequestHeadersAndBody_NoBody) { … }
TEST(HttpStreamParser, ShouldMergeRequestHeadersAndBody_EmptyBody) { … }
TEST(HttpStreamParser, ShouldMergeRequestHeadersAndBody_ChunkedBody) { … }
TEST(HttpStreamParser, ShouldMergeRequestHeadersAndBody_FileBody) { … }
TEST(HttpStreamParser, ShouldMergeRequestHeadersAndBody_SmallBodyInMemory) { … }
TEST(HttpStreamParser, ShouldMergeRequestHeadersAndBody_LargeBodyInMemory) { … }
TEST(HttpStreamParser, SentBytesNoHeaders) { … }
TEST(HttpStreamParser, SentBytesWithHeaders) { … }
TEST(HttpStreamParser, SentBytesWithHeadersMultiWrite) { … }
TEST(HttpStreamParser, SentBytesWithErrorWritingHeaders) { … }
TEST(HttpStreamParser, SentBytesPost) { … }
TEST(HttpStreamParser, SentBytesChunkedPostError) { … }
TEST(HttpStreamParser, AsyncSingleChunkAndAsyncSocket) { … }
TEST(HttpStreamParser, SyncSingleChunkAndAsyncSocket) { … }
TEST(HttpStreamParser, AsyncChunkAndAsyncSocketWithMultipleChunks) { … }
TEST(HttpStreamParser, AsyncEmptyChunkedUpload) { … }
TEST(HttpStreamParser, SyncEmptyChunkedUpload) { … }
TEST(HttpStreamParser, TruncatedHeaders) { … }
TEST(HttpStreamParser, WebSocket101Response) { … }
class SimpleGetRunner { … };
TEST(HttpStreamParser, Http09PortTests) { … }
TEST(HttpStreamParser, ContinueWithBody) { … }
TEST(HttpStreamParser, NullFails) { … }
TEST(HttpStreamParser, ShoutcastSingleByteReads) { … }
TEST(HttpStreamParser, ShoutcastWeirdHeader) { … }
TEST(HttpStreamParser, Http09TruncatedHeaderPortTest) { … }
TEST(HttpStreamParser, ReceivedBytesNormal) { … }
TEST(HttpStreamParser, ReceivedBytesExcludesNextResponse) { … }
TEST(HttpStreamParser, ReceivedBytesMultiReadExcludesNextResponse) { … }
TEST(HttpStreamParser, ReceivedBytesMultiReadExcludesExtraData) { … }
TEST(HttpStreamParser, ReceivedBytesAsyncMultiReadExcludesExtraData) { … }
TEST(HttpStreamParser, ReceivedBytesExcludesExtraDataLargeBuffer) { … }
TEST(HttpStreamParser, ReceivedBytesExcludesExtraDataSmallBuffer) { … }
TEST(HttpStreamParser, ReceivedBytesFromReadBufExcludesNextResponse) { … }
TEST(HttpStreamParser, ReceivedBytesUseReadBuf) { … }
TEST(HttpStreamParser, ReceivedBytesChunkedTransferExcludesNextResponse) { … }
TEST(HttpStreamParser, ReceivedBytesMultipleReads) { … }
TEST(HttpStreamParser, NonInformationalResponseStart) { … }
TEST(HttpStreamParser, NonInformationalResponseStartWithoutBody) { … }
TEST(HttpStreamParser, ReceivedBytesIncludesContinueHeader) { … }
TEST(HttpStreamParser, EarlyHints) { … }
TEST(HttpStreamParser, MixedResponseHeaders) { … }
TEST(HttpStreamParser, ReadAfterUnownedObjectsDestroyed) { … }
TEST(HttpStreamParser, ReceiveOneByteAtATime) { … }
}
}