#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "remoting/protocol/fake_stream_socket.h"
#include <utility>
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/task/single_thread_task_runner.h"
#include "net/base/address_list.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace remoting::protocol {
FakeStreamSocket::FakeStreamSocket()
: … { … }
FakeStreamSocket::~FakeStreamSocket() { … }
void FakeStreamSocket::AppendInputData(const std::string& data) { … }
void FakeStreamSocket::SetReadError(int error) { … }
void FakeStreamSocket::PairWith(FakeStreamSocket* peer_socket) { … }
base::WeakPtr<FakeStreamSocket> FakeStreamSocket::GetWeakPtr() { … }
int FakeStreamSocket::Read(const scoped_refptr<net::IOBuffer>& buf,
int buf_len,
net::CompletionOnceCallback callback) { … }
int FakeStreamSocket::Write(
const scoped_refptr<net::IOBuffer>& buf,
int buf_len,
net::CompletionOnceCallback callback,
const net::NetworkTrafficAnnotationTag& traffic_annotation) { … }
void FakeStreamSocket::DoAsyncWrite(const scoped_refptr<net::IOBuffer>& buf,
int buf_len,
net::CompletionOnceCallback callback) { … }
void FakeStreamSocket::DoWrite(const scoped_refptr<net::IOBuffer>& buf,
int buf_len) { … }
FakeStreamChannelFactory::FakeStreamChannelFactory()
: … { … }
FakeStreamChannelFactory::~FakeStreamChannelFactory() = default;
FakeStreamSocket* FakeStreamChannelFactory::GetFakeChannel(
const std::string& name) { … }
void FakeStreamChannelFactory::PairWith(
FakeStreamChannelFactory* peer_factory) { … }
void FakeStreamChannelFactory::CreateChannel(const std::string& name,
ChannelCreatedCallback callback) { … }
void FakeStreamChannelFactory::NotifyChannelCreated(
std::unique_ptr<FakeStreamSocket> owned_channel,
const std::string& name,
ChannelCreatedCallback callback) { … }
void FakeStreamChannelFactory::CancelChannelCreation(const std::string& name) { … }
}