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 <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 } | 211 } |
212 | 212 |
213 private: | 213 private: |
214 DISALLOW_COPY_AND_ASSIGN(MockSessionManager); | 214 DISALLOW_COPY_AND_ASSIGN(MockSessionManager); |
215 }; | 215 }; |
216 | 216 |
217 // Simple delegate that caches information on paired clients in memory. | 217 // Simple delegate that caches information on paired clients in memory. |
218 class MockPairingRegistryDelegate : public PairingRegistry::Delegate { | 218 class MockPairingRegistryDelegate : public PairingRegistry::Delegate { |
219 public: | 219 public: |
220 MockPairingRegistryDelegate(); | 220 MockPairingRegistryDelegate(); |
221 virtual ~MockPairingRegistryDelegate(); | 221 ~MockPairingRegistryDelegate() override; |
222 | 222 |
223 // PairingRegistry::Delegate implementation. | 223 // PairingRegistry::Delegate implementation. |
224 virtual scoped_ptr<base::ListValue> LoadAll() override; | 224 scoped_ptr<base::ListValue> LoadAll() override; |
225 virtual bool DeleteAll() override; | 225 bool DeleteAll() override; |
226 virtual protocol::PairingRegistry::Pairing Load( | 226 protocol::PairingRegistry::Pairing Load( |
227 const std::string& client_id) override; | 227 const std::string& client_id) override; |
228 virtual bool Save(const protocol::PairingRegistry::Pairing& pairing) override; | 228 bool Save(const protocol::PairingRegistry::Pairing& pairing) override; |
229 virtual bool Delete(const std::string& client_id) override; | 229 bool Delete(const std::string& client_id) override; |
230 | 230 |
231 private: | 231 private: |
232 typedef std::map<std::string, protocol::PairingRegistry::Pairing> Pairings; | 232 typedef std::map<std::string, protocol::PairingRegistry::Pairing> Pairings; |
233 Pairings pairings_; | 233 Pairings pairings_; |
234 }; | 234 }; |
235 | 235 |
236 class SynchronousPairingRegistry : public PairingRegistry { | 236 class SynchronousPairingRegistry : public PairingRegistry { |
237 public: | 237 public: |
238 explicit SynchronousPairingRegistry(scoped_ptr<Delegate> delegate); | 238 explicit SynchronousPairingRegistry(scoped_ptr<Delegate> delegate); |
239 | 239 |
240 protected: | 240 protected: |
241 virtual ~SynchronousPairingRegistry(); | 241 ~SynchronousPairingRegistry() override; |
242 | 242 |
243 // Runs tasks synchronously instead of posting them to |task_runner|. | 243 // Runs tasks synchronously instead of posting them to |task_runner|. |
244 virtual void PostTask( | 244 void PostTask(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
245 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 245 const tracked_objects::Location& from_here, |
246 const tracked_objects::Location& from_here, | 246 const base::Closure& task) override; |
247 const base::Closure& task) override; | |
248 }; | 247 }; |
249 | 248 |
250 } // namespace protocol | 249 } // namespace protocol |
251 } // namespace remoting | 250 } // namespace remoting |
252 | 251 |
253 #endif // REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ | 252 #endif // REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ |
OLD | NEW |