| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_connection.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 | 10 |
| 11 namespace remoting { | 11 namespace remoting { |
| 12 | 12 |
| 13 namespace protocol { |
| 14 |
| 13 const char kTestJid[] = "host1@gmail.com/chromoting123"; | 15 const char kTestJid[] = "host1@gmail.com/chromoting123"; |
| 14 | 16 |
| 15 FakeSocket::FakeSocket() | 17 FakeSocket::FakeSocket() |
| 16 : read_pending_(false), | 18 : read_pending_(false), |
| 17 input_pos_(0) { | 19 input_pos_(0) { |
| 18 } | 20 } |
| 19 | 21 |
| 20 FakeSocket::~FakeSocket() { | 22 FakeSocket::~FakeSocket() { |
| 21 } | 23 } |
| 22 | 24 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 64 |
| 63 bool FakeSocket::SetReceiveBufferSize(int32 size) { | 65 bool FakeSocket::SetReceiveBufferSize(int32 size) { |
| 64 NOTIMPLEMENTED(); | 66 NOTIMPLEMENTED(); |
| 65 return false; | 67 return false; |
| 66 } | 68 } |
| 67 bool FakeSocket::SetSendBufferSize(int32 size) { | 69 bool FakeSocket::SetSendBufferSize(int32 size) { |
| 68 NOTIMPLEMENTED(); | 70 NOTIMPLEMENTED(); |
| 69 return false; | 71 return false; |
| 70 } | 72 } |
| 71 | 73 |
| 72 FakeChromotocolConnection::FakeChromotocolConnection() | 74 FakeSession::FakeSession() |
| 73 : candidate_config_(CandidateChromotocolConfig::CreateDefault()), | 75 : candidate_config_(CandidateChromotocolConfig::CreateDefault()), |
| 74 config_(ChromotocolConfig::CreateDefault()), | 76 config_(ChromotocolConfig::CreateDefault()), |
| 75 message_loop_(NULL), | 77 message_loop_(NULL), |
| 76 jid_(kTestJid) { | 78 jid_(kTestJid) { |
| 77 } | 79 } |
| 78 | 80 |
| 79 FakeChromotocolConnection::~FakeChromotocolConnection() { } | 81 FakeSession::~FakeSession() { } |
| 80 | 82 |
| 81 void FakeChromotocolConnection::SetStateChangeCallback( | 83 void FakeSession::SetStateChangeCallback( |
| 82 StateChangeCallback* callback) { | 84 StateChangeCallback* callback) { |
| 83 callback_.reset(callback); | 85 callback_.reset(callback); |
| 84 } | 86 } |
| 85 | 87 |
| 86 FakeSocket* FakeChromotocolConnection::control_channel() { | 88 FakeSocket* FakeSession::control_channel() { |
| 87 return &control_channel_; | 89 return &control_channel_; |
| 88 } | 90 } |
| 89 | 91 |
| 90 FakeSocket* FakeChromotocolConnection::event_channel() { | 92 FakeSocket* FakeSession::event_channel() { |
| 91 return &event_channel_; | 93 return &event_channel_; |
| 92 } | 94 } |
| 93 | 95 |
| 94 FakeSocket* FakeChromotocolConnection::video_channel() { | 96 FakeSocket* FakeSession::video_channel() { |
| 95 return &video_channel_; | 97 return &video_channel_; |
| 96 } | 98 } |
| 97 | 99 |
| 98 FakeSocket* FakeChromotocolConnection::video_rtp_channel() { | 100 FakeSocket* FakeSession::video_rtp_channel() { |
| 99 return &video_rtp_channel_; | 101 return &video_rtp_channel_; |
| 100 } | 102 } |
| 101 | 103 |
| 102 FakeSocket* FakeChromotocolConnection::video_rtcp_channel() { | 104 FakeSocket* FakeSession::video_rtcp_channel() { |
| 103 return &video_rtcp_channel_; | 105 return &video_rtcp_channel_; |
| 104 } | 106 } |
| 105 | 107 |
| 106 const std::string& FakeChromotocolConnection::jid() { | 108 const std::string& FakeSession::jid() { |
| 107 return jid_; | 109 return jid_; |
| 108 } | 110 } |
| 109 | 111 |
| 110 MessageLoop* FakeChromotocolConnection::message_loop() { | 112 MessageLoop* FakeSession::message_loop() { |
| 111 return message_loop_; | 113 return message_loop_; |
| 112 } | 114 } |
| 113 | 115 |
| 114 const CandidateChromotocolConfig* | 116 const CandidateChromotocolConfig* |
| 115 FakeChromotocolConnection::candidate_config() { | 117 FakeSession::candidate_config() { |
| 116 return candidate_config_.get(); | 118 return candidate_config_.get(); |
| 117 } | 119 } |
| 118 | 120 |
| 119 const ChromotocolConfig* FakeChromotocolConnection::config() { | 121 const ChromotocolConfig* FakeSession::config() { |
| 120 CHECK(config_.get()); | 122 CHECK(config_.get()); |
| 121 return config_.get(); | 123 return config_.get(); |
| 122 } | 124 } |
| 123 | 125 |
| 124 void FakeChromotocolConnection::set_config(const ChromotocolConfig* config) { | 126 void FakeSession::set_config(const ChromotocolConfig* config) { |
| 125 config_.reset(config); | 127 config_.reset(config); |
| 126 } | 128 } |
| 127 | 129 |
| 128 void FakeChromotocolConnection::Close(Task* closed_task) { | 130 void FakeSession::Close(Task* closed_task) { |
| 129 closed_ = true; | 131 closed_ = true; |
| 130 closed_task->Run(); | 132 closed_task->Run(); |
| 131 delete closed_task; | 133 delete closed_task; |
| 132 } | 134 } |
| 133 | 135 |
| 136 } // namespace protocol |
| 137 |
| 134 } // namespace remoting | 138 } // namespace remoting |
| OLD | NEW |