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/pseudotcp_adapter.h" | 5 #include "jingle/glue/pseudotcp_adapter.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 MessageLoop::current()->PostDelayedTask( | 167 MessageLoop::current()->PostDelayedTask( |
168 FROM_HERE, | 168 FROM_HERE, |
169 base::Bind(&FakeSocket::AppendInputPacket, | 169 base::Bind(&FakeSocket::AppendInputPacket, |
170 base::Unretained(peer_socket_), | 170 base::Unretained(peer_socket_), |
171 std::vector<char>(buf->data(), buf->data() + buf_len)), | 171 std::vector<char>(buf->data(), buf->data() + buf_len)), |
172 latency_ms_); | 172 latency_ms_); |
173 } | 173 } |
174 | 174 |
175 return buf_len; | 175 return buf_len; |
176 } | 176 } |
| 177 virtual int Write(net::IOBuffer* buf, int buf_len, |
| 178 const net::CompletionCallback& callback) OVERRIDE { |
| 179 DCHECK(buf); |
| 180 if (peer_socket_) { |
| 181 MessageLoop::current()->PostDelayedTask( |
| 182 FROM_HERE, |
| 183 base::Bind(&FakeSocket::AppendInputPacket, |
| 184 base::Unretained(peer_socket_), |
| 185 std::vector<char>(buf->data(), buf->data() + buf_len)), |
| 186 latency_ms_); |
| 187 } |
| 188 |
| 189 return buf_len; |
| 190 } |
177 | 191 |
178 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE { | 192 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE { |
179 NOTIMPLEMENTED(); | 193 NOTIMPLEMENTED(); |
180 return false; | 194 return false; |
181 } | 195 } |
182 virtual bool SetSendBufferSize(int32 size) OVERRIDE { | 196 virtual bool SetSendBufferSize(int32 size) OVERRIDE { |
183 NOTIMPLEMENTED(); | 197 NOTIMPLEMENTED(); |
184 return false; | 198 return false; |
185 } | 199 } |
186 | 200 |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 host_pseudotcp_->Connect(&host_connect_cb); | 450 host_pseudotcp_->Connect(&host_connect_cb); |
437 client_pseudotcp_->Connect(&client_connect_cb); | 451 client_pseudotcp_->Connect(&client_connect_cb); |
438 message_loop_.Run(); | 452 message_loop_.Run(); |
439 | 453 |
440 ASSERT_EQ(NULL, host_pseudotcp_.get()); | 454 ASSERT_EQ(NULL, host_pseudotcp_.get()); |
441 } | 455 } |
442 | 456 |
443 } // namespace | 457 } // namespace |
444 | 458 |
445 } // namespace jingle_glue | 459 } // namespace jingle_glue |
OLD | NEW |