| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_udp.h" | 5 #include "content/browser/renderer_host/p2p/socket_host_udp.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 scoped_refptr<net::IOBuffer> recv_buffer_; | 178 scoped_refptr<net::IOBuffer> recv_buffer_; |
| 179 net::IPEndPoint* recv_address_; | 179 net::IPEndPoint* recv_address_; |
| 180 int recv_size_; | 180 int recv_size_; |
| 181 net::CompletionCallback recv_callback_; | 181 net::CompletionCallback recv_callback_; |
| 182 std::vector<uint16_t>* used_ports_; | 182 std::vector<uint16_t>* used_ports_; |
| 183 }; | 183 }; |
| 184 | 184 |
| 185 std::unique_ptr<net::DatagramServerSocket> CreateFakeDatagramServerSocket( | 185 std::unique_ptr<net::DatagramServerSocket> CreateFakeDatagramServerSocket( |
| 186 std::deque<FakeDatagramServerSocket::UDPPacket>* sent_packets, | 186 std::deque<FakeDatagramServerSocket::UDPPacket>* sent_packets, |
| 187 std::vector<uint16_t>* used_ports) { | 187 std::vector<uint16_t>* used_ports) { |
| 188 return base::WrapUnique( | 188 return base::MakeUnique<FakeDatagramServerSocket>(sent_packets, used_ports); |
| 189 new FakeDatagramServerSocket(sent_packets, used_ports)); | |
| 190 } | 189 } |
| 191 | 190 |
| 192 } // namespace | 191 } // namespace |
| 193 | 192 |
| 194 namespace content { | 193 namespace content { |
| 195 | 194 |
| 196 class P2PSocketHostUdpTest : public testing::Test { | 195 class P2PSocketHostUdpTest : public testing::Test { |
| 197 protected: | 196 protected: |
| 198 void SetUp() override { | 197 void SetUp() override { |
| 199 EXPECT_CALL( | 198 EXPECT_CALL( |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 std::unique_ptr<P2PSocketHostUdp> socket_host( | 501 std::unique_ptr<P2PSocketHostUdp> socket_host( |
| 503 new P2PSocketHostUdp(&sender, 0, &throttler, fake_socket_factory)); | 502 new P2PSocketHostUdp(&sender, 0, &throttler, fake_socket_factory)); |
| 504 net::IPEndPoint local_address = | 503 net::IPEndPoint local_address = |
| 505 ParseAddress(kTestLocalIpAddress, invalid_port); | 504 ParseAddress(kTestLocalIpAddress, invalid_port); |
| 506 bool rv = socket_host->Init(local_address, min_port, max_port, | 505 bool rv = socket_host->Init(local_address, min_port, max_port, |
| 507 P2PHostAndIPEndPoint()); | 506 P2PHostAndIPEndPoint()); |
| 508 EXPECT_FALSE(rv); | 507 EXPECT_FALSE(rv); |
| 509 } | 508 } |
| 510 | 509 |
| 511 } // namespace content | 510 } // namespace content |
| OLD | NEW |