| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "mock_u2f_device.h" | 5 #include "mock_u2f_device.h" |
| 6 | 6 |
| 7 namespace device { | 7 namespace device { |
| 8 | 8 |
| 9 MockU2fDevice::MockU2fDevice() {} | 9 MockU2fDevice::MockU2fDevice() : weak_factory_(this) {} |
| 10 | 10 |
| 11 MockU2fDevice::~MockU2fDevice() {} | 11 MockU2fDevice::~MockU2fDevice() {} |
| 12 | 12 |
| 13 void MockU2fDevice::DeviceTransact(std::unique_ptr<U2fApduCommand> command, | 13 void MockU2fDevice::DeviceTransact(std::unique_ptr<U2fApduCommand> command, |
| 14 const DeviceCallback& cb) { | 14 const DeviceCallback& cb) { |
| 15 DeviceTransactPtr(command.get(), cb); | 15 DeviceTransactPtr(command.get(), cb); |
| 16 } | 16 } |
| 17 | 17 |
| 18 // static | 18 // static |
| 19 void MockU2fDevice::NotSatisfied(U2fApduCommand* cmd, | 19 void MockU2fDevice::NotSatisfied(U2fApduCommand* cmd, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 43 cb.Run(true, base::MakeUnique<U2fApduResponse>( | 43 cb.Run(true, base::MakeUnique<U2fApduResponse>( |
| 44 std::vector<uint8_t>({kRegister}), | 44 std::vector<uint8_t>({kRegister}), |
| 45 U2fApduResponse::Status::SW_NO_ERROR)); | 45 U2fApduResponse::Status::SW_NO_ERROR)); |
| 46 } | 46 } |
| 47 | 47 |
| 48 // static | 48 // static |
| 49 void MockU2fDevice::WinkDoNothing(const WinkCallback& cb) { | 49 void MockU2fDevice::WinkDoNothing(const WinkCallback& cb) { |
| 50 cb.Run(); | 50 cb.Run(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 base::WeakPtr<U2fDevice> MockU2fDevice::GetWeakPtr() { |
| 54 return weak_factory_.GetWeakPtr(); |
| 55 } |
| 56 |
| 53 } // namespace device | 57 } // namespace device |
| OLD | NEW |