chromium/remoting/host/ipc_desktop_environment_unittest.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "remoting/host/ipc_desktop_environment.h"

#include <stdint.h>

#include <memory>
#include <utility>

#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_pump_type.h"
#include "base/process/process.h"
#include "base/process/process_handle.h"
#include "base/run_loop.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/gmock_callback_support.h"
#include "base/test/mock_callback.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "ipc/ipc_channel.h"
#include "ipc/ipc_channel_proxy.h"
#include "ipc/ipc_listener.h"
#include "ipc/ipc_message.h"
#include "ipc/ipc_platform_file.h"
#include "mojo/public/cpp/system/message_pipe.h"
#include "remoting/base/auto_thread.h"
#include "remoting/base/auto_thread_task_runner.h"
#include "remoting/base/constants.h"
#include "remoting/host/desktop_process.h"
#include "remoting/host/desktop_session.h"
#include "remoting/host/desktop_session_connector.h"
#include "remoting/host/desktop_session_proxy.h"
#include "remoting/host/fake_keyboard_layout_monitor.h"
#include "remoting/host/fake_mouse_cursor_monitor.h"
#include "remoting/host/host_mock_objects.h"
#include "remoting/host/mojom/desktop_session.mojom.h"
#include "remoting/protocol/fake_desktop_capturer.h"
#include "remoting/protocol/protocol_mock_objects.h"
#include "remoting/protocol/test_event_matchers.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_region.h"

RunCallback;
RunOnceCallback;
RunOnceClosure;
_;
AnyNumber;
AtLeast;
AtMost;
ByMove;
DeleteArg;
DoAll;
InSequence;
Return;
ReturnRef;

namespace remoting {

EqualsTouchEvent;
EqualsTouchEventTypeAndId;

using SetUpUrlForwarderResponse =
    protocol::UrlForwarderControl::SetUpUrlForwarderResponse;

namespace {

class MockScreenCapturerCallback : public webrtc::DesktopCapturer::Callback {};

// Receives messages sent from the desktop process to the daemon.
class MockDaemonListener : public IPC::Listener,
                           public mojom::DesktopSessionRequestHandler {};

bool MockDaemonListener::OnMessageReceived(const IPC::Message& message) {}

void MockDaemonListener::OnAssociatedInterfaceRequest(
    const std::string& interface_name,
    mojo::ScopedInterfaceEndpointHandle handle) {}

void MockDaemonListener::Disconnect() {}

class MockDesktopSessionManager : public mojom::DesktopSessionManager {};

void MockDesktopSessionManager::BindNewReceiver(
    mojo::PendingAssociatedReceiver<mojom::DesktopSessionManager> receiver) {}

}  // namespace

class IpcDesktopEnvironmentTest : public testing::Test {};

IpcDesktopEnvironmentTest::IpcDesktopEnvironmentTest()
    :{}

IpcDesktopEnvironmentTest::~IpcDesktopEnvironmentTest() = default;

void IpcDesktopEnvironmentTest::SetUp() {}

void IpcDesktopEnvironmentTest::TearDown() {}

void IpcDesktopEnvironmentTest::CreateDesktopSession(
    int terminal_id,
    const ScreenResolution& resolution,
    bool virtual_terminal) {}

void IpcDesktopEnvironmentTest::CloseDesktopSession(int terminal_id) {}

std::unique_ptr<DesktopEnvironment>
IpcDesktopEnvironmentTest::CreateDesktopEnvironment() {}

std::unique_ptr<InputInjector>
IpcDesktopEnvironmentTest::CreateInputInjector() {}

void IpcDesktopEnvironmentTest::DeleteDesktopEnvironment() {}

void IpcDesktopEnvironmentTest::ReflectClipboardEvent(
    const protocol::ClipboardEvent& event) {}

void IpcDesktopEnvironmentTest::CreateDesktopProcess() {}

void IpcDesktopEnvironmentTest::DestroyDesktopProcess() {}

void IpcDesktopEnvironmentTest::ResetRemoteUrlForwarderConfigurator() {}

void IpcDesktopEnvironmentTest::OnDisconnectCallback() {}

void IpcDesktopEnvironmentTest::ConnectDesktopChannel(
    mojo::ScopedMessagePipeHandle desktop_pipe) {}

void IpcDesktopEnvironmentTest::RunMainLoopUntilDone() {}

void IpcDesktopEnvironmentTest::QuitSetupRunLoop() {}

// Runs until the desktop is attached and exits immediately after that.
TEST_F(IpcDesktopEnvironmentTest, Basic) {}

// Check touchEvents capability is set when the desktop environment can
// inject touch events.
TEST_F(IpcDesktopEnvironmentTest, TouchEventsCapabilities) {}

// Tests that the video capturer receives a frame over IPC.
TEST_F(IpcDesktopEnvironmentTest, CaptureFrame) {}

// Tests that attaching to a new desktop works.
TEST_F(IpcDesktopEnvironmentTest, Reattach) {}

// Tests injection of clipboard events.
TEST_F(IpcDesktopEnvironmentTest, InjectClipboardEvent) {}

// Tests injection of key events.
TEST_F(IpcDesktopEnvironmentTest, InjectKeyEvent) {}

// Tests injection of text events.
TEST_F(IpcDesktopEnvironmentTest, InjectTextEvent) {}

// Tests injection of mouse events.
TEST_F(IpcDesktopEnvironmentTest, InjectMouseEvent) {}

// Tests injection of touch events.
TEST_F(IpcDesktopEnvironmentTest, InjectTouchEvent) {}

// Tests that setting the desktop resolution works.
TEST_F(IpcDesktopEnvironmentTest, SetScreenResolution) {}

TEST_F(IpcDesktopEnvironmentTest, CheckUrlForwarderState) {}

TEST_F(IpcDesktopEnvironmentTest, SetUpUrlForwarderHappyPath) {}

TEST_F(IpcDesktopEnvironmentTest, SetUpUrlForwarderFailed) {}

}  // namespace remoting