#include "remoting/host/daemon_process.h"
#include <stdint.h>
#include <memory>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
#include "base/process/process.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/task_environment.h"
#include "mojo/public/cpp/system/message_pipe.h"
#include "remoting/base/auto_thread_task_runner.h"
#include "remoting/host/desktop_session.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
_;
AnyNumber;
InSequence;
Invoke;
namespace remoting {
namespace {
class FakeDesktopSession : public DesktopSession { … };
class MockDaemonProcess : public DaemonProcess { … };
FakeDesktopSession::FakeDesktopSession(DaemonProcess* daemon_process, int id)
: … { … }
FakeDesktopSession::~FakeDesktopSession() = default;
MockDaemonProcess::MockDaemonProcess(
scoped_refptr<AutoThreadTaskRunner> caller_task_runner,
scoped_refptr<AutoThreadTaskRunner> io_task_runner,
base::OnceClosure stopped_callback)
: … { … }
MockDaemonProcess::~MockDaemonProcess() = default;
std::unique_ptr<DesktopSession> MockDaemonProcess::DoCreateDesktopSession(
int terminal_id,
const ScreenResolution& resolution,
bool virtual_terminal) { … }
}
class DaemonProcessTest : public testing::Test { … };
DaemonProcessTest::DaemonProcessTest() = default;
DaemonProcessTest::~DaemonProcessTest() = default;
void DaemonProcessTest::SetUp() { … }
void DaemonProcessTest::TearDown() { … }
DesktopSession* DaemonProcessTest::DoCreateDesktopSession(int terminal_id) { … }
void DaemonProcessTest::LaunchNetworkProcess() { … }
void DaemonProcessTest::DeleteDaemonProcess() { … }
void DaemonProcessTest::QuitMessageLoop() { … }
void DaemonProcessTest::StartDaemonProcess() { … }
MATCHER_P(Message, type, "") { … }
TEST_F(DaemonProcessTest, OpenClose) { … }
TEST_F(DaemonProcessTest, CallCloseDesktopSession) { … }
TEST_F(DaemonProcessTest, DoubleDisconnectTerminal) { … }
TEST_F(DaemonProcessTest, InvalidDisconnectTerminal) { … }
TEST_F(DaemonProcessTest, InvalidConnectTerminal) { … }
}