summaryrefslogtreecommitdiffstats
path: root/remoting/protocol/fake_session.cc
blob: 68a78ca7d1807ffc84e09266df6a3e4a54409117 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "remoting/protocol/fake_session.h"

namespace remoting {
namespace protocol {

const char kTestJid[] = "host1@gmail.com/chromoting123";

FakeSession::FakeSession()
    : event_handler_(nullptr),
      candidate_config_(CandidateSessionConfig::CreateDefault()),
      config_(SessionConfig::ForTest()),
      jid_(kTestJid),
      error_(OK),
      closed_(false) {
}
FakeSession::~FakeSession() { }

void FakeSession::SetEventHandler(EventHandler* event_handler) {
  event_handler_ = event_handler;
}

ErrorCode FakeSession::error() {
  return error_;
}

const std::string& FakeSession::jid() {
  return jid_;
}

const CandidateSessionConfig* FakeSession::candidate_config() {
  return candidate_config_.get();
}

const SessionConfig& FakeSession::config() {
  return *config_;
}

void FakeSession::set_config(scoped_ptr<SessionConfig> config) {
  config_ = config.Pass();
}

StreamChannelFactory* FakeSession::GetTransportChannelFactory() {
  return &channel_factory_;
}

StreamChannelFactory* FakeSession::GetMultiplexedChannelFactory() {
  return &channel_factory_;
}

void FakeSession::Close() {
  closed_ = true;
}

}  // namespace protocol
}  // namespace remoting