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 #ifndef DEVICE_U2F_MOCK_U2F_DEVICE_H_ |
| 6 #define DEVICE_U2F_MOCK_U2F_DEVICE_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/memory/ptr_util.h" |
| 11 #include "testing/gmock/include/gmock/gmock.h" |
| 12 #include "u2f_apdu_command.h" |
| 13 #include "u2f_device.h" |
| 14 |
| 15 namespace device { |
| 16 |
| 17 class MockU2fDevice : public U2fDevice { |
| 18 public: |
| 19 static constexpr uint8_t kSign = 0x1; |
| 20 static constexpr uint8_t kRegister = 0x5; |
| 21 |
| 22 MockU2fDevice(); |
| 23 ~MockU2fDevice() override; |
| 24 |
| 25 MOCK_METHOD1(TryWink, void(const WinkCallback& cb)); |
| 26 MOCK_METHOD0(GetId, std::string(void)); |
| 27 // GMock cannot mock a method taking a std::unique_ptr<T> |
| 28 MOCK_METHOD2(DeviceTransactPtr, |
| 29 void(U2fApduCommand* command, const DeviceCallback& cb)); |
| 30 void DeviceTransact(std::unique_ptr<U2fApduCommand> command, |
| 31 const DeviceCallback& cb) override; |
| 32 static void TransactNoError(std::unique_ptr<U2fApduCommand> command, |
| 33 const DeviceCallback& cb); |
| 34 static void NotSatisfied(U2fApduCommand* cmd, const DeviceCallback& cb); |
| 35 static void WrongData(U2fApduCommand* cmd, const DeviceCallback& cb); |
| 36 static void NoErrorSign(U2fApduCommand* cmd, const DeviceCallback& cb); |
| 37 static void NoErrorRegister(U2fApduCommand* cmd, const DeviceCallback& cb); |
| 38 static void WinkDoNothing(const WinkCallback& cb); |
| 39 }; |
| 40 |
| 41 } // namespace device |
| 42 |
| 43 #endif // DEVICE_U2F_MOCK_U2F_DEVICE_H_ |
OLD | NEW |