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