Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Side by Side Diff: content/browser/renderer_host/p2p/socket_host_tcp_server_unittest.cc

Issue 10917167: Refactor the P2PSocketDispatcher to be created on the RenderThread instead of the RenderView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change P2PSocketDispatcher to take the io message loop as input to fix existing unit tests Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 }; 83 };
84 84
85 } // namespace 85 } // namespace
86 86
87 namespace content { 87 namespace content {
88 88
89 class P2PSocketHostTcpServerTest : public testing::Test { 89 class P2PSocketHostTcpServerTest : public testing::Test {
90 protected: 90 protected:
91 virtual void SetUp() OVERRIDE { 91 virtual void SetUp() OVERRIDE {
92 socket_ = new FakeServerSocket(); 92 socket_ = new FakeServerSocket();
93 socket_host_.reset(new P2PSocketHostTcpServer(&sender_, 0, 0)); 93 socket_host_.reset(new P2PSocketHostTcpServer(&sender_, 0));
94 socket_host_->socket_.reset(socket_); 94 socket_host_->socket_.reset(socket_);
95 95
96 EXPECT_CALL(sender_, Send( 96 EXPECT_CALL(sender_, Send(
97 MatchMessage(static_cast<uint32>(P2PMsg_OnSocketCreated::ID)))) 97 MatchMessage(static_cast<uint32>(P2PMsg_OnSocketCreated::ID))))
98 .WillOnce(DoAll(DeleteArg<0>(), Return(true))); 98 .WillOnce(DoAll(DeleteArg<0>(), Return(true)));
99 99
100 socket_host_->Init(ParseAddress(kTestLocalIpAddress, 0), 100 socket_host_->Init(ParseAddress(kTestLocalIpAddress, 0),
101 ParseAddress(kTestIpAddress1, kTestPort1)); 101 ParseAddress(kTestIpAddress1, kTestPort1));
102 EXPECT_TRUE(socket_->listening()); 102 EXPECT_TRUE(socket_->listening());
103 } 103 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 EXPECT_EQ(incoming1, GetSocketFormTcpSocketHost( 160 EXPECT_EQ(incoming1, GetSocketFormTcpSocketHost(
161 reinterpret_cast<P2PSocketHostTcp*>(new_host1.get()))); 161 reinterpret_cast<P2PSocketHostTcp*>(new_host1.get())));
162 scoped_ptr<P2PSocketHost> new_host2( 162 scoped_ptr<P2PSocketHost> new_host2(
163 socket_host_->AcceptIncomingTcpConnection(addr2, kAcceptedSocketId2)); 163 socket_host_->AcceptIncomingTcpConnection(addr2, kAcceptedSocketId2));
164 ASSERT_TRUE(new_host2.get() != NULL); 164 ASSERT_TRUE(new_host2.get() != NULL);
165 EXPECT_EQ(incoming2, GetSocketFormTcpSocketHost( 165 EXPECT_EQ(incoming2, GetSocketFormTcpSocketHost(
166 reinterpret_cast<P2PSocketHostTcp*>(new_host2.get()))); 166 reinterpret_cast<P2PSocketHostTcp*>(new_host2.get())));
167 } 167 }
168 168
169 } // namespace content 169 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698