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 #include "remoting/protocol/fake_session.h" | 5 #include "remoting/protocol/fake_session.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "net/base/address_list.h" | 9 #include "net/base/address_list.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 } | 301 } |
302 | 302 |
303 void FakeSession::SetEventHandler(EventHandler* event_handler) { | 303 void FakeSession::SetEventHandler(EventHandler* event_handler) { |
304 event_handler_ = event_handler; | 304 event_handler_ = event_handler; |
305 } | 305 } |
306 | 306 |
307 ErrorCode FakeSession::error() { | 307 ErrorCode FakeSession::error() { |
308 return error_; | 308 return error_; |
309 } | 309 } |
310 | 310 |
311 void FakeSession::CreateStreamChannel( | |
312 const std::string& name, const StreamChannelCallback& callback) { | |
313 scoped_ptr<FakeSocket> channel(new FakeSocket()); | |
314 stream_channels_[name] = channel.get(); | |
315 callback.Run(channel.PassAs<net::StreamSocket>()); | |
316 } | |
317 | |
318 void FakeSession::CreateDatagramChannel( | |
319 const std::string& name, const DatagramChannelCallback& callback) { | |
320 scoped_ptr<FakeUdpSocket> channel(new FakeUdpSocket()); | |
321 datagram_channels_[name] = channel.get(); | |
322 callback.Run(channel.PassAs<net::Socket>()); | |
323 } | |
324 | |
325 void FakeSession::CancelChannelCreation(const std::string& name) { | |
326 } | |
327 | |
328 const std::string& FakeSession::jid() { | 311 const std::string& FakeSession::jid() { |
329 return jid_; | 312 return jid_; |
330 } | 313 } |
331 | 314 |
332 const CandidateSessionConfig* FakeSession::candidate_config() { | 315 const CandidateSessionConfig* FakeSession::candidate_config() { |
333 return candidate_config_.get(); | 316 return candidate_config_.get(); |
334 } | 317 } |
335 | 318 |
336 const SessionConfig& FakeSession::config() { | 319 const SessionConfig& FakeSession::config() { |
337 return config_; | 320 return config_; |
338 } | 321 } |
339 | 322 |
340 void FakeSession::set_config(const SessionConfig& config) { | 323 void FakeSession::set_config(const SessionConfig& config) { |
341 config_ = config; | 324 config_ = config; |
342 } | 325 } |
343 | 326 |
| 327 ChannelFactory* FakeSession::GetTransportChannelFactory() { |
| 328 return this; |
| 329 } |
| 330 |
| 331 ChannelFactory* FakeSession::GetMultiplexedChannelFactory() { |
| 332 return this; |
| 333 } |
| 334 |
344 void FakeSession::Close() { | 335 void FakeSession::Close() { |
345 closed_ = true; | 336 closed_ = true; |
346 } | 337 } |
347 | 338 |
| 339 void FakeSession::CreateStreamChannel( |
| 340 const std::string& name, const StreamChannelCallback& callback) { |
| 341 scoped_ptr<FakeSocket> channel(new FakeSocket()); |
| 342 stream_channels_[name] = channel.get(); |
| 343 callback.Run(channel.PassAs<net::StreamSocket>()); |
| 344 } |
| 345 |
| 346 void FakeSession::CreateDatagramChannel( |
| 347 const std::string& name, const DatagramChannelCallback& callback) { |
| 348 scoped_ptr<FakeUdpSocket> channel(new FakeUdpSocket()); |
| 349 datagram_channels_[name] = channel.get(); |
| 350 callback.Run(channel.PassAs<net::Socket>()); |
| 351 } |
| 352 |
| 353 void FakeSession::CancelChannelCreation(const std::string& name) { |
| 354 } |
| 355 |
348 } // namespace protocol | 356 } // namespace protocol |
349 } // namespace remoting | 357 } // namespace remoting |
OLD | NEW |