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

Side by Side Diff: media/cast/test/utility/net_utility.cc

Issue 721273002: Remove timing limitation to set Broadcast, ReceiveBuffer, and SendBuffer options from UDPSocket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « media/cast/net/udp_transport.cc ('k') | media/cast/test/utility/udp_proxy.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "media/cast/test/utility/net_utility.h" 5 #include "media/cast/test/utility/net_utility.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "net/base/net_errors.h" 8 #include "net/base/net_errors.h"
9 #include "net/udp/udp_socket.h" 9 #include "net/udp/udp_server_socket.h"
10 10
11 namespace media { 11 namespace media {
12 namespace cast { 12 namespace cast {
13 namespace test { 13 namespace test {
14 14
15 // TODO(hubbe): Move to /net/. 15 // TODO(hubbe): Move to /net/.
16 net::IPEndPoint GetFreeLocalPort() { 16 net::IPEndPoint GetFreeLocalPort() {
17 net::IPAddressNumber localhost; 17 net::IPAddressNumber localhost;
18 localhost.push_back(127); 18 localhost.push_back(127);
19 localhost.push_back(0); 19 localhost.push_back(0);
20 localhost.push_back(0); 20 localhost.push_back(0);
21 localhost.push_back(1); 21 localhost.push_back(1);
22 scoped_ptr<net::UDPSocket> receive_socket( 22 scoped_ptr<net::UDPServerSocket> receive_socket(
23 new net::UDPSocket(net::DatagramSocket::DEFAULT_BIND, 23 new net::UDPServerSocket(NULL, net::NetLog::Source()));
24 net::RandIntCallback(),
25 NULL,
26 net::NetLog::Source()));
27 receive_socket->AllowAddressReuse(); 24 receive_socket->AllowAddressReuse();
28 CHECK_EQ(net::OK, receive_socket->Bind(net::IPEndPoint(localhost, 0))); 25 CHECK_EQ(net::OK, receive_socket->Listen(net::IPEndPoint(localhost, 0)));
29 net::IPEndPoint endpoint; 26 net::IPEndPoint endpoint;
30 CHECK_EQ(net::OK, receive_socket->GetLocalAddress(&endpoint)); 27 CHECK_EQ(net::OK, receive_socket->GetLocalAddress(&endpoint));
31 return endpoint; 28 return endpoint;
32 } 29 }
33 30
34 } // namespace test 31 } // namespace test
35 } // namespace cast 32 } // namespace cast
36 } // namespace media 33 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/net/udp_transport.cc ('k') | media/cast/test/utility/udp_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698