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

Side by Side Diff: net/socket/socket_test_util.cc

Issue 848006: Generalize the net module's LoadLog facility from a passive container, to an event stream (NetLog). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Split up RequestTracker into ConnectJobTracker+RequestTracker+RequestTrackerBase, address comments Created 10 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « net/socket/socket_test_util.h ('k') | net/socket/socks5_client_socket.h » ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "net/socket/socket_test_util.h" 5 #include "net/socket/socket_test_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 need_read_data_(true), 76 need_read_data_(true),
77 peer_closed_connection_(false), 77 peer_closed_connection_(false),
78 pending_buf_(NULL), 78 pending_buf_(NULL),
79 pending_buf_len_(0), 79 pending_buf_len_(0),
80 pending_callback_(NULL) { 80 pending_callback_(NULL) {
81 DCHECK(data_); 81 DCHECK(data_);
82 data_->Reset(); 82 data_->Reset();
83 } 83 }
84 84
85 int MockTCPClientSocket::Connect(net::CompletionCallback* callback, 85 int MockTCPClientSocket::Connect(net::CompletionCallback* callback,
86 LoadLog* load_log) { 86 const BoundNetLog& net_log) {
87 if (connected_) 87 if (connected_)
88 return net::OK; 88 return net::OK;
89 connected_ = true; 89 connected_ = true;
90 if (data_->connect_data().async) { 90 if (data_->connect_data().async) {
91 RunCallbackAsync(callback, data_->connect_data().result); 91 RunCallbackAsync(callback, data_->connect_data().result);
92 return net::ERR_IO_PENDING; 92 return net::ERR_IO_PENDING;
93 } 93 }
94 return data_->connect_data().result; 94 return data_->connect_data().result;
95 } 95 }
96 96
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 245
246 MockSSLClientSocket::~MockSSLClientSocket() { 246 MockSSLClientSocket::~MockSSLClientSocket() {
247 Disconnect(); 247 Disconnect();
248 } 248 }
249 249
250 void MockSSLClientSocket::GetSSLInfo(net::SSLInfo* ssl_info) { 250 void MockSSLClientSocket::GetSSLInfo(net::SSLInfo* ssl_info) {
251 ssl_info->Reset(); 251 ssl_info->Reset();
252 } 252 }
253 253
254 int MockSSLClientSocket::Connect(net::CompletionCallback* callback, 254 int MockSSLClientSocket::Connect(net::CompletionCallback* callback,
255 LoadLog* load_log) { 255 const BoundNetLog& net_log) {
256 ConnectCallback* connect_callback = new ConnectCallback( 256 ConnectCallback* connect_callback = new ConnectCallback(
257 this, callback, data_->connect.result); 257 this, callback, data_->connect.result);
258 int rv = transport_->Connect(connect_callback, load_log); 258 int rv = transport_->Connect(connect_callback, net_log);
259 if (rv == net::OK) { 259 if (rv == net::OK) {
260 delete connect_callback; 260 delete connect_callback;
261 if (data_->connect.async) { 261 if (data_->connect.async) {
262 RunCallbackAsync(callback, data_->connect.result); 262 RunCallbackAsync(callback, data_->connect.result);
263 return net::ERR_IO_PENDING; 263 return net::ERR_IO_PENDING;
264 } 264 }
265 if (data_->connect.result == net::OK) 265 if (data_->connect.result == net::OK)
266 connected_ = true; 266 connected_ = true;
267 return data_->connect.result; 267 return data_->connect.result;
268 } 268 }
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 } 466 }
467 467
468 void ClientSocketPoolTest::ReleaseAllConnections(KeepAlive keep_alive) { 468 void ClientSocketPoolTest::ReleaseAllConnections(KeepAlive keep_alive) {
469 bool released_one; 469 bool released_one;
470 do { 470 do {
471 released_one = ReleaseOneConnection(keep_alive); 471 released_one = ReleaseOneConnection(keep_alive);
472 } while (released_one); 472 } while (released_one);
473 } 473 }
474 474
475 } // namespace net 475 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/socket_test_util.h ('k') | net/socket/socks5_client_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698