diff options
author | vandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-23 16:44:02 +0000 |
---|---|---|
committer | vandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-23 16:44:02 +0000 |
commit | a2006ecefa10d259d0a85ac4146b913eb0f9d02f (patch) | |
tree | 67fc5e5f6339f2fa5e53735a30324e47de22005a /net/socket/socket_test_util.h | |
parent | f044ce8e4aeef63eb7686345f407bf5640045c18 (diff) | |
download | chromium_src-a2006ecefa10d259d0a85ac4146b913eb0f9d02f.zip chromium_src-a2006ecefa10d259d0a85ac4146b913eb0f9d02f.tar.gz chromium_src-a2006ecefa10d259d0a85ac4146b913eb0f9d02f.tar.bz2 |
Add net log entries that summarize transmit and receive byte counts.
Tx/Rx summaries are integrated into the net log at the last point that bytes were transmitted or received.
Hopefully this will help resolve http://crbug.com/37729 by showing if we've received bytes over the network when we hit the "Waiting for cache" bug.
This change also modernizes the use of NetLog:
- ClientSocket now has a net_log() accessor
- ClientSocket::Connect no longer takes a NetLog, instead the TCPClientSocket constructor takes one, others use their transport socket's NetLog
- TCPClientSocket creates a new source id with source type SOCKET
Also updates PassiveLogCollector infrastructure:
- The LiveRequestsObserver lets a RequestTracker update a RequestInfo just before it is displayed. This allows ConnectJobs to be associated with URLRequests while connecting and then reassociated if they are late-bound to a different request.
BUG=37729
TEST=tx/rx lines show up in chrome://net-internals/
Review URL: http://codereview.chromium.org/1696005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45449 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/socket_test_util.h')
-rw-r--r-- | net/socket/socket_test_util.h | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/net/socket/socket_test_util.h b/net/socket/socket_test_util.h index 91522ed..4358a72 100644 --- a/net/socket/socket_test_util.h +++ b/net/socket/socket_test_util.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -17,6 +17,7 @@ #include "net/base/address_list.h" #include "net/base/io_buffer.h" #include "net/base/net_errors.h" +#include "net/base/net_log.h" #include "net/base/ssl_config_service.h" #include "net/base/test_completion_callback.h" #include "net/socket/client_socket_factory.h" @@ -35,7 +36,6 @@ enum { ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ = -10000, }; -class BoundNetLog; class ClientSocket; class MockClientSocket; class SSLClientSocket; @@ -289,7 +289,8 @@ class MockClientSocketFactory : public ClientSocketFactory { MockSSLClientSocket* GetMockSSLClientSocket(size_t index) const; // ClientSocketFactory - virtual ClientSocket* CreateTCPClientSocket(const AddressList& addresses); + virtual ClientSocket* CreateTCPClientSocket(const AddressList& addresses, + NetLog* net_log); virtual SSLClientSocket* CreateSSLClientSocket( ClientSocket* transport_socket, const std::string& hostname, @@ -306,15 +307,15 @@ class MockClientSocketFactory : public ClientSocketFactory { class MockClientSocket : public net::SSLClientSocket { public: - MockClientSocket(); + explicit MockClientSocket(net::NetLog* net_log); // ClientSocket methods: - virtual int Connect(net::CompletionCallback* callback, - const BoundNetLog& net_log) = 0; + virtual int Connect(net::CompletionCallback* callback) = 0; virtual void Disconnect(); virtual bool IsConnected() const; virtual bool IsConnectedAndIdle() const; virtual int GetPeerAddress(AddressList* address) const; + virtual const BoundNetLog& NetLog() const { return net_log_;} // SSLClientSocket methods: virtual void GetSSLInfo(net::SSLInfo* ssl_info); @@ -345,16 +346,17 @@ class MockClientSocket : public net::SSLClientSocket { // True if Connect completed successfully and Disconnect hasn't been called. bool connected_; + + net::BoundNetLog net_log_; }; class MockTCPClientSocket : public MockClientSocket { public: - MockTCPClientSocket(const net::AddressList& addresses, + MockTCPClientSocket(const net::AddressList& addresses, net::NetLog* net_log, net::SocketDataProvider* socket); // ClientSocket methods: - virtual int Connect(net::CompletionCallback* callback, - const BoundNetLog& net_log); + virtual int Connect(net::CompletionCallback* callback); virtual void Disconnect(); virtual bool IsConnected() const; virtual bool IsConnectedAndIdle() const { return IsConnected(); } @@ -401,8 +403,7 @@ class MockSSLClientSocket : public MockClientSocket { virtual void GetSSLInfo(net::SSLInfo* ssl_info); - virtual int Connect(net::CompletionCallback* callback, - const BoundNetLog& net_log); + virtual int Connect(net::CompletionCallback* callback); virtual void Disconnect(); // Socket methods: |