| 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> |
| 11 | 11 |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "remoting/protocol/fake_stream_socket.h" | 13 #include "remoting/protocol/fake_stream_socket.h" |
| 14 #include "remoting/protocol/session.h" | 14 #include "remoting/protocol/session.h" |
| 15 | 15 |
| 16 namespace remoting { | 16 namespace remoting { |
| 17 namespace protocol { | 17 namespace protocol { |
| 18 | 18 |
| 19 extern const char kTestJid[]; | 19 extern const char kTestJid[]; |
| 20 | 20 |
| 21 // FakeSession is a dummy protocol::Session that uses FakeStreamSocket for all | 21 // FakeSession is a dummy protocol::Session that uses FakeStreamSocket for all |
| 22 // channels. | 22 // channels. |
| 23 class FakeSession : public Session { | 23 class FakeSession : public Session { |
| 24 public: | 24 public: |
| 25 FakeSession(); | 25 FakeSession(); |
| 26 virtual ~FakeSession(); | 26 ~FakeSession() override; |
| 27 | 27 |
| 28 EventHandler* event_handler() { return event_handler_; } | 28 EventHandler* event_handler() { return event_handler_; } |
| 29 | 29 |
| 30 void set_error(ErrorCode error) { error_ = error; } | 30 void set_error(ErrorCode error) { error_ = error; } |
| 31 | 31 |
| 32 bool is_closed() const { return closed_; } | 32 bool is_closed() const { return closed_; } |
| 33 | 33 |
| 34 FakeStreamChannelFactory& fake_channel_factory() { return channel_factory_; } | 34 FakeStreamChannelFactory& fake_channel_factory() { return channel_factory_; } |
| 35 | 35 |
| 36 // Session interface. | 36 // Session interface. |
| 37 virtual void SetEventHandler(EventHandler* event_handler) override; | 37 void SetEventHandler(EventHandler* event_handler) override; |
| 38 virtual ErrorCode error() override; | 38 ErrorCode error() override; |
| 39 virtual const std::string& jid() override; | 39 const std::string& jid() override; |
| 40 virtual const CandidateSessionConfig* candidate_config() override; | 40 const CandidateSessionConfig* candidate_config() override; |
| 41 virtual const SessionConfig& config() override; | 41 const SessionConfig& config() override; |
| 42 virtual void set_config(const SessionConfig& config) override; | 42 void set_config(const SessionConfig& config) override; |
| 43 virtual StreamChannelFactory* GetTransportChannelFactory() override; | 43 StreamChannelFactory* GetTransportChannelFactory() override; |
| 44 virtual StreamChannelFactory* GetMultiplexedChannelFactory() override; | 44 StreamChannelFactory* GetMultiplexedChannelFactory() override; |
| 45 virtual void Close() override; | 45 void Close() override; |
| 46 | 46 |
| 47 public: | 47 public: |
| 48 EventHandler* event_handler_; | 48 EventHandler* event_handler_; |
| 49 scoped_ptr<const CandidateSessionConfig> candidate_config_; | 49 scoped_ptr<const CandidateSessionConfig> candidate_config_; |
| 50 SessionConfig config_; | 50 SessionConfig config_; |
| 51 | 51 |
| 52 FakeStreamChannelFactory channel_factory_; | 52 FakeStreamChannelFactory channel_factory_; |
| 53 | 53 |
| 54 std::string jid_; | 54 std::string jid_; |
| 55 | 55 |
| 56 ErrorCode error_; | 56 ErrorCode error_; |
| 57 bool closed_; | 57 bool closed_; |
| 58 | 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(FakeSession); | 59 DISALLOW_COPY_AND_ASSIGN(FakeSession); |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 } // namespace protocol | 62 } // namespace protocol |
| 63 } // namespace remoting | 63 } // namespace remoting |
| 64 | 64 |
| 65 #endif // REMOTING_PROTOCOL_FAKE_SESSION_H_ | 65 #endif // REMOTING_PROTOCOL_FAKE_SESSION_H_ |
| OLD | NEW |