Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(733)

Side by Side Diff: device/u2f/mock_u2f_device.cc

Issue 2821263005: Add U2F request state machines (Closed)
Patch Set: Call Start before adding devices Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « device/u2f/mock_u2f_device.h ('k') | device/u2f/u2f_apdu_response.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« no previous file with comments | « device/u2f/mock_u2f_device.h ('k') | device/u2f/u2f_apdu_response.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698