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

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

Issue 10907154: Allow server sockets to rebind to same port if there is nothing actively listening on that port. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix content_unittests build 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
« no previous file with comments | « no previous file | net/socket/server_socket.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 28 matching lines...) Expand all
39 // callback. 39 // callback.
40 net::CompletionCallback cb = accept_callback_; 40 net::CompletionCallback cb = accept_callback_;
41 accept_callback_.Reset(); 41 accept_callback_.Reset();
42 cb.Run(net::OK); 42 cb.Run(net::OK);
43 } else { 43 } else {
44 incoming_sockets_.push_back(socket); 44 incoming_sockets_.push_back(socket);
45 } 45 }
46 } 46 }
47 47
48 // net::ServerSocket implementation. 48 // net::ServerSocket implementation.
49 virtual void AllowAddressReuse() {
50 }
51
49 virtual int Listen(const net::IPEndPoint& address, int backlog) OVERRIDE { 52 virtual int Listen(const net::IPEndPoint& address, int backlog) OVERRIDE {
50 local_address_ = address; 53 local_address_ = address;
51 listening_ = true; 54 listening_ = true;
52 return net::OK; 55 return net::OK;
53 } 56 }
54 57
55 virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE { 58 virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE {
56 *address = local_address_; 59 *address = local_address_;
57 return net::OK; 60 return net::OK;
58 } 61 }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 EXPECT_EQ(incoming1, GetSocketFormTcpSocketHost( 163 EXPECT_EQ(incoming1, GetSocketFormTcpSocketHost(
161 reinterpret_cast<P2PSocketHostTcp*>(new_host1.get()))); 164 reinterpret_cast<P2PSocketHostTcp*>(new_host1.get())));
162 scoped_ptr<P2PSocketHost> new_host2( 165 scoped_ptr<P2PSocketHost> new_host2(
163 socket_host_->AcceptIncomingTcpConnection(addr2, kAcceptedSocketId2)); 166 socket_host_->AcceptIncomingTcpConnection(addr2, kAcceptedSocketId2));
164 ASSERT_TRUE(new_host2.get() != NULL); 167 ASSERT_TRUE(new_host2.get() != NULL);
165 EXPECT_EQ(incoming2, GetSocketFormTcpSocketHost( 168 EXPECT_EQ(incoming2, GetSocketFormTcpSocketHost(
166 reinterpret_cast<P2PSocketHostTcp*>(new_host2.get()))); 169 reinterpret_cast<P2PSocketHostTcp*>(new_host2.get())));
167 } 170 }
168 171
169 } // namespace content 172 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | net/socket/server_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698