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