#include "services/network/chunked_data_pipe_upload_data_stream.h"
#include <stdint.h>
#include <limits>
#include <memory>
#include "base/containers/span.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/task_environment.h"
#include "mojo/public/cpp/system/data_pipe.h"
#include "mojo/public/cpp/system/data_pipe_utils.h"
#include "net/base/completion_once_callback.h"
#include "net/base/io_buffer.h"
#include "net/base/test_completion_callback.h"
#include "net/log/net_log_with_source.h"
#include "services/network/public/cpp/resource_request_body.h"
#include "services/network/public/mojom/chunked_data_pipe_getter.mojom.h"
#include "services/network/test_chunked_data_pipe_getter.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace network {
namespace {
net::CompletionOnceCallback NoCallback() { … }
class ChunkedDataPipeUploadDataStreamTest : public testing::Test { … };
TEST_F(ChunkedDataPipeUploadDataStreamTest, ReadBeforeDataReady) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, ReadAfterDataReady) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, MultipleReadThrough) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest,
MultiplePartialReadThroughWithKnownSize) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest,
MultiplePartialReadThroughSizeNotKnown) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, GetSizeSucceedsBeforeInit) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, GetSizeSucceedsAfterReset) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, GetSizeFailsBeforeInit) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, GetSizeFailsAfterReset) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, CloseBodyPipeBeforeSuccess1) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, CloseBodyPipeBeforeSuccess2) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, CloseBodyPipeBeforeSuccess3) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, CloseBodyPipeBeforeTruncation1) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, CloseBodyPipeBeforeTruncation2) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, CloseBodyPipeBeforeTruncation3) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, CloseBodyPipeBeforeFailure1) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, CloseBodyPipeBeforeFailure2) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, CloseBodyPipeBeforeFailure3) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, CloseBodyPipeBeforeCloseGetter1) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, CloseBodyPipeBeforeCloseGetter2) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, CloseBodyPipeBeforeCloseGetter3) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, ExtraBytes1) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, ExtraBytes2) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, ClosePipeGetterBeforeInit) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest,
ClosePipeGetterWithoutCallingGetSizeCallbackNoPendingRead) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest,
ClosePipeGetterWithoutCallingGetSizeCallbackPendingRead) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest,
ClosePipeGetterAfterCallingGetSizeCallback) { … }
#define EXPECT_READ(chunked_upload_stream, io_buffer, expected) …
#define EXPECT_EOF(chunked_upload_stream, size) …
#define WRITE_DATA_SYNC(write_pipe, str) …
TEST_F(ChunkedDataPipeUploadDataStreamTest, CacheNotUsed) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, CacheEnableBeforeInit1) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, CacheEnableBeforeInit2) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, CacheRead) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, CacheOverWindowOnce) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, CacheOverWindowTwice) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, CacheInitBeforeRead) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, CacheInitWhileRead) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, CacheReadAppendDataBeforeInit) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, CacheReadAppendDataAfterInit) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, CacheReadAppendDataDuringRead) { … }
TEST_F(ChunkedDataPipeUploadDataStreamTest, ErrorAndDetach) { … }
}
}