OLD | NEW |
| (Empty) |
1 // Copyright 2016 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 REMOTING_HOST_SECURITY_KEY_FAKE_REMOTE_SECURITY_KEY_MESSAGE_READER_H_ | |
6 #define REMOTING_HOST_SECURITY_KEY_FAKE_REMOTE_SECURITY_KEY_MESSAGE_READER_H_ | |
7 | |
8 #include "base/callback.h" | |
9 #include "base/macros.h" | |
10 #include "base/memory/weak_ptr.h" | |
11 #include "remoting/host/security_key/remote_security_key_message_reader.h" | |
12 #include "remoting/host/security_key/security_key_message.h" | |
13 | |
14 namespace remoting { | |
15 | |
16 // Simulates the RemoteSecurityKeyMessageReader and provides access to data | |
17 // members for testing. | |
18 class FakeRemoteSecurityKeyMessageReader | |
19 : public RemoteSecurityKeyMessageReader { | |
20 public: | |
21 FakeRemoteSecurityKeyMessageReader(); | |
22 ~FakeRemoteSecurityKeyMessageReader() override; | |
23 | |
24 // RemoteSecurityKeyMessageReader interface. | |
25 void Start(const SecurityKeyMessageCallback& message_callback, | |
26 const base::Closure& error_callback) override; | |
27 | |
28 base::WeakPtr<FakeRemoteSecurityKeyMessageReader> AsWeakPtr(); | |
29 | |
30 const SecurityKeyMessageCallback& message_callback() { | |
31 return message_callback_; | |
32 } | |
33 | |
34 const base::Closure& error_callback() { return error_callback_; } | |
35 | |
36 private: | |
37 // Caller-supplied message and error callbacks. | |
38 SecurityKeyMessageCallback message_callback_; | |
39 base::Closure error_callback_; | |
40 | |
41 base::WeakPtrFactory<FakeRemoteSecurityKeyMessageReader> weak_factory_; | |
42 | |
43 DISALLOW_COPY_AND_ASSIGN(FakeRemoteSecurityKeyMessageReader); | |
44 }; | |
45 | |
46 } // namespace remoting | |
47 | |
48 #endif // REMOTING_HOST_SECURITY_KEY_FAKE_REMOTE_SECURITY_KEY_MESSAGE_READER_H_ | |
OLD | NEW |