Add MetricsService::WasLastShutdownClean()
[chromium-blink-merge.git] / remoting / protocol / fake_session.h
blobe8ea472a7cb09ed625d759765cd501f90cd3cf3b
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
3 // found in the LICENSE file.
5 #ifndef REMOTING_PROTOCOL_FAKE_SESSION_H_
6 #define REMOTING_PROTOCOL_FAKE_SESSION_H_
8 #include <map>
9 #include <string>
10 #include <vector>
12 #include "base/memory/scoped_ptr.h"
13 #include "remoting/protocol/fake_stream_socket.h"
14 #include "remoting/protocol/session.h"
16 namespace remoting {
17 namespace protocol {
19 extern const char kTestJid[];
21 // FakeSession is a dummy protocol::Session that uses FakeStreamSocket for all
22 // channels.
23 class FakeSession : public Session {
24 public:
25 FakeSession();
26 ~FakeSession() override;
28 EventHandler* event_handler() { return event_handler_; }
30 void set_error(ErrorCode error) { error_ = error; }
32 bool is_closed() const { return closed_; }
34 FakeStreamChannelFactory& fake_channel_factory() { return channel_factory_; }
36 // Session interface.
37 void SetEventHandler(EventHandler* event_handler) override;
38 ErrorCode error() override;
39 const std::string& jid() override;
40 const CandidateSessionConfig* candidate_config() override;
41 const SessionConfig& config() override;
42 void set_config(scoped_ptr<SessionConfig> config) override;
43 StreamChannelFactory* GetTransportChannelFactory() override;
44 StreamChannelFactory* GetMultiplexedChannelFactory() override;
45 void Close() override;
47 public:
48 EventHandler* event_handler_;
49 scoped_ptr<const CandidateSessionConfig> candidate_config_;
50 scoped_ptr<SessionConfig> config_;
52 FakeStreamChannelFactory channel_factory_;
54 std::string jid_;
56 ErrorCode error_;
57 bool closed_;
59 DISALLOW_COPY_AND_ASSIGN(FakeSession);
62 } // namespace protocol
63 } // namespace remoting
65 #endif // REMOTING_PROTOCOL_FAKE_SESSION_H_