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

Unified Diff: device/u2f/mock_u2f_device.h

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/u2f/BUILD.gn ('k') | device/u2f/mock_u2f_device.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/u2f/mock_u2f_device.h
diff --git a/device/u2f/mock_u2f_device.h b/device/u2f/mock_u2f_device.h
new file mode 100644
index 0000000000000000000000000000000000000000..f4e65da0524418633169f24d71ed0e8c4e996eca
--- /dev/null
+++ b/device/u2f/mock_u2f_device.h
@@ -0,0 +1,43 @@
+// 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.
+
+#ifndef DEVICE_U2F_MOCK_U2F_DEVICE_H_
+#define DEVICE_U2F_MOCK_U2F_DEVICE_H_
+
+#include <vector>
+
+#include "base/memory/ptr_util.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "u2f_apdu_command.h"
+#include "u2f_device.h"
+
+namespace device {
+
+class MockU2fDevice : public U2fDevice {
+ public:
+ static constexpr uint8_t kSign = 0x1;
+ static constexpr uint8_t kRegister = 0x5;
+
+ MockU2fDevice();
+ ~MockU2fDevice() override;
+
+ MOCK_METHOD1(TryWink, void(const WinkCallback& cb));
+ MOCK_METHOD0(GetId, std::string(void));
+ // GMock cannot mock a method taking a std::unique_ptr<T>
+ MOCK_METHOD2(DeviceTransactPtr,
+ void(U2fApduCommand* command, const DeviceCallback& cb));
+ void DeviceTransact(std::unique_ptr<U2fApduCommand> command,
+ const DeviceCallback& cb) override;
+ static void TransactNoError(std::unique_ptr<U2fApduCommand> command,
+ const DeviceCallback& cb);
+ static void NotSatisfied(U2fApduCommand* cmd, const DeviceCallback& cb);
+ static void WrongData(U2fApduCommand* cmd, const DeviceCallback& cb);
+ static void NoErrorSign(U2fApduCommand* cmd, const DeviceCallback& cb);
+ static void NoErrorRegister(U2fApduCommand* cmd, const DeviceCallback& cb);
+ static void WinkDoNothing(const WinkCallback& cb);
+};
+
+} // namespace device
+
+#endif // DEVICE_U2F_MOCK_U2F_DEVICE_H_
« no previous file with comments | « device/u2f/BUILD.gn ('k') | device/u2f/mock_u2f_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698