#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "remoting/protocol/connection_tester.h"
#include "base/memory/raw_ptr.h"
#include "base/functional/bind.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "remoting/proto/video.pb.h"
#include "remoting/protocol/message_pipe.h"
#include "remoting/protocol/message_serialization.h"
#include "remoting/protocol/p2p_datagram_socket.h"
#include "remoting/protocol/p2p_stream_socket.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace remoting::protocol {
StreamConnectionTester::StreamConnectionTester(P2PStreamSocket* client_socket,
P2PStreamSocket* host_socket,
int message_size,
int message_count)
: … { … }
StreamConnectionTester::~StreamConnectionTester() = default;
void StreamConnectionTester::Start(base::OnceClosure on_done) { … }
void StreamConnectionTester::CheckResults() { … }
void StreamConnectionTester::Done() { … }
void StreamConnectionTester::InitBuffers() { … }
void StreamConnectionTester::DoWrite() { … }
void StreamConnectionTester::OnWritten(int result) { … }
void StreamConnectionTester::HandleWriteResult(int result) { … }
void StreamConnectionTester::DoRead() { … }
void StreamConnectionTester::OnRead(int result) { … }
void StreamConnectionTester::HandleReadResult(int result) { … }
class MessagePipeConnectionTester::MessageSender
: public MessagePipe::EventHandler { … };
MessagePipeConnectionTester::MessagePipeConnectionTester(
MessagePipe* host_pipe,
MessagePipe* client_pipe,
int message_size,
int message_count)
: … { … }
MessagePipeConnectionTester::~MessagePipeConnectionTester() = default;
void MessagePipeConnectionTester::RunAndCheckResults() { … }
void MessagePipeConnectionTester::OnMessagePipeOpen() { … }
void MessagePipeConnectionTester::OnMessageReceived(
std::unique_ptr<CompoundBuffer> message) { … }
void MessagePipeConnectionTester::OnMessagePipeClosed() { … }
}