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 #ifndef REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ | 5 #ifndef REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ |
6 #define REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ | 6 #define REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "net/base/ip_endpoint.h" | 10 #include "net/base/ip_endpoint.h" |
11 #include "remoting/proto/internal.pb.h" | 11 #include "remoting/proto/internal.pb.h" |
12 #include "remoting/proto/video.pb.h" | 12 #include "remoting/proto/video.pb.h" |
13 #include "remoting/protocol/authenticator.h" | 13 #include "remoting/protocol/authenticator.h" |
14 #include "remoting/protocol/client_stub.h" | 14 #include "remoting/protocol/client_stub.h" |
15 #include "remoting/protocol/clipboard_stub.h" | 15 #include "remoting/protocol/clipboard_stub.h" |
16 #include "remoting/protocol/connection_to_client.h" | 16 #include "remoting/protocol/connection_to_client.h" |
17 #include "remoting/protocol/host_stub.h" | 17 #include "remoting/protocol/host_stub.h" |
18 #include "remoting/protocol/input_stub.h" | 18 #include "remoting/protocol/input_stub.h" |
| 19 #include "remoting/protocol/pairing_registry.h" |
19 #include "remoting/protocol/session.h" | 20 #include "remoting/protocol/session.h" |
20 #include "remoting/protocol/session_manager.h" | 21 #include "remoting/protocol/session_manager.h" |
21 #include "remoting/protocol/transport.h" | 22 #include "remoting/protocol/transport.h" |
22 #include "remoting/protocol/video_stub.h" | 23 #include "remoting/protocol/video_stub.h" |
23 #include "testing/gmock/include/gmock/gmock.h" | 24 #include "testing/gmock/include/gmock/gmock.h" |
24 | 25 |
25 namespace remoting { | 26 namespace remoting { |
26 namespace protocol { | 27 namespace protocol { |
27 | 28 |
28 class MockConnectionToClient : public ConnectionToClient { | 29 class MockConnectionToClient : public ConnectionToClient { |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 }; | 197 }; |
197 virtual void set_authenticator_factory( | 198 virtual void set_authenticator_factory( |
198 scoped_ptr<AuthenticatorFactory> authenticator_factory) { | 199 scoped_ptr<AuthenticatorFactory> authenticator_factory) { |
199 set_authenticator_factory_ptr(authenticator_factory.release()); | 200 set_authenticator_factory_ptr(authenticator_factory.release()); |
200 }; | 201 }; |
201 | 202 |
202 private: | 203 private: |
203 DISALLOW_COPY_AND_ASSIGN(MockSessionManager); | 204 DISALLOW_COPY_AND_ASSIGN(MockSessionManager); |
204 }; | 205 }; |
205 | 206 |
| 207 // Simple delegate that caches information on paired clients in memory. |
| 208 class MockPairingRegistryDelegate : public PairingRegistry::Delegate { |
| 209 public: |
| 210 MockPairingRegistryDelegate(); |
| 211 virtual ~MockPairingRegistryDelegate(); |
| 212 |
| 213 const PairingRegistry::PairedClients& paired_clients() const { |
| 214 return paired_clients_; |
| 215 } |
| 216 |
| 217 // PairingRegistry::Delegate implementation. |
| 218 virtual void AddPairing( |
| 219 const PairingRegistry::Pairing& new_paired_client) OVERRIDE; |
| 220 virtual void GetPairing( |
| 221 const std::string& client_id, |
| 222 const PairingRegistry::GetPairingCallback& callback) OVERRIDE; |
| 223 |
| 224 void RunCallback(); |
| 225 |
| 226 private: |
| 227 base::Closure saved_callback_; |
| 228 PairingRegistry::PairedClients paired_clients_; |
| 229 }; |
| 230 |
206 } // namespace protocol | 231 } // namespace protocol |
207 } // namespace remoting | 232 } // namespace remoting |
208 | 233 |
209 #endif // REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ | 234 #endif // REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ |
OLD | NEW |