| OLD | NEW |
| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "net/base/ip_address.h" | 9 #include "net/base/ip_address.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| 11 #include "net/log/net_log_source.h" |
| 11 #include "net/udp/udp_server_socket.h" | 12 #include "net/udp/udp_server_socket.h" |
| 12 | 13 |
| 13 namespace media { | 14 namespace media { |
| 14 namespace cast { | 15 namespace cast { |
| 15 namespace test { | 16 namespace test { |
| 16 | 17 |
| 17 // TODO(hubbe): Move to /net/. | 18 // TODO(hubbe): Move to /net/. |
| 18 net::IPEndPoint GetFreeLocalPort() { | 19 net::IPEndPoint GetFreeLocalPort() { |
| 19 std::unique_ptr<net::UDPServerSocket> receive_socket( | 20 std::unique_ptr<net::UDPServerSocket> receive_socket( |
| 20 new net::UDPServerSocket(NULL, net::NetLog::Source())); | 21 new net::UDPServerSocket(NULL, net::NetLogSource())); |
| 21 receive_socket->AllowAddressReuse(); | 22 receive_socket->AllowAddressReuse(); |
| 22 CHECK_EQ(net::OK, receive_socket->Listen( | 23 CHECK_EQ(net::OK, receive_socket->Listen( |
| 23 net::IPEndPoint(net::IPAddress::IPv4Localhost(), 0))); | 24 net::IPEndPoint(net::IPAddress::IPv4Localhost(), 0))); |
| 24 net::IPEndPoint endpoint; | 25 net::IPEndPoint endpoint; |
| 25 CHECK_EQ(net::OK, receive_socket->GetLocalAddress(&endpoint)); | 26 CHECK_EQ(net::OK, receive_socket->GetLocalAddress(&endpoint)); |
| 26 return endpoint; | 27 return endpoint; |
| 27 } | 28 } |
| 28 | 29 |
| 29 } // namespace test | 30 } // namespace test |
| 30 } // namespace cast | 31 } // namespace cast |
| 31 } // namespace media | 32 } // namespace media |
| OLD | NEW |