Chromium Code Reviews| 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 "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 using ::testing::_; | 12 using ::testing::_; |
| 13 using ::testing::DeleteArg; | 13 using ::testing::DeleteArg; |
| 14 using ::testing::DoAll; | 14 using ::testing::DoAll; |
| 15 using ::testing::Return; | 15 using ::testing::Return; |
| 16 | 16 |
| 17 namespace content { | |
| 18 | |
| 17 namespace { | 19 namespace { |
|
jam
2011/08/24 00:24:27
ditto
Sergey Ulanov
2011/08/24 01:57:48
Done.
| |
| 18 | 20 |
| 19 class FakeServerSocket : public net::ServerSocket { | 21 class FakeServerSocket : public net::ServerSocket { |
| 20 public: | 22 public: |
| 21 FakeServerSocket() | 23 FakeServerSocket() |
| 22 : listening_(false), | 24 : listening_(false), |
| 23 accept_socket_(NULL), | 25 accept_socket_(NULL), |
| 24 accept_callback_(NULL) { | 26 accept_callback_(NULL) { |
| 25 } | 27 } |
| 26 | 28 |
| 27 ~FakeServerSocket() { } | 29 ~FakeServerSocket() { } |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 socket_host_->AcceptIncomingTcpConnection(addr1, kAcceptedSocketId1)); | 154 socket_host_->AcceptIncomingTcpConnection(addr1, kAcceptedSocketId1)); |
| 153 ASSERT_TRUE(new_host1.get() != NULL); | 155 ASSERT_TRUE(new_host1.get() != NULL); |
| 154 EXPECT_EQ(incoming1, GetSocketFormTcpSocketHost( | 156 EXPECT_EQ(incoming1, GetSocketFormTcpSocketHost( |
| 155 reinterpret_cast<P2PSocketHostTcp*>(new_host1.get()))); | 157 reinterpret_cast<P2PSocketHostTcp*>(new_host1.get()))); |
| 156 scoped_ptr<P2PSocketHost> new_host2( | 158 scoped_ptr<P2PSocketHost> new_host2( |
| 157 socket_host_->AcceptIncomingTcpConnection(addr2, kAcceptedSocketId2)); | 159 socket_host_->AcceptIncomingTcpConnection(addr2, kAcceptedSocketId2)); |
| 158 ASSERT_TRUE(new_host2.get() != NULL); | 160 ASSERT_TRUE(new_host2.get() != NULL); |
| 159 EXPECT_EQ(incoming2, GetSocketFormTcpSocketHost( | 161 EXPECT_EQ(incoming2, GetSocketFormTcpSocketHost( |
| 160 reinterpret_cast<P2PSocketHostTcp*>(new_host2.get()))); | 162 reinterpret_cast<P2PSocketHostTcp*>(new_host2.get()))); |
| 161 } | 163 } |
| 164 | |
| 165 } // namespace content | |
| OLD | NEW |