#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "remoting/base/buffered_socket_writer.h"
#include <stddef.h>
#include <stdlib.h>
#include <memory>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/run_loop.h"
#include "base/test/task_environment.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/log/net_log.h"
#include "net/socket/socket_test_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"
namespace remoting {
namespace {
const int kTestBufferSize = …;
const size_t kWriteChunkSize = …;
int WriteNetSocket(net::Socket* socket,
const scoped_refptr<net::IOBuffer>& buf,
int buf_len,
net::CompletionOnceCallback callback,
const net::NetworkTrafficAnnotationTag& traffic_annotation) { … }
class SocketDataProvider : public net::SocketDataProvider { … };
}
class BufferedSocketWriterTest : public testing::Test { … };
TEST_F(BufferedSocketWriterTest, WriteFull) { … }
TEST_F(BufferedSocketWriterTest, WriteChunks) { … }
TEST_F(BufferedSocketWriterTest, WriteAsync) { … }
TEST_F(BufferedSocketWriterTest, AppendInCallbackSync) { … }
TEST_F(BufferedSocketWriterTest, AppendInCallbackAsync) { … }
TEST_F(BufferedSocketWriterTest, DestroyFromCallback) { … }
TEST_F(BufferedSocketWriterTest, TestWriteErrorSync) { … }
TEST_F(BufferedSocketWriterTest, TestWriteErrorAsync) { … }
TEST_F(BufferedSocketWriterTest, WriteBeforeStart) { … }
}