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

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

Issue 1485023003: Misc truncation fixes for gn builds with VS 2015 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes to four more components/content files Created 5 years 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 | « content/browser/renderer_host/p2p/socket_host_tcp.cc ('k') | no next file » | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_test_utils.h" 5 #include "content/browser/renderer_host/p2p/socket_host_test_utils.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/sys_byteorder.h" 8 #include "base/sys_byteorder.h"
9 #include "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "net/base/completion_callback.h" 10 #include "net/base/completion_callback.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 (*packet)[i] = rand() % 256; 189 (*packet)[i] = rand() % 256;
190 } 190 }
191 // Always set the first bit to ensure that generated packet is not 191 // Always set the first bit to ensure that generated packet is not
192 // valid STUN packet. 192 // valid STUN packet.
193 (*packet)[0] = (*packet)[0] | 0x80; 193 (*packet)[0] = (*packet)[0] | 0x80;
194 } 194 }
195 195
196 static void CreateStunPacket(std::vector<char>* packet, uint16 type) { 196 static void CreateStunPacket(std::vector<char>* packet, uint16 type) {
197 CreateRandomPacket(packet); 197 CreateRandomPacket(packet);
198 *reinterpret_cast<uint16*>(&*packet->begin()) = base::HostToNet16(type); 198 *reinterpret_cast<uint16*>(&*packet->begin()) = base::HostToNet16(type);
199 *reinterpret_cast<uint16*>(&*packet->begin() + 2) = 199 *reinterpret_cast<uint16*>(&*packet->begin() + 2) = base::HostToNet16(
200 base::HostToNet16(packet->size() - kStunHeaderSize); 200 base::checked_cast<uint16>(packet->size() - kStunHeaderSize));
201 *reinterpret_cast<uint32*>(&*packet->begin() + 4) = 201 *reinterpret_cast<uint32*>(&*packet->begin() + 4) =
202 base::HostToNet32(kStunMagicCookie); 202 base::HostToNet32(kStunMagicCookie);
203 } 203 }
204 204
205 void CreateStunRequest(std::vector<char>* packet) { 205 void CreateStunRequest(std::vector<char>* packet) {
206 CreateStunPacket(packet, kStunBindingRequest); 206 CreateStunPacket(packet, kStunBindingRequest);
207 } 207 }
208 208
209 void CreateStunResponse(std::vector<char>* packet) { 209 void CreateStunResponse(std::vector<char>* packet) {
210 CreateStunPacket(packet, kStunBindingResponse); 210 CreateStunPacket(packet, kStunBindingResponse);
211 } 211 }
212 212
213 void CreateStunError(std::vector<char>* packet) { 213 void CreateStunError(std::vector<char>* packet) {
214 CreateStunPacket(packet, kStunBindingError); 214 CreateStunPacket(packet, kStunBindingError);
215 } 215 }
216 216
217 net::IPEndPoint ParseAddress(const std::string& ip_str, uint16 port) { 217 net::IPEndPoint ParseAddress(const std::string& ip_str, uint16 port) {
218 net::IPAddressNumber ip; 218 net::IPAddressNumber ip;
219 EXPECT_TRUE(net::ParseIPLiteralToNumber(ip_str, &ip)); 219 EXPECT_TRUE(net::ParseIPLiteralToNumber(ip_str, &ip));
220 return net::IPEndPoint(ip, port); 220 return net::IPEndPoint(ip, port);
221 } 221 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/p2p/socket_host_tcp.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698