Revert "Omit calls to set composing region when pasting image."
[chromium-blink-merge.git] / media / cast / test / utility / net_utility.cc
blobc146d9ab59a99dbb0d32f6b50827ec16e16f627d
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
3 // found in the LICENSE file.
5 #include "media/cast/test/utility/net_utility.h"
7 #include "base/basictypes.h"
8 #include "net/base/net_errors.h"
9 #include "net/udp/udp_server_socket.h"
11 namespace media {
12 namespace cast {
13 namespace test {
15 // TODO(hubbe): Move to /net/.
16 net::IPEndPoint GetFreeLocalPort() {
17 net::IPAddressNumber localhost;
18 localhost.push_back(127);
19 localhost.push_back(0);
20 localhost.push_back(0);
21 localhost.push_back(1);
22 scoped_ptr<net::UDPServerSocket> receive_socket(
23 new net::UDPServerSocket(NULL, net::NetLog::Source()));
24 receive_socket->AllowAddressReuse();
25 CHECK_EQ(net::OK, receive_socket->Listen(net::IPEndPoint(localhost, 0)));
26 net::IPEndPoint endpoint;
27 CHECK_EQ(net::OK, receive_socket->GetLocalAddress(&endpoint));
28 return endpoint;
31 } // namespace test
32 } // namespace cast
33 } // namespace media