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 <list> | 7 #include <list> |
8 | 8 |
9 #include "content/browser/renderer_host/p2p/socket_host_tcp.h" | 9 #include "content/browser/renderer_host/p2p/socket_host_tcp.h" |
10 #include "content/browser/renderer_host/p2p/socket_host_test_utils.h" | 10 #include "content/browser/renderer_host/p2p/socket_host_test_utils.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 }; | 84 }; |
85 | 85 |
86 } // namespace | 86 } // namespace |
87 | 87 |
88 namespace content { | 88 namespace content { |
89 | 89 |
90 class P2PSocketHostTcpServerTest : public testing::Test { | 90 class P2PSocketHostTcpServerTest : public testing::Test { |
91 protected: | 91 protected: |
92 virtual void SetUp() OVERRIDE { | 92 virtual void SetUp() OVERRIDE { |
93 socket_ = new FakeServerSocket(); | 93 socket_ = new FakeServerSocket(); |
94 socket_host_.reset(new P2PSocketHostTcpServer( | 94 socket_host_.reset( |
95 &sender_, 0, P2P_SOCKET_TCP_CLIENT)); | 95 new P2PSocketHostTcpServer(&sender_, 0, P2P_SOCKET_TCP_CLIENT)); |
96 socket_host_->socket_.reset(socket_); | 96 socket_host_->socket_.reset(socket_); |
97 | 97 |
98 EXPECT_CALL(sender_, Send( | 98 EXPECT_CALL(sender_, Send( |
99 MatchMessage(static_cast<uint32>(P2PMsg_OnSocketCreated::ID)))) | 99 MatchMessage(static_cast<uint32>(P2PMsg_OnSocketCreated::ID)))) |
100 .WillOnce(DoAll(DeleteArg<0>(), Return(true))); | 100 .WillOnce(DoAll(DeleteArg<0>(), Return(true))); |
101 | 101 |
102 P2PHostAndIPEndPoint dest; | 102 P2PHostAndIPEndPoint dest; |
103 dest.ip_address = ParseAddress(kTestIpAddress1, kTestPort1); | 103 dest.ip_address = ParseAddress(kTestIpAddress1, kTestPort1); |
104 | 104 |
105 socket_host_->Init(ParseAddress(kTestLocalIpAddress, 0), | 105 socket_host_->Init(ParseAddress(kTestLocalIpAddress, 0), |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 EXPECT_EQ(incoming1, GetSocketFormTcpSocketHost( | 165 EXPECT_EQ(incoming1, GetSocketFormTcpSocketHost( |
166 reinterpret_cast<P2PSocketHostTcp*>(new_host1.get()))); | 166 reinterpret_cast<P2PSocketHostTcp*>(new_host1.get()))); |
167 scoped_ptr<P2PSocketHost> new_host2( | 167 scoped_ptr<P2PSocketHost> new_host2( |
168 socket_host_->AcceptIncomingTcpConnection(addr2, kAcceptedSocketId2)); | 168 socket_host_->AcceptIncomingTcpConnection(addr2, kAcceptedSocketId2)); |
169 ASSERT_TRUE(new_host2.get() != NULL); | 169 ASSERT_TRUE(new_host2.get() != NULL); |
170 EXPECT_EQ(incoming2, GetSocketFormTcpSocketHost( | 170 EXPECT_EQ(incoming2, GetSocketFormTcpSocketHost( |
171 reinterpret_cast<P2PSocketHostTcp*>(new_host2.get()))); | 171 reinterpret_cast<P2PSocketHostTcp*>(new_host2.get()))); |
172 } | 172 } |
173 | 173 |
174 } // namespace content | 174 } // namespace content |
OLD | NEW |