#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "net/base/elements_upload_data_stream.h"
#include <stdint.h>
#include <algorithm>
#include <limits>
#include <string_view>
#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/location.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "net/base/completion_once_callback.h"
#include "net/base/io_buffer.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/log/net_log_with_source.h"
#include "net/test/gtest_util.h"
#include "net/test/test_with_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
IsError;
IsOk;
DoAll;
Invoke;
Return;
_;
namespace net {
namespace {
const char kTestData[] = …;
const size_t kTestDataSize = …;
const size_t kTestBufferSize = …;
std::string ReadFromUploadDataStream(UploadDataStream* stream) { … }
class MockUploadElementReader : public UploadElementReader { … };
}
class ElementsUploadDataStreamTest : public PlatformTest,
public WithTaskEnvironment { … };
TEST_F(ElementsUploadDataStreamTest, EmptyUploadData) { … }
TEST_F(ElementsUploadDataStreamTest, ConsumeAllBytes) { … }
TEST_F(ElementsUploadDataStreamTest, File) { … }
TEST_F(ElementsUploadDataStreamTest, FileSmallerThanLength) { … }
TEST_F(ElementsUploadDataStreamTest, ReadErrorSync) { … }
TEST_F(ElementsUploadDataStreamTest, ReadErrorAsync) { … }
TEST_F(ElementsUploadDataStreamTest, FileAndBytes) { … }
TEST_F(ElementsUploadDataStreamTest, InitAsync) { … }
TEST_F(ElementsUploadDataStreamTest, InitAsyncFailureAsync) { … }
TEST_F(ElementsUploadDataStreamTest, InitAsyncFailureSync) { … }
TEST_F(ElementsUploadDataStreamTest, ReadAsyncWithExactSizeBuffer) { … }
TEST_F(ElementsUploadDataStreamTest, ReadAsync) { … }
void ElementsUploadDataStreamTest::FileChangedHelper(
const base::FilePath& file_path,
const base::Time& time,
bool error_expected) { … }
TEST_F(ElementsUploadDataStreamTest, FileChanged) { … }
TEST_F(ElementsUploadDataStreamTest, MultipleInit) { … }
TEST_F(ElementsUploadDataStreamTest, MultipleInitAsync) { … }
TEST_F(ElementsUploadDataStreamTest, InitToReset) { … }
TEST_F(ElementsUploadDataStreamTest, InitDuringAsyncInit) { … }
TEST_F(ElementsUploadDataStreamTest, InitDuringAsyncRead) { … }
}