| Index: device/u2f/mock_u2f_device.cc
|
| diff --git a/device/u2f/mock_u2f_device.cc b/device/u2f/mock_u2f_device.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..4f8bdc46f0e691c9c5febcdbde713c7c4d9dbd61
|
| --- /dev/null
|
| +++ b/device/u2f/mock_u2f_device.cc
|
| @@ -0,0 +1,53 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "mock_u2f_device.h"
|
| +
|
| +namespace device {
|
| +
|
| +MockU2fDevice::MockU2fDevice() {}
|
| +
|
| +MockU2fDevice::~MockU2fDevice() {}
|
| +
|
| +void MockU2fDevice::DeviceTransact(std::unique_ptr<U2fApduCommand> command,
|
| + const DeviceCallback& cb) {
|
| + DeviceTransactPtr(command.get(), cb);
|
| +}
|
| +
|
| +// static
|
| +void MockU2fDevice::NotSatisfied(U2fApduCommand* cmd,
|
| + const DeviceCallback& cb) {
|
| + cb.Run(true, base::MakeUnique<U2fApduResponse>(
|
| + std::vector<uint8_t>(),
|
| + U2fApduResponse::Status::SW_CONDITIONS_NOT_SATISFIED));
|
| +}
|
| +
|
| +// static
|
| +void MockU2fDevice::WrongData(U2fApduCommand* cmd, const DeviceCallback& cb) {
|
| + cb.Run(true,
|
| + base::MakeUnique<U2fApduResponse>(
|
| + std::vector<uint8_t>(), U2fApduResponse::Status::SW_WRONG_DATA));
|
| +}
|
| +
|
| +// static
|
| +void MockU2fDevice::NoErrorSign(U2fApduCommand* cmd, const DeviceCallback& cb) {
|
| + cb.Run(true, base::MakeUnique<U2fApduResponse>(
|
| + std::vector<uint8_t>({kSign}),
|
| + U2fApduResponse::Status::SW_NO_ERROR));
|
| +}
|
| +
|
| +// static
|
| +void MockU2fDevice::NoErrorRegister(U2fApduCommand* cmd,
|
| + const DeviceCallback& cb) {
|
| + cb.Run(true, base::MakeUnique<U2fApduResponse>(
|
| + std::vector<uint8_t>({kRegister}),
|
| + U2fApduResponse::Status::SW_NO_ERROR));
|
| +}
|
| +
|
| +// static
|
| +void MockU2fDevice::WinkDoNothing(const WinkCallback& cb) {
|
| + cb.Run();
|
| +}
|
| +
|
| +} // namespace device
|
|
|