| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "remoting/protocol/fake_session.h" | 5 #include "remoting/protocol/fake_session.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "net/base/io_buffer.h" | 8 #include "net/base/io_buffer.h" |
| 9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 198 } |
| 199 bool FakeUdpSocket::SetSendBufferSize(int32 size) { | 199 bool FakeUdpSocket::SetSendBufferSize(int32 size) { |
| 200 NOTIMPLEMENTED(); | 200 NOTIMPLEMENTED(); |
| 201 return false; | 201 return false; |
| 202 } | 202 } |
| 203 | 203 |
| 204 FakeSession::FakeSession() | 204 FakeSession::FakeSession() |
| 205 : candidate_config_(CandidateSessionConfig::CreateDefault()), | 205 : candidate_config_(CandidateSessionConfig::CreateDefault()), |
| 206 config_(SessionConfig::GetDefault()), | 206 config_(SessionConfig::GetDefault()), |
| 207 message_loop_(NULL), | 207 message_loop_(NULL), |
| 208 jid_(kTestJid) { | 208 jid_(kTestJid), |
| 209 error_(OK), |
| 210 closed_(false) { |
| 209 } | 211 } |
| 210 | 212 |
| 211 FakeSession::~FakeSession() { } | 213 FakeSession::~FakeSession() { } |
| 212 | 214 |
| 213 FakeSocket* FakeSession::GetStreamChannel(const std::string& name) { | 215 FakeSocket* FakeSession::GetStreamChannel(const std::string& name) { |
| 214 return stream_channels_[name]; | 216 return stream_channels_[name]; |
| 215 } | 217 } |
| 216 | 218 |
| 217 FakeUdpSocket* FakeSession::GetDatagramChannel(const std::string& name) { | 219 FakeUdpSocket* FakeSession::GetDatagramChannel(const std::string& name) { |
| 218 return datagram_channels_[name]; | 220 return datagram_channels_[name]; |
| 219 } | 221 } |
| 220 | 222 |
| 221 void FakeSession::SetStateChangeCallback(StateChangeCallback* callback) { | 223 void FakeSession::SetStateChangeCallback(StateChangeCallback* callback) { |
| 222 callback_.reset(callback); | 224 callback_.reset(callback); |
| 223 } | 225 } |
| 224 | 226 |
| 227 Session::Error FakeSession::error() { |
| 228 return error_; |
| 229 } |
| 230 |
| 225 void FakeSession::CreateStreamChannel( | 231 void FakeSession::CreateStreamChannel( |
| 226 const std::string& name, const StreamChannelCallback& callback) { | 232 const std::string& name, const StreamChannelCallback& callback) { |
| 227 FakeSocket* channel = new FakeSocket(); | 233 FakeSocket* channel = new FakeSocket(); |
| 228 stream_channels_[name] = channel; | 234 stream_channels_[name] = channel; |
| 229 callback.Run(channel); | 235 callback.Run(channel); |
| 230 } | 236 } |
| 231 | 237 |
| 232 void FakeSession::CreateDatagramChannel( | 238 void FakeSession::CreateDatagramChannel( |
| 233 const std::string& name, const DatagramChannelCallback& callback) { | 239 const std::string& name, const DatagramChannelCallback& callback) { |
| 234 FakeUdpSocket* channel = new FakeUdpSocket(); | 240 FakeUdpSocket* channel = new FakeUdpSocket(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 const std::string& FakeSession::shared_secret() { | 289 const std::string& FakeSession::shared_secret() { |
| 284 return shared_secret_; | 290 return shared_secret_; |
| 285 } | 291 } |
| 286 | 292 |
| 287 void FakeSession::Close() { | 293 void FakeSession::Close() { |
| 288 closed_ = true; | 294 closed_ = true; |
| 289 } | 295 } |
| 290 | 296 |
| 291 } // namespace protocol | 297 } // namespace protocol |
| 292 } // namespace remoting | 298 } // namespace remoting |
| OLD | NEW |