| 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/location.h" | 7 #include "base/location.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/ptr_util.h" |
| 9 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "remoting/protocol/fake_authenticator.h" | 11 #include "remoting/protocol/fake_authenticator.h" |
| 11 #include "remoting/protocol/session_plugin.h" | 12 #include "remoting/protocol/session_plugin.h" |
| 12 #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" | 13 #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" |
| 13 | 14 |
| 14 namespace remoting { | 15 namespace remoting { |
| 15 namespace protocol { | 16 namespace protocol { |
| 16 | 17 |
| 17 const char kTestJid[] = "host1@gmail.com/chromoting123"; | 18 const char kTestJid[] = "host1@gmail.com/chromoting123"; |
| 18 const char kTestAuthKey[] = "test_auth_key"; | 19 const char kTestAuthKey[] = "test_auth_key"; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 base::Passed(&transport_info)), | 98 base::Passed(&transport_info)), |
| 98 signaling_delay_); | 99 signaling_delay_); |
| 99 } | 100 } |
| 100 } | 101 } |
| 101 | 102 |
| 102 void FakeSession::ProcessTransportInfo( | 103 void FakeSession::ProcessTransportInfo( |
| 103 std::unique_ptr<buzz::XmlElement> transport_info) { | 104 std::unique_ptr<buzz::XmlElement> transport_info) { |
| 104 transport_->ProcessTransportInfo(transport_info.get()); | 105 transport_->ProcessTransportInfo(transport_info.get()); |
| 105 } | 106 } |
| 106 | 107 |
| 107 // TODO(zijiehe): Supports SessionPlugin in FakeSession. | |
| 108 void FakeSession::AddPlugin(SessionPlugin* plugin) { | 108 void FakeSession::AddPlugin(SessionPlugin* plugin) { |
| 109 NOTIMPLEMENTED(); | 109 DCHECK(plugin); |
| 110 for (const auto& message : attachments_) { |
| 111 if (message) { |
| 112 JingleMessage jingle_message; |
| 113 jingle_message.AddAttachment( |
| 114 base::MakeUnique<buzz::XmlElement>(*message)); |
| 115 plugin->OnIncomingMessage(*(jingle_message.attachments)); |
| 116 } |
| 117 } |
| 118 } |
| 119 |
| 120 void FakeSession::SetAttachment(size_t round, |
| 121 std::unique_ptr<buzz::XmlElement> attachment) { |
| 122 while (attachments_.size() <= round) { |
| 123 attachments_.emplace_back(); |
| 124 } |
| 125 attachments_[round] = std::move(attachment); |
| 110 } | 126 } |
| 111 | 127 |
| 112 } // namespace protocol | 128 } // namespace protocol |
| 113 } // namespace remoting | 129 } // namespace remoting |
| OLD | NEW |