diff options
Diffstat (limited to 'remoting/protocol/protocol_mock_objects.cc')
-rw-r--r-- | remoting/protocol/protocol_mock_objects.cc | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/remoting/protocol/protocol_mock_objects.cc b/remoting/protocol/protocol_mock_objects.cc index 072cf3c..eb4022a 100644 --- a/remoting/protocol/protocol_mock_objects.cc +++ b/remoting/protocol/protocol_mock_objects.cc @@ -4,10 +4,6 @@ #include "remoting/protocol/protocol_mock_objects.h" -#include "base/message_loop/message_loop_proxy.h" -#include "net/base/ip_endpoint.h" -#include "remoting/protocol/transport.h" - namespace remoting { namespace protocol { @@ -52,5 +48,34 @@ MockSessionManager::MockSessionManager() {} MockSessionManager::~MockSessionManager() {} +MockPairingRegistryDelegate::MockPairingRegistryDelegate() { +} + +MockPairingRegistryDelegate::~MockPairingRegistryDelegate() { +} + +void MockPairingRegistryDelegate::AddPairing( + const PairingRegistry::Pairing& new_paired_client) { + paired_clients_[new_paired_client.client_id] = new_paired_client; +} + +void MockPairingRegistryDelegate::GetPairing( + const std::string& client_id, + const PairingRegistry::GetPairingCallback& callback) { + PairingRegistry::Pairing result; + PairingRegistry::PairedClients::const_iterator i = + paired_clients_.find(client_id); + if (i != paired_clients_.end()) { + result = i->second; + } + saved_callback_ = base::Bind(base::Bind(callback), result); +} + +void MockPairingRegistryDelegate::RunCallback() { + DCHECK(!saved_callback_.is_null()); + saved_callback_.Run(); + saved_callback_.Reset(); +} + } // namespace protocol } // namespace remoting |