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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 | 10 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 socket_host_->socket_.reset(socket_); | 98 socket_host_->socket_.reset(socket_); |
99 | 99 |
100 EXPECT_CALL( | 100 EXPECT_CALL( |
101 sender_, | 101 sender_, |
102 Send(MatchMessage(static_cast<uint32_t>(P2PMsg_OnSocketCreated::ID)))) | 102 Send(MatchMessage(static_cast<uint32_t>(P2PMsg_OnSocketCreated::ID)))) |
103 .WillOnce(DoAll(DeleteArg<0>(), Return(true))); | 103 .WillOnce(DoAll(DeleteArg<0>(), Return(true))); |
104 | 104 |
105 P2PHostAndIPEndPoint dest; | 105 P2PHostAndIPEndPoint dest; |
106 dest.ip_address = ParseAddress(kTestIpAddress1, kTestPort1); | 106 dest.ip_address = ParseAddress(kTestIpAddress1, kTestPort1); |
107 | 107 |
108 socket_host_->Init(ParseAddress(kTestLocalIpAddress, 0), | 108 socket_host_->Init(ParseAddress(kTestLocalIpAddress, 0), 0, 0, dest); |
109 dest); | |
110 EXPECT_TRUE(socket_->listening()); | 109 EXPECT_TRUE(socket_->listening()); |
111 } | 110 } |
112 | 111 |
113 // Needed by the chilt classes because only this class is a friend | 112 // Needed by the chilt classes because only this class is a friend |
114 // of P2PSocketHostTcp. | 113 // of P2PSocketHostTcp. |
115 net::StreamSocket* GetSocketFormTcpSocketHost(P2PSocketHostTcp* host) { | 114 net::StreamSocket* GetSocketFormTcpSocketHost(P2PSocketHostTcp* host) { |
116 return host->socket_.get(); | 115 return host->socket_.get(); |
117 } | 116 } |
118 | 117 |
119 MockIPCSender sender_; | 118 MockIPCSender sender_; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 EXPECT_EQ(incoming1, GetSocketFormTcpSocketHost( | 167 EXPECT_EQ(incoming1, GetSocketFormTcpSocketHost( |
169 reinterpret_cast<P2PSocketHostTcp*>(new_host1.get()))); | 168 reinterpret_cast<P2PSocketHostTcp*>(new_host1.get()))); |
170 std::unique_ptr<P2PSocketHost> new_host2( | 169 std::unique_ptr<P2PSocketHost> new_host2( |
171 socket_host_->AcceptIncomingTcpConnection(addr2, kAcceptedSocketId2)); | 170 socket_host_->AcceptIncomingTcpConnection(addr2, kAcceptedSocketId2)); |
172 ASSERT_TRUE(new_host2.get() != NULL); | 171 ASSERT_TRUE(new_host2.get() != NULL); |
173 EXPECT_EQ(incoming2, GetSocketFormTcpSocketHost( | 172 EXPECT_EQ(incoming2, GetSocketFormTcpSocketHost( |
174 reinterpret_cast<P2PSocketHostTcp*>(new_host2.get()))); | 173 reinterpret_cast<P2PSocketHostTcp*>(new_host2.get()))); |
175 } | 174 } |
176 | 175 |
177 } // namespace content | 176 } // namespace content |
OLD | NEW |