| 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 virtual ~MockPairingRegistryDelegate(); |
| 222 | 222 |
| 223 // PairingRegistry::Delegate implementation. | 223 // PairingRegistry::Delegate implementation. |
| 224 virtual scoped_ptr<base::ListValue> LoadAll() OVERRIDE; | 224 virtual scoped_ptr<base::ListValue> LoadAll() override; |
| 225 virtual bool DeleteAll() OVERRIDE; | 225 virtual bool DeleteAll() override; |
| 226 virtual protocol::PairingRegistry::Pairing Load( | 226 virtual 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 virtual bool Save(const protocol::PairingRegistry::Pairing& pairing) override; |
| 229 virtual bool Delete(const std::string& client_id) OVERRIDE; | 229 virtual 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 virtual ~SynchronousPairingRegistry(); |
| 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 virtual void PostTask( |
| 245 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 245 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 246 const tracked_objects::Location& from_here, | 246 const tracked_objects::Location& from_here, |
| 247 const base::Closure& task) OVERRIDE; | 247 const base::Closure& task) override; |
| 248 }; | 248 }; |
| 249 | 249 |
| 250 } // namespace protocol | 250 } // namespace protocol |
| 251 } // namespace remoting | 251 } // namespace remoting |
| 252 | 252 |
| 253 #endif // REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ | 253 #endif // REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ |
| OLD | NEW |