| 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 "content/browser/renderer_host/p2p/socket_host_tcp_server.h" | 5 #include "content/browser/renderer_host/p2p/socket_host_tcp_server.h" |
| 6 | 6 |
| 7 #include "content/browser/renderer_host/p2p/socket_host_tcp.h" | 7 #include "content/browser/renderer_host/p2p/socket_host_tcp.h" |
| 8 #include "content/browser/renderer_host/p2p/socket_host_test_utils.h" | 8 #include "content/browser/renderer_host/p2p/socket_host_test_utils.h" |
| 9 #include "net/base/completion_callback.h" | 9 #include "net/base/completion_callback.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // callback. | 39 // callback. |
| 40 net::CompletionCallback cb = accept_callback_; | 40 net::CompletionCallback cb = accept_callback_; |
| 41 accept_callback_.Reset(); | 41 accept_callback_.Reset(); |
| 42 cb.Run(net::OK); | 42 cb.Run(net::OK); |
| 43 } else { | 43 } else { |
| 44 incoming_sockets_.push_back(socket); | 44 incoming_sockets_.push_back(socket); |
| 45 } | 45 } |
| 46 } | 46 } |
| 47 | 47 |
| 48 // net::ServerSocket implementation. | 48 // net::ServerSocket implementation. |
| 49 virtual void AllowAddressReuse() { |
| 50 } |
| 51 |
| 49 virtual int Listen(const net::IPEndPoint& address, int backlog) OVERRIDE { | 52 virtual int Listen(const net::IPEndPoint& address, int backlog) OVERRIDE { |
| 50 local_address_ = address; | 53 local_address_ = address; |
| 51 listening_ = true; | 54 listening_ = true; |
| 52 return net::OK; | 55 return net::OK; |
| 53 } | 56 } |
| 54 | 57 |
| 55 virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE { | 58 virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE { |
| 56 *address = local_address_; | 59 *address = local_address_; |
| 57 return net::OK; | 60 return net::OK; |
| 58 } | 61 } |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 EXPECT_EQ(incoming1, GetSocketFormTcpSocketHost( | 163 EXPECT_EQ(incoming1, GetSocketFormTcpSocketHost( |
| 161 reinterpret_cast<P2PSocketHostTcp*>(new_host1.get()))); | 164 reinterpret_cast<P2PSocketHostTcp*>(new_host1.get()))); |
| 162 scoped_ptr<P2PSocketHost> new_host2( | 165 scoped_ptr<P2PSocketHost> new_host2( |
| 163 socket_host_->AcceptIncomingTcpConnection(addr2, kAcceptedSocketId2)); | 166 socket_host_->AcceptIncomingTcpConnection(addr2, kAcceptedSocketId2)); |
| 164 ASSERT_TRUE(new_host2.get() != NULL); | 167 ASSERT_TRUE(new_host2.get() != NULL); |
| 165 EXPECT_EQ(incoming2, GetSocketFormTcpSocketHost( | 168 EXPECT_EQ(incoming2, GetSocketFormTcpSocketHost( |
| 166 reinterpret_cast<P2PSocketHostTcp*>(new_host2.get()))); | 169 reinterpret_cast<P2PSocketHostTcp*>(new_host2.get()))); |
| 167 } | 170 } |
| 168 | 171 |
| 169 } // namespace content | 172 } // namespace content |
| OLD | NEW |