| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/pseudotcp_adapter.h" | 5 #include "remoting/protocol/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" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/location.h" |
| 12 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/single_thread_task_runner.h" |
| 15 #include "base/threading/thread_task_runner_handle.h" |
| 13 #include "jingle/glue/thread_wrapper.h" | 16 #include "jingle/glue/thread_wrapper.h" |
| 14 #include "net/base/io_buffer.h" | 17 #include "net/base/io_buffer.h" |
| 15 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
| 16 #include "net/base/test_completion_callback.h" | 19 #include "net/base/test_completion_callback.h" |
| 17 #include "remoting/protocol/p2p_datagram_socket.h" | 20 #include "remoting/protocol/p2p_datagram_socket.h" |
| 18 #include "remoting/protocol/p2p_stream_socket.h" | 21 #include "remoting/protocol/p2p_stream_socket.h" |
| 19 #include "testing/gmock/include/gmock/gmock.h" | 22 #include "testing/gmock/include/gmock/gmock.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 21 | 24 |
| 22 namespace remoting { | 25 namespace remoting { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 read_buffer_ = buf; | 123 read_buffer_ = buf; |
| 121 read_buffer_size_ = buf_len; | 124 read_buffer_size_ = buf_len; |
| 122 return net::ERR_IO_PENDING; | 125 return net::ERR_IO_PENDING; |
| 123 } | 126 } |
| 124 } | 127 } |
| 125 | 128 |
| 126 int Send(const scoped_refptr<net::IOBuffer>& buf, int buf_len, | 129 int Send(const scoped_refptr<net::IOBuffer>& buf, int buf_len, |
| 127 const net::CompletionCallback& callback) override { | 130 const net::CompletionCallback& callback) override { |
| 128 DCHECK(buf); | 131 DCHECK(buf); |
| 129 if (peer_socket_) { | 132 if (peer_socket_) { |
| 130 base::MessageLoop::current()->PostDelayedTask( | 133 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 131 FROM_HERE, | 134 FROM_HERE, |
| 132 base::Bind(&FakeSocket::AppendInputPacket, | 135 base::Bind(&FakeSocket::AppendInputPacket, |
| 133 base::Unretained(peer_socket_), | 136 base::Unretained(peer_socket_), |
| 134 std::vector<char>(buf->data(), buf->data() + buf_len)), | 137 std::vector<char>(buf->data(), buf->data() + buf_len)), |
| 135 base::TimeDelta::FromMilliseconds(latency_ms_)); | 138 base::TimeDelta::FromMilliseconds(latency_ms_)); |
| 136 } | 139 } |
| 137 | 140 |
| 138 return buf_len; | 141 return buf_len; |
| 139 } | 142 } |
| 140 | 143 |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 | 427 |
| 425 tester->Start(); | 428 tester->Start(); |
| 426 message_loop_.Run(); | 429 message_loop_.Run(); |
| 427 tester->CheckResults(); | 430 tester->CheckResults(); |
| 428 } | 431 } |
| 429 | 432 |
| 430 } // namespace | 433 } // namespace |
| 431 | 434 |
| 432 } // namespace protocol | 435 } // namespace protocol |
| 433 } // namespace remoting | 436 } // namespace remoting |
| OLD | NEW |