#include "remoting/test/fake_connection_event_logger.h"
#include <atomic>
#include <string>
#include <utility>
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/time/time.h"
#include "remoting/proto/audio.pb.h"
#include "remoting/proto/control.pb.h"
#include "remoting/proto/video.pb.h"
namespace remoting {
namespace test {
namespace {
class MessageCounter { … };
MessageCounter::MessageCounter(const char* name, const char* unit)
: … { … }
MessageCounter::MessageCounter(const char* name)
: … { … }
double MessageCounter::DurationSeconds() const { … }
double MessageCounter::MessagesPerSecond() const { … }
double MessageCounter::SizePerSecond() const { … }
double MessageCounter::AverageMessageSize() const { … }
void MessageCounter::LogMessage(
const ::google::protobuf::MessageLite& message) { … }
void MessageCounter::LogMessage(int size) { … }
void MessageCounter::DisplayStatistics(std::ostream& os) { … }
}
class FakeConnectionEventLogger::CounterClientStub
: public protocol::ClientStub,
public MessageCounter { … };
FakeConnectionEventLogger::CounterClientStub::CounterClientStub()
: … { … }
void FakeConnectionEventLogger::CounterClientStub::DeliverHostMessage(
const protocol::ExtensionMessage& message) { … }
class FakeConnectionEventLogger::CounterHostStub : public protocol::HostStub,
public MessageCounter { … };
FakeConnectionEventLogger::CounterHostStub::CounterHostStub()
: … { … }
void FakeConnectionEventLogger::CounterHostStub::DeliverClientMessage(
const protocol::ExtensionMessage& message) { … }
class FakeConnectionEventLogger::CounterAudioStub : public protocol::AudioStub,
public MessageCounter { … };
FakeConnectionEventLogger::CounterAudioStub::CounterAudioStub()
: … { … }
void FakeConnectionEventLogger::CounterAudioStub::ProcessAudioPacket(
std::unique_ptr<AudioPacket> audio_packet,
base::OnceClosure done) { … }
class FakeConnectionEventLogger::CounterVideoStub : public protocol::VideoStub,
public MessageCounter { … };
FakeConnectionEventLogger::CounterVideoStub::CounterVideoStub(
protocol::FakeConnectionToClient* connection)
: … { … }
void FakeConnectionEventLogger::CounterVideoStub::DisplayStatistics(
std::ostream& os) { … }
void FakeConnectionEventLogger::CounterVideoStub::ProcessVideoPacket(
std::unique_ptr<VideoPacket> video_packet,
base::OnceClosure done) { … }
FakeConnectionEventLogger::FakeConnectionEventLogger(
protocol::FakeConnectionToClient* connection)
: … { … }
FakeConnectionEventLogger::~FakeConnectionEventLogger() { … }
protocol::ClientStub* FakeConnectionEventLogger::client_stub() { … }
protocol::HostStub* FakeConnectionEventLogger::host_stub() { … }
protocol::AudioStub* FakeConnectionEventLogger::audio_stub() { … }
protocol::VideoStub* FakeConnectionEventLogger::video_stub() { … }
std::ostream& operator<<(std::ostream& os,
const FakeConnectionEventLogger& logger) { … }
}
}