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