OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "remoting/protocol/protocol_mock_objects.h" | 5 #include "remoting/protocol/protocol_mock_objects.h" |
6 | 6 |
7 #include "base/message_loop/message_loop_proxy.h" | |
8 #include "net/base/ip_endpoint.h" | |
9 #include "remoting/protocol/transport.h" | |
10 | |
11 namespace remoting { | 7 namespace remoting { |
12 namespace protocol { | 8 namespace protocol { |
13 | 9 |
14 MockConnectionToClient::MockConnectionToClient( | 10 MockConnectionToClient::MockConnectionToClient( |
15 Session* session, | 11 Session* session, |
16 HostStub* host_stub) | 12 HostStub* host_stub) |
17 : ConnectionToClient(session) { | 13 : ConnectionToClient(session) { |
18 set_host_stub(host_stub); | 14 set_host_stub(host_stub); |
19 } | 15 } |
20 | 16 |
(...skipping 24 matching lines...) Expand all Loading... |
45 MockVideoStub::~MockVideoStub() {} | 41 MockVideoStub::~MockVideoStub() {} |
46 | 42 |
47 MockSession::MockSession() {} | 43 MockSession::MockSession() {} |
48 | 44 |
49 MockSession::~MockSession() {} | 45 MockSession::~MockSession() {} |
50 | 46 |
51 MockSessionManager::MockSessionManager() {} | 47 MockSessionManager::MockSessionManager() {} |
52 | 48 |
53 MockSessionManager::~MockSessionManager() {} | 49 MockSessionManager::~MockSessionManager() {} |
54 | 50 |
| 51 MockPairingRegistryDelegate::MockPairingRegistryDelegate() { |
| 52 } |
| 53 |
| 54 MockPairingRegistryDelegate::~MockPairingRegistryDelegate() { |
| 55 } |
| 56 |
| 57 void MockPairingRegistryDelegate::AddPairing( |
| 58 const PairingRegistry::Pairing& new_paired_client) { |
| 59 paired_clients_[new_paired_client.client_id] = new_paired_client; |
| 60 } |
| 61 |
| 62 void MockPairingRegistryDelegate::GetPairing( |
| 63 const std::string& client_id, |
| 64 const PairingRegistry::GetPairingCallback& callback) { |
| 65 PairingRegistry::Pairing result; |
| 66 PairingRegistry::PairedClients::const_iterator i = |
| 67 paired_clients_.find(client_id); |
| 68 if (i != paired_clients_.end()) { |
| 69 result = i->second; |
| 70 } |
| 71 saved_callback_ = base::Bind(base::Bind(callback), result); |
| 72 } |
| 73 |
| 74 void MockPairingRegistryDelegate::RunCallback() { |
| 75 DCHECK(!saved_callback_.is_null()); |
| 76 saved_callback_.Run(); |
| 77 saved_callback_.Reset(); |
| 78 } |
| 79 |
55 } // namespace protocol | 80 } // namespace protocol |
56 } // namespace remoting | 81 } // namespace remoting |
OLD | NEW |