#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "remoting/host/security_key/security_key_extension_session.h"
#include <stddef.h>
#include <memory>
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
#include "base/json/json_writer.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/task_environment.h"
#include "base/timer/mock_timer.h"
#include "base/values.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
#include "net/socket/unix_domain_client_socket_posix.h"
#include "remoting/host/client_session_details.h"
#include "remoting/host/host_mock_objects.h"
#include "remoting/host/security_key/security_key_auth_handler.h"
#include "remoting/proto/internal.pb.h"
#include "remoting/protocol/client_stub.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace remoting {
namespace {
const unsigned char kRequestData[] = …;
}
class TestClientStub : public protocol::ClientStub { … };
TestClientStub::TestClientStub() : … { … }
TestClientStub::~TestClientStub() = default;
void TestClientStub::SetCapabilities(
const protocol::Capabilities& capabilities) { … }
void TestClientStub::SetPairingResponse(
const protocol::PairingResponse& pairing_response) { … }
void TestClientStub::DeliverHostMessage(
const protocol::ExtensionMessage& message) { … }
void TestClientStub::SetVideoLayout(const protocol::VideoLayout& layout) { … }
void TestClientStub::SetTransportInfo(
const protocol::TransportInfo& transport_info) { … }
void TestClientStub::SetActiveDisplay(
const protocol::ActiveDisplay& active_display) { … }
void TestClientStub::InjectClipboardEvent(
const protocol::ClipboardEvent& event) { … }
void TestClientStub::SetCursorShape(
const protocol::CursorShapeInfo& cursor_shape) { … }
void TestClientStub::SetKeyboardLayout(const protocol::KeyboardLayout& layout) { … }
void TestClientStub::WaitForDeliverHostMessage(base::TimeDelta max_timeout) { … }
void TestClientStub::CheckHostDataMessage(int id, const std::string& data) { … }
class TestClientSessionDetails : public ClientSessionDetails { … };
TestClientSessionDetails::TestClientSessionDetails() = default;
TestClientSessionDetails::~TestClientSessionDetails() = default;
class SecurityKeyExtensionSessionTest : public testing::Test { … };
SecurityKeyExtensionSessionTest::SecurityKeyExtensionSessionTest()
: … { … }
SecurityKeyExtensionSessionTest::~SecurityKeyExtensionSessionTest() = default;
void SecurityKeyExtensionSessionTest::WaitForAndVerifyHostMessage() { … }
void SecurityKeyExtensionSessionTest::CreateSecurityKeyConnection() { … }
TEST_F(SecurityKeyExtensionSessionTest,
SecurityKeyConnectionCreated_ValidMessage) { … }
TEST_F(SecurityKeyExtensionSessionTest,
NoSecurityKeyConnectionCreated_WrongMessageType) { … }
TEST_F(SecurityKeyExtensionSessionTest,
NoSecurityKeyConnectionCreated_InvalidMessageData) { … }
TEST_F(SecurityKeyExtensionSessionTest,
DataMessageProcessing_MissingConnectionId) { … }
TEST_F(SecurityKeyExtensionSessionTest,
DataMessageProcessing_InvalidConnectionId) { … }
TEST_F(SecurityKeyExtensionSessionTest, DataMessageProcessing_MissingPayload) { … }
TEST_F(SecurityKeyExtensionSessionTest, DataMessageProcessing_InvalidPayload) { … }
TEST_F(SecurityKeyExtensionSessionTest, DataMessageProcessing_ValidData) { … }
TEST_F(SecurityKeyExtensionSessionTest,
ErrorMessageProcessing_MissingConnectionId) { … }
TEST_F(SecurityKeyExtensionSessionTest,
ErrorMessageProcessing_InvalidConnectionId) { … }
TEST_F(SecurityKeyExtensionSessionTest, ErrorMessageProcessing_ValidData) { … }
TEST_F(SecurityKeyExtensionSessionTest, SendMessageToClient_ValidData) { … }
}