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