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

Side by Side Diff: content/browser/renderer_host/p2p/socket_host_udp_unittest.cc

Issue 2235973002: Add a SetDoNotFragment() method to DatagramSocket, and call this for (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 months 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 | « no previous file | net/dns/address_sorter_posix_unittest.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 (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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 scoped_refptr<net::IOBuffer> buffer(buf); 108 scoped_refptr<net::IOBuffer> buffer(buf);
109 std::vector<char> data_vector(buffer->data(), buffer->data() + buf_len); 109 std::vector<char> data_vector(buffer->data(), buffer->data() + buf_len);
110 sent_packets_->push_back(UDPPacket(address, data_vector)); 110 sent_packets_->push_back(UDPPacket(address, data_vector));
111 return buf_len; 111 return buf_len;
112 } 112 }
113 113
114 int SetReceiveBufferSize(int32_t size) override { return net::OK; } 114 int SetReceiveBufferSize(int32_t size) override { return net::OK; }
115 115
116 int SetSendBufferSize(int32_t size) override { return net::OK; } 116 int SetSendBufferSize(int32_t size) override { return net::OK; }
117 117
118 int SetDoNotFragment() override { return net::OK; }
119
118 void ReceivePacket(const net::IPEndPoint& address, std::vector<char> data) { 120 void ReceivePacket(const net::IPEndPoint& address, std::vector<char> data) {
119 if (!recv_callback_.is_null()) { 121 if (!recv_callback_.is_null()) {
120 int size = std::min(recv_size_, static_cast<int>(data.size())); 122 int size = std::min(recv_size_, static_cast<int>(data.size()));
121 memcpy(recv_buffer_->data(), &*data.begin(), size); 123 memcpy(recv_buffer_->data(), &*data.begin(), size);
122 *recv_address_ = address; 124 *recv_address_ = address;
123 net::CompletionCallback cb = recv_callback_; 125 net::CompletionCallback cb = recv_callback_;
124 recv_callback_.Reset(); 126 recv_callback_.Reset();
125 recv_buffer_ = nullptr; 127 recv_buffer_ = nullptr;
126 cb.Run(size); 128 cb.Run(size);
127 } else { 129 } else {
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 std::unique_ptr<P2PSocketHostUdp> socket_host( 502 std::unique_ptr<P2PSocketHostUdp> socket_host(
501 new P2PSocketHostUdp(&sender, 0, &throttler, fake_socket_factory)); 503 new P2PSocketHostUdp(&sender, 0, &throttler, fake_socket_factory));
502 net::IPEndPoint local_address = 504 net::IPEndPoint local_address =
503 ParseAddress(kTestLocalIpAddress, invalid_port); 505 ParseAddress(kTestLocalIpAddress, invalid_port);
504 bool rv = socket_host->Init(local_address, min_port, max_port, 506 bool rv = socket_host->Init(local_address, min_port, max_port,
505 P2PHostAndIPEndPoint()); 507 P2PHostAndIPEndPoint());
506 EXPECT_FALSE(rv); 508 EXPECT_FALSE(rv);
507 } 509 }
508 510
509 } // namespace content 511 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | net/dns/address_sorter_posix_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698