chromium/services/device/public/cpp/test/fake_hid_manager.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "services/device/public/cpp/test/fake_hid_manager.h"

#include <memory>
#include <utility>

#include "base/containers/contains.h"
#include "base/uuid.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "services/device/public/cpp/hid/hid_blocklist.h"

namespace device {

namespace {

bool IsFidoReport(uint8_t report_id, const mojom::HidDeviceInfo& device_info) {}

}  // namespace

FakeHidConnection::FakeHidConnection(
    mojom::HidDeviceInfoPtr device,
    mojo::PendingReceiver<mojom::HidConnection> receiver,
    mojo::PendingRemote<mojom::HidConnectionClient> connection_client,
    mojo::PendingRemote<mojom::HidConnectionWatcher> watcher,
    bool allow_fido_reports)
    :{}

FakeHidConnection::~FakeHidConnection() = default;

// mojom::HidConnection implementation:
void FakeHidConnection::Read(ReadCallback callback) {}

void FakeHidConnection::Write(uint8_t report_id,
                              const std::vector<uint8_t>& buffer,
                              WriteCallback callback) {}

void FakeHidConnection::GetFeatureReport(uint8_t report_id,
                                         GetFeatureReportCallback callback) {}

void FakeHidConnection::SendFeatureReport(uint8_t report_id,
                                          const std::vector<uint8_t>& buffer,
                                          SendFeatureReportCallback callback) {}

// Implementation of FakeHidManager.
FakeHidManager::FakeHidManager() = default;
FakeHidManager::~FakeHidManager() = default;

void FakeHidManager::Bind(mojo::PendingReceiver<mojom::HidManager> receiver) {}

// mojom::HidManager implementation:
void FakeHidManager::AddReceiver(
    mojo::PendingReceiver<mojom::HidManager> receiver) {}

void FakeHidManager::GetDevicesAndSetClient(
    mojo::PendingAssociatedRemote<mojom::HidManagerClient> client,
    GetDevicesCallback callback) {}

void FakeHidManager::GetDevices(GetDevicesCallback callback) {}

void FakeHidManager::Connect(
    const std::string& device_guid,
    mojo::PendingRemote<mojom::HidConnectionClient> connection_client,
    mojo::PendingRemote<mojom::HidConnectionWatcher> watcher,
    bool allow_protected_reports,
    bool allow_fido_reports,
    ConnectCallback callback) {}

mojom::HidDeviceInfoPtr FakeHidManager::CreateAndAddDevice(
    const std::string& physical_device_id,
    uint16_t vendor_id,
    uint16_t product_id,
    const std::string& product_name,
    const std::string& serial_number,
    mojom::HidBusType bus_type) {}

mojom::HidDeviceInfoPtr FakeHidManager::CreateAndAddDeviceWithTopLevelUsage(
    const std::string& physical_device_id,
    uint16_t vendor_id,
    uint16_t product_id,
    const std::string& product_name,
    const std::string& serial_number,
    mojom::HidBusType bus_type,
    uint16_t usage_page,
    uint16_t usage) {}

void FakeHidManager::AddDevice(mojom::HidDeviceInfoPtr device) {}

void FakeHidManager::RemoveDevice(const std::string& guid) {}

void FakeHidManager::ChangeDevice(mojom::HidDeviceInfoPtr device) {}

void FakeHidManager::SimulateConnectionError() {}

}  // namespace device