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

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

Issue 1096203006: Collect all ConnectionAttempts from both sockets in TransportConnectJob. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@domrel_serverip1
Patch Set: Return fake ConnectionAttempt in MockTCPClientSocket Created 5 years, 7 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
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/sys_byteorder.h" 7 #include "base/sys_byteorder.h"
8 #include "base/thread_task_runner_handle.h" 8 #include "base/thread_task_runner_handle.h"
9 #include "net/base/completion_callback.h" 9 #include "net/base/completion_callback.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 165 }
166 166
167 net::NextProto FakeSocket::GetNegotiatedProtocol() const { 167 net::NextProto FakeSocket::GetNegotiatedProtocol() const {
168 return net::kProtoUnknown; 168 return net::kProtoUnknown;
169 } 169 }
170 170
171 bool FakeSocket::GetSSLInfo(net::SSLInfo* ssl_info) { 171 bool FakeSocket::GetSSLInfo(net::SSLInfo* ssl_info) {
172 return false; 172 return false;
173 } 173 }
174 174
175 void FakeSocket::GetConnectionAttempts(net::ConnectionAttempts* out) const {
176 out->clear();
177 }
178
175 void CreateRandomPacket(std::vector<char>* packet) { 179 void CreateRandomPacket(std::vector<char>* packet) {
176 size_t size = kStunHeaderSize + rand() % 1000; 180 size_t size = kStunHeaderSize + rand() % 1000;
177 packet->resize(size); 181 packet->resize(size);
178 for (size_t i = 0; i < size; i++) { 182 for (size_t i = 0; i < size; i++) {
179 (*packet)[i] = rand() % 256; 183 (*packet)[i] = rand() % 256;
180 } 184 }
181 // Always set the first bit to ensure that generated packet is not 185 // Always set the first bit to ensure that generated packet is not
182 // valid STUN packet. 186 // valid STUN packet.
183 (*packet)[0] = (*packet)[0] | 0x80; 187 (*packet)[0] = (*packet)[0] | 0x80;
184 } 188 }
(...skipping 17 matching lines...) Expand all
202 206
203 void CreateStunError(std::vector<char>* packet) { 207 void CreateStunError(std::vector<char>* packet) {
204 CreateStunPacket(packet, kStunBindingError); 208 CreateStunPacket(packet, kStunBindingError);
205 } 209 }
206 210
207 net::IPEndPoint ParseAddress(const std::string ip_str, uint16 port) { 211 net::IPEndPoint ParseAddress(const std::string ip_str, uint16 port) {
208 net::IPAddressNumber ip; 212 net::IPAddressNumber ip;
209 EXPECT_TRUE(net::ParseIPLiteralToNumber(ip_str, &ip)); 213 EXPECT_TRUE(net::ParseIPLiteralToNumber(ip_str, &ip));
210 return net::IPEndPoint(ip, port); 214 return net::IPEndPoint(ip, port);
211 } 215 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/p2p/socket_host_test_utils.h ('k') | jingle/glue/fake_ssl_client_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698