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 "jingle/glue/fake_socket_factory.h" | 5 #include "jingle/glue/fake_socket_factory.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "jingle/glue/utils.h" | 9 #include "jingle/glue/utils.h" |
| 10 #include "third_party/libjingle/source/talk/base/asyncpacketsocket.h" |
10 #include "third_party/libjingle/source/talk/base/asyncsocket.h" | 11 #include "third_party/libjingle/source/talk/base/asyncsocket.h" |
11 | 12 |
12 namespace jingle_glue { | 13 namespace jingle_glue { |
13 | 14 |
14 FakeUDPPacketSocket::FakeUDPPacketSocket(FakeSocketManager* fake_socket_manager, | 15 FakeUDPPacketSocket::FakeUDPPacketSocket(FakeSocketManager* fake_socket_manager, |
15 const net::IPEndPoint& address) | 16 const net::IPEndPoint& address) |
16 : fake_socket_manager_(fake_socket_manager), | 17 : fake_socket_manager_(fake_socket_manager), |
17 endpoint_(address), state_(IS_OPEN), error_(0) { | 18 endpoint_(address), state_(IS_OPEN), error_(0) { |
18 CHECK(IPEndPointToSocketAddress(endpoint_, &local_address_)); | 19 CHECK(IPEndPointToSocketAddress(endpoint_, &local_address_)); |
19 fake_socket_manager_->AddSocket(this); | 20 fake_socket_manager_->AddSocket(this); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 DCHECK(CalledOnValidThread()); | 107 DCHECK(CalledOnValidThread()); |
107 | 108 |
108 talk_base::SocketAddress address; | 109 talk_base::SocketAddress address; |
109 if (!jingle_glue::IPEndPointToSocketAddress(from, &address)) { | 110 if (!jingle_glue::IPEndPointToSocketAddress(from, &address)) { |
110 // We should always be able to convert address here because we | 111 // We should always be able to convert address here because we |
111 // don't expect IPv6 address on IPv4 connections. | 112 // don't expect IPv6 address on IPv4 connections. |
112 NOTREACHED(); | 113 NOTREACHED(); |
113 return; | 114 return; |
114 } | 115 } |
115 | 116 |
116 SignalReadPacket(this, &data[0], data.size(), address); | 117 SignalReadPacket(this, &data[0], data.size(), address, |
| 118 talk_base::CreatePacketTime(0)); |
117 } | 119 } |
118 | 120 |
119 FakeSocketManager::FakeSocketManager() | 121 FakeSocketManager::FakeSocketManager() |
120 : message_loop_(base::MessageLoop::current()) {} | 122 : message_loop_(base::MessageLoop::current()) {} |
121 | 123 |
122 FakeSocketManager::~FakeSocketManager() { } | 124 FakeSocketManager::~FakeSocketManager() { } |
123 | 125 |
124 void FakeSocketManager::SendPacket(const net::IPEndPoint& from, | 126 void FakeSocketManager::SendPacket(const net::IPEndPoint& from, |
125 const net::IPEndPoint& to, | 127 const net::IPEndPoint& to, |
126 const std::vector<char>& data) { | 128 const std::vector<char>& data) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 const talk_base::SocketAddress& local_address, | 190 const talk_base::SocketAddress& local_address, |
189 const talk_base::SocketAddress& remote_address, | 191 const talk_base::SocketAddress& remote_address, |
190 const talk_base::ProxyInfo& proxy_info, const std::string& user_agent, | 192 const talk_base::ProxyInfo& proxy_info, const std::string& user_agent, |
191 int opts) { | 193 int opts) { |
192 // TODO(sergeyu): Implement fake TCP sockets. | 194 // TODO(sergeyu): Implement fake TCP sockets. |
193 NOTIMPLEMENTED(); | 195 NOTIMPLEMENTED(); |
194 return NULL; | 196 return NULL; |
195 } | 197 } |
196 | 198 |
197 } // namespace jingle_glue | 199 } // namespace jingle_glue |
OLD | NEW |