summaryrefslogtreecommitdiffstats
path: root/remoting/protocol/fake_session.cc
blob: 9e7d8fcc5da2e94d60b5c8f8042d48f7fe6da68f (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// 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";

FakeTransportSession::FakeTransportSession() {}
FakeTransportSession::~FakeTransportSession() {}

void FakeTransportSession::Start(EventHandler* event_handler,
                                 Authenticator* authenticator) {
  NOTREACHED();
}

bool FakeTransportSession::ProcessTransportInfo(
    buzz::XmlElement* transport_info) {
  NOTREACHED();
  return true;
}

DatagramChannelFactory* FakeTransportSession::GetDatagramChannelFactory() {
  NOTIMPLEMENTED();
  return nullptr;
}

FakeStreamChannelFactory* FakeTransportSession::GetStreamChannelFactory() {
  return &channel_factory_;
}

FakeStreamChannelFactory* FakeTransportSession::GetMultiplexedChannelFactory() {
  return &channel_factory_;
}

FakeSession::FakeSession()
    : event_handler_(nullptr),
      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 SessionConfig& FakeSession::config() {
  return *config_;
}

FakeTransportSession* FakeSession::GetTransportSession() {
  return &transport_session_;
}

FakeStreamChannelFactory* FakeSession::GetQuicChannelFactory() {
  return transport_session_.GetStreamChannelFactory();
}

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

}  // namespace protocol
}  // namespace remoting