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

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

Issue 2842003002: Reuse WeakFactory from U2fDevice derived classes (Closed)
Patch Set: Created 3 years, 7 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 | « no previous file | device/u2f/mock_u2f_device.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef DEVICE_U2F_MOCK_U2F_DEVICE_H_ 5 #ifndef DEVICE_U2F_MOCK_U2F_DEVICE_H_
6 #define DEVICE_U2F_MOCK_U2F_DEVICE_H_ 6 #define DEVICE_U2F_MOCK_U2F_DEVICE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 11 matching lines...) Expand all
22 MockU2fDevice(); 22 MockU2fDevice();
23 ~MockU2fDevice() override; 23 ~MockU2fDevice() override;
24 24
25 MOCK_METHOD1(TryWink, void(const WinkCallback& cb)); 25 MOCK_METHOD1(TryWink, void(const WinkCallback& cb));
26 MOCK_METHOD0(GetId, std::string(void)); 26 MOCK_METHOD0(GetId, std::string(void));
27 // GMock cannot mock a method taking a std::unique_ptr<T> 27 // GMock cannot mock a method taking a std::unique_ptr<T>
28 MOCK_METHOD2(DeviceTransactPtr, 28 MOCK_METHOD2(DeviceTransactPtr,
29 void(U2fApduCommand* command, const DeviceCallback& cb)); 29 void(U2fApduCommand* command, const DeviceCallback& cb));
30 void DeviceTransact(std::unique_ptr<U2fApduCommand> command, 30 void DeviceTransact(std::unique_ptr<U2fApduCommand> command,
31 const DeviceCallback& cb) override; 31 const DeviceCallback& cb) override;
32 base::WeakPtr<U2fDevice> GetWeakPtr() override;
32 static void TransactNoError(std::unique_ptr<U2fApduCommand> command, 33 static void TransactNoError(std::unique_ptr<U2fApduCommand> command,
33 const DeviceCallback& cb); 34 const DeviceCallback& cb);
34 static void NotSatisfied(U2fApduCommand* cmd, const DeviceCallback& cb); 35 static void NotSatisfied(U2fApduCommand* cmd, const DeviceCallback& cb);
35 static void WrongData(U2fApduCommand* cmd, const DeviceCallback& cb); 36 static void WrongData(U2fApduCommand* cmd, const DeviceCallback& cb);
36 static void NoErrorSign(U2fApduCommand* cmd, const DeviceCallback& cb); 37 static void NoErrorSign(U2fApduCommand* cmd, const DeviceCallback& cb);
37 static void NoErrorRegister(U2fApduCommand* cmd, const DeviceCallback& cb); 38 static void NoErrorRegister(U2fApduCommand* cmd, const DeviceCallback& cb);
38 static void WinkDoNothing(const WinkCallback& cb); 39 static void WinkDoNothing(const WinkCallback& cb);
40
41 private:
42 base::WeakPtrFactory<U2fDevice> weak_factory_;
39 }; 43 };
40 44
41 } // namespace device 45 } // namespace device
42 46
43 #endif // DEVICE_U2F_MOCK_U2F_DEVICE_H_ 47 #endif // DEVICE_U2F_MOCK_U2F_DEVICE_H_
OLDNEW
« no previous file with comments | « no previous file | device/u2f/mock_u2f_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698