| 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_FAKE_SESSION_H_ | 5 #ifndef REMOTING_PROTOCOL_FAKE_SESSION_H_ |
| 6 #define REMOTING_PROTOCOL_FAKE_SESSION_H_ | 6 #define REMOTING_PROTOCOL_FAKE_SESSION_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 class FakeTransport : public Transport { | 22 class FakeTransport : public Transport { |
| 23 public: | 23 public: |
| 24 FakeTransport(); | 24 FakeTransport(); |
| 25 ~FakeTransport() override; | 25 ~FakeTransport() override; |
| 26 | 26 |
| 27 // Transport interface. | 27 // Transport interface. |
| 28 void Start(EventHandler* event_handler, | 28 void Start(EventHandler* event_handler, |
| 29 Authenticator* authenticator) override; | 29 Authenticator* authenticator) override; |
| 30 bool ProcessTransportInfo(buzz::XmlElement* transport_info) override; | 30 bool ProcessTransportInfo(buzz::XmlElement* transport_info) override; |
| 31 DatagramChannelFactory* GetDatagramChannelFactory() override; | |
| 32 FakeStreamChannelFactory* GetStreamChannelFactory() override; | 31 FakeStreamChannelFactory* GetStreamChannelFactory() override; |
| 33 FakeStreamChannelFactory* GetMultiplexedChannelFactory() override; | 32 FakeStreamChannelFactory* GetMultiplexedChannelFactory() override; |
| 34 | 33 |
| 35 private: | 34 private: |
| 36 FakeStreamChannelFactory channel_factory_; | 35 FakeStreamChannelFactory channel_factory_; |
| 37 }; | 36 }; |
| 38 | 37 |
| 39 // FakeSession is a dummy protocol::Session that uses FakeStreamSocket for all | 38 // FakeSession is a dummy protocol::Session that uses FakeStreamSocket for all |
| 40 // channels. | 39 // channels. |
| 41 class FakeSession : public Session { | 40 class FakeSession : public Session { |
| 42 public: | 41 public: |
| 43 FakeSession(); | 42 FakeSession(); |
| 44 ~FakeSession() override; | 43 ~FakeSession() override; |
| 45 | 44 |
| 46 EventHandler* event_handler() { return event_handler_; } | 45 EventHandler* event_handler() { return event_handler_; } |
| 47 | 46 |
| 48 void set_error(ErrorCode error) { error_ = error; } | 47 void set_error(ErrorCode error) { error_ = error; } |
| 49 | 48 |
| 50 bool is_closed() const { return closed_; } | 49 bool is_closed() const { return closed_; } |
| 51 | 50 |
| 52 // Session interface. | 51 // Session interface. |
| 53 void SetEventHandler(EventHandler* event_handler) override; | 52 void SetEventHandler(EventHandler* event_handler) override; |
| 54 ErrorCode error() override; | 53 ErrorCode error() override; |
| 55 const std::string& jid() override; | 54 const std::string& jid() override; |
| 56 const SessionConfig& config() override; | 55 const SessionConfig& config() override; |
| 57 FakeTransport* GetTransport() override; | 56 FakeTransport* GetTransport() override; |
| 58 FakeStreamChannelFactory* GetQuicChannelFactory() override; | |
| 59 void Close(ErrorCode error) override; | 57 void Close(ErrorCode error) override; |
| 60 | 58 |
| 61 public: | 59 public: |
| 62 EventHandler* event_handler_; | 60 EventHandler* event_handler_; |
| 63 scoped_ptr<SessionConfig> config_; | 61 scoped_ptr<SessionConfig> config_; |
| 64 | 62 |
| 65 std::string jid_; | 63 std::string jid_; |
| 66 | 64 |
| 67 FakeTransport transport_; | 65 FakeTransport transport_; |
| 68 | 66 |
| 69 ErrorCode error_; | 67 ErrorCode error_; |
| 70 bool closed_; | 68 bool closed_; |
| 71 | 69 |
| 72 DISALLOW_COPY_AND_ASSIGN(FakeSession); | 70 DISALLOW_COPY_AND_ASSIGN(FakeSession); |
| 73 }; | 71 }; |
| 74 | 72 |
| 75 } // namespace protocol | 73 } // namespace protocol |
| 76 } // namespace remoting | 74 } // namespace remoting |
| 77 | 75 |
| 78 #endif // REMOTING_PROTOCOL_FAKE_SESSION_H_ | 76 #endif // REMOTING_PROTOCOL_FAKE_SESSION_H_ |
| OLD | NEW |