#include "device/fido/mock_fido_device.h"
#include <utility>
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/strings/strcat.h"
#include "base/task/single_thread_task_runner.h"
#include "components/apdu/apdu_response.h"
#include "components/cbor/writer.h"
#include "device/fido/device_response_converter.h"
#include "device/fido/fido_constants.h"
#include "device/fido/fido_parsing_utils.h"
#include "device/fido/fido_test_data.h"
namespace device {
namespace {
AuthenticatorGetInfoResponse DefaultAuthenticatorInfo() { … }
}
std::unique_ptr<MockFidoDevice> MockFidoDevice::MakeU2f() { … }
std::unique_ptr<MockFidoDevice> MockFidoDevice::MakeCtap(
std::optional<AuthenticatorGetInfoResponse> device_info) { … }
std::unique_ptr<MockFidoDevice>
MockFidoDevice::MakeU2fWithGetInfoExpectation() { … }
std::unique_ptr<MockFidoDevice> MockFidoDevice::MakeCtapWithGetInfoExpectation(
std::optional<base::span<const uint8_t>> get_info_response) { … }
std::vector<uint8_t> MockFidoDevice::EncodeCBORRequest(
std::pair<CtapRequestCommand, std::optional<cbor::Value>> request) { … }
MATCHER_P(IsCtap2Command, expected_command, "") { … }
MockFidoDevice::MockFidoDevice() = default;
MockFidoDevice::MockFidoDevice(
ProtocolVersion protocol_version,
std::optional<AuthenticatorGetInfoResponse> device_info)
: … { … }
MockFidoDevice::~MockFidoDevice() = default;
FidoDevice::CancelToken MockFidoDevice::DeviceTransact(
std::vector<uint8_t> command,
DeviceCallback cb) { … }
void MockFidoDevice::TryWink(base::OnceClosure cb) { … }
FidoTransportProtocol MockFidoDevice::DeviceTransport() const { … }
base::WeakPtr<FidoDevice> MockFidoDevice::GetWeakPtr() { … }
void MockFidoDevice::ExpectWinkedAtLeastOnce() { … }
void MockFidoDevice::StubGetId() { … }
void MockFidoDevice::ExpectCtap2CommandAndRespondWith(
CtapRequestCommand command,
std::optional<base::span<const uint8_t>> response,
base::TimeDelta delay,
testing::Matcher<base::span<const uint8_t>> request_matcher) { … }
void MockFidoDevice::ExpectCtap2CommandAndRespondWithError(
CtapRequestCommand command,
CtapDeviceResponseCode response_code,
base::TimeDelta delay) { … }
void MockFidoDevice::ExpectRequestAndRespondWith(
base::span<const uint8_t> request,
std::optional<base::span<const uint8_t>> response,
base::TimeDelta delay) { … }
void MockFidoDevice::ExpectCtap2CommandAndDoNotRespond(
CtapRequestCommand command) { … }
void MockFidoDevice::ExpectRequestAndDoNotRespond(
base::span<const uint8_t> request) { … }
void MockFidoDevice::SetDeviceTransport(
FidoTransportProtocol transport_protocol) { … }
void MockFidoDevice::StubGetDisplayName() { … }
}