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

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

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 | « device/u2f/mock_u2f_device.h ('k') | device/u2f/u2f_device.h » ('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 #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
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
OLDNEW
« no previous file with comments | « device/u2f/mock_u2f_device.h ('k') | device/u2f/u2f_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698