#include "device/fido/hid/fake_hid_impl_for_testing.h"
#include <utility>
#include "base/containers/contains.h"
#include "base/functional/callback_helpers.h"
#include "device/fido/fido_parsing_utils.h"
#include "device/fido/hid/fido_hid_discovery.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "services/device/public/cpp/hid/hid_blocklist.h"
#include "services/device/public/mojom/hid.mojom.h"
namespace device {
namespace {
MATCHER_P(IsCtapHidCommand, expected_command, "") { … }
}
MockFidoHidConnection::MockFidoHidConnection(
device::mojom::HidDeviceInfoPtr device,
mojo::PendingReceiver<device::mojom::HidConnection> receiver,
std::array<uint8_t, 4> connection_channel_id)
: … { … }
MockFidoHidConnection::~MockFidoHidConnection() { … }
void MockFidoHidConnection::Read(ReadCallback callback) { … }
void MockFidoHidConnection::Write(uint8_t report_id,
const std::vector<uint8_t>& buffer,
WriteCallback callback) { … }
void MockFidoHidConnection::GetFeatureReport(
uint8_t report_id,
GetFeatureReportCallback callback) { … }
void MockFidoHidConnection::SendFeatureReport(
uint8_t report_id,
const std::vector<uint8_t>& buffer,
SendFeatureReportCallback callback) { … }
void MockFidoHidConnection::SetNonce(base::span<uint8_t const> nonce) { … }
void MockFidoHidConnection::ExpectWriteHidInit() { … }
void MockFidoHidConnection::ExpectWriteHidInit(
const testing::Sequence& sequence) { … }
void MockFidoHidConnection::ExpectHidWriteWithCommand(
FidoHidDeviceCommand cmd) { … }
void MockFidoHidConnection::ExpectHidWriteWithCommand(
const testing::Sequence& sequence,
FidoHidDeviceCommand cmd) { … }
void MockFidoHidConnection::ExpectReadAndReplyWith(
const testing::Sequence& sequence,
std::vector<uint8_t> response) { … }
bool FakeFidoHidConnection::mock_connection_error_ = …;
FakeFidoHidConnection::FakeFidoHidConnection(
device::mojom::HidDeviceInfoPtr device)
: … { … }
FakeFidoHidConnection::~FakeFidoHidConnection() = default;
void FakeFidoHidConnection::Read(ReadCallback callback) { … }
void FakeFidoHidConnection::Write(uint8_t report_id,
const std::vector<uint8_t>& buffer,
WriteCallback callback) { … }
void FakeFidoHidConnection::GetFeatureReport(
uint8_t report_id,
GetFeatureReportCallback callback) { … }
void FakeFidoHidConnection::SendFeatureReport(
uint8_t report_id,
const std::vector<uint8_t>& buffer,
SendFeatureReportCallback callback) { … }
FakeFidoHidManager::FakeFidoHidManager() = default;
FakeFidoHidManager::~FakeFidoHidManager() = default;
void FakeFidoHidManager::AddReceiver(
mojo::PendingReceiver<device::mojom::HidManager> receiver) { … }
void FakeFidoHidManager::AddFidoHidDevice(std::string guid) { … }
void FakeFidoHidManager::GetDevicesAndSetClient(
mojo::PendingAssociatedRemote<device::mojom::HidManagerClient> client,
GetDevicesCallback callback) { … }
void FakeFidoHidManager::GetDevices(GetDevicesCallback callback) { … }
void FakeFidoHidManager::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) { … }
void FakeFidoHidManager::AddDevice(device::mojom::HidDeviceInfoPtr device) { … }
void FakeFidoHidManager::AddDeviceAndSetConnection(
device::mojom::HidDeviceInfoPtr device,
mojo::PendingRemote<device::mojom::HidConnection> connection) { … }
void FakeFidoHidManager::RemoveDevice(const std::string device_guid) { … }
void FakeFidoHidManager::ChangeDevice(device::mojom::HidDeviceInfoPtr device) { … }
ScopedFakeFidoHidManager::ScopedFakeFidoHidManager() { … }
ScopedFakeFidoHidManager::~ScopedFakeFidoHidManager() { … }
}