OLD | NEW |
| (Empty) |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "mock_u2f_device.h" | |
6 | |
7 namespace device { | |
8 | |
9 MockU2fDevice::MockU2fDevice() {} | |
10 | |
11 MockU2fDevice::~MockU2fDevice() {} | |
12 | |
13 void MockU2fDevice::DeviceTransact(std::unique_ptr<U2fApduCommand> command, | |
14 const DeviceCallback& cb) { | |
15 DeviceTransactPtr(command.get(), cb); | |
16 } | |
17 | |
18 // static | |
19 void MockU2fDevice::NotSatisfied(U2fApduCommand* cmd, | |
20 const DeviceCallback& cb) { | |
21 cb.Run(true, base::MakeUnique<U2fApduResponse>( | |
22 std::vector<uint8_t>(), | |
23 U2fApduResponse::Status::SW_CONDITIONS_NOT_SATISFIED)); | |
24 } | |
25 | |
26 // static | |
27 void MockU2fDevice::WrongData(U2fApduCommand* cmd, const DeviceCallback& cb) { | |
28 cb.Run(true, | |
29 base::MakeUnique<U2fApduResponse>( | |
30 std::vector<uint8_t>(), U2fApduResponse::Status::SW_WRONG_DATA)); | |
31 } | |
32 | |
33 // static | |
34 void MockU2fDevice::NoErrorSign(U2fApduCommand* cmd, const DeviceCallback& cb) { | |
35 cb.Run(true, base::MakeUnique<U2fApduResponse>( | |
36 std::vector<uint8_t>({kSign}), | |
37 U2fApduResponse::Status::SW_NO_ERROR)); | |
38 } | |
39 | |
40 // static | |
41 void MockU2fDevice::NoErrorRegister(U2fApduCommand* cmd, | |
42 const DeviceCallback& cb) { | |
43 cb.Run(true, base::MakeUnique<U2fApduResponse>( | |
44 std::vector<uint8_t>({kRegister}), | |
45 U2fApduResponse::Status::SW_NO_ERROR)); | |
46 } | |
47 | |
48 // static | |
49 void MockU2fDevice::WinkDoNothing(const WinkCallback& cb) { | |
50 cb.Run(); | |
51 } | |
52 | |
53 } // namespace device | |
OLD | NEW |