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 namespace remoting { | 7 namespace remoting { |
8 namespace protocol { | 8 namespace protocol { |
9 | 9 |
10 MockConnectionToClient::MockConnectionToClient( | 10 MockConnectionToClient::MockConnectionToClient( |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 MockSessionManager::~MockSessionManager() {} | 49 MockSessionManager::~MockSessionManager() {} |
50 | 50 |
51 MockPairingRegistryDelegate::MockPairingRegistryDelegate() { | 51 MockPairingRegistryDelegate::MockPairingRegistryDelegate() { |
52 } | 52 } |
53 | 53 |
54 MockPairingRegistryDelegate::~MockPairingRegistryDelegate() { | 54 MockPairingRegistryDelegate::~MockPairingRegistryDelegate() { |
55 } | 55 } |
56 | 56 |
57 void MockPairingRegistryDelegate::AddPairing( | 57 void MockPairingRegistryDelegate::AddPairing( |
58 const PairingRegistry::Pairing& new_paired_client) { | 58 const PairingRegistry::Pairing& new_paired_client, |
59 paired_clients_[new_paired_client.client_id] = new_paired_client; | 59 const PairingRegistry::AddPairingCallback& callback) { |
| 60 paired_clients_[new_paired_client.client_id()] = new_paired_client; |
| 61 if (!callback.is_null()) { |
| 62 callback.Run(true); |
| 63 } |
60 } | 64 } |
61 | 65 |
62 void MockPairingRegistryDelegate::GetPairing( | 66 void MockPairingRegistryDelegate::GetPairing( |
63 const std::string& client_id, | 67 const std::string& client_id, |
64 const PairingRegistry::GetPairingCallback& callback) { | 68 const PairingRegistry::GetPairingCallback& callback) { |
65 PairingRegistry::Pairing result; | 69 PairingRegistry::Pairing result; |
66 PairingRegistry::PairedClients::const_iterator i = | 70 PairingRegistry::PairedClients::const_iterator i = |
67 paired_clients_.find(client_id); | 71 paired_clients_.find(client_id); |
68 if (i != paired_clients_.end()) { | 72 if (i != paired_clients_.end()) { |
69 result = i->second; | 73 result = i->second; |
70 } | 74 } |
71 saved_callback_ = base::Bind(base::Bind(callback), result); | 75 saved_callback_ = base::Bind(base::Bind(callback), result); |
72 } | 76 } |
73 | 77 |
74 void MockPairingRegistryDelegate::RunCallback() { | 78 void MockPairingRegistryDelegate::RunCallback() { |
75 DCHECK(!saved_callback_.is_null()); | 79 DCHECK(!saved_callback_.is_null()); |
76 saved_callback_.Run(); | 80 saved_callback_.Run(); |
77 saved_callback_.Reset(); | 81 saved_callback_.Reset(); |
78 } | 82 } |
79 | 83 |
80 } // namespace protocol | 84 } // namespace protocol |
81 } // namespace remoting | 85 } // namespace remoting |
OLD | NEW |