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/tcp_client_socket_pool_unittest.cc | |
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/tcp_client_socket_pool_unittest.cc')
-rw-r--r-- | net/socket/tcp_client_socket_pool_unittest.cc | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/net/socket/tcp_client_socket_pool_unittest.cc b/net/socket/tcp_client_socket_pool_unittest.cc index e7c8a9f..aed9052 100644 --- a/net/socket/tcp_client_socket_pool_unittest.cc +++ b/net/socket/tcp_client_socket_pool_unittest.cc @@ -30,7 +30,7 @@ class MockClientSocket : public ClientSocket { MockClientSocket() : connected_(false) {} // ClientSocket methods: - virtual int Connect(CompletionCallback* callback, const BoundNetLog& /* net_log */) { + virtual int Connect(CompletionCallback* callback) { connected_ = true; return OK; } @@ -46,6 +46,9 @@ class MockClientSocket : public ClientSocket { virtual int GetPeerAddress(AddressList* address) const { return ERR_UNEXPECTED; } + virtual const BoundNetLog& NetLog() const { + return net_log_; + } // Socket methods: virtual int Read(IOBuffer* buf, int buf_len, @@ -61,6 +64,7 @@ class MockClientSocket : public ClientSocket { private: bool connected_; + BoundNetLog net_log_; }; class MockFailingClientSocket : public ClientSocket { @@ -68,7 +72,7 @@ class MockFailingClientSocket : public ClientSocket { MockFailingClientSocket() {} // ClientSocket methods: - virtual int Connect(CompletionCallback* callback, const BoundNetLog& /* net_log */) { + virtual int Connect(CompletionCallback* callback) { return ERR_CONNECTION_FAILED; } @@ -83,6 +87,9 @@ class MockFailingClientSocket : public ClientSocket { virtual int GetPeerAddress(AddressList* address) const { return ERR_UNEXPECTED; } + virtual const BoundNetLog& NetLog() const { + return net_log_; + } // Socket methods: virtual int Read(IOBuffer* buf, int buf_len, @@ -96,6 +103,9 @@ class MockFailingClientSocket : public ClientSocket { } virtual bool SetReceiveBufferSize(int32 size) { return true; } virtual bool SetSendBufferSize(int32 size) { return true; } + + private: + BoundNetLog net_log_; }; class MockPendingClientSocket : public ClientSocket { @@ -112,7 +122,7 @@ class MockPendingClientSocket : public ClientSocket { is_connected_(false) {} // ClientSocket methods: - virtual int Connect(CompletionCallback* callback, const BoundNetLog& /* net_log */) { + virtual int Connect(CompletionCallback* callback) { MessageLoop::current()->PostDelayedTask( FROM_HERE, method_factory_.NewRunnableMethod( @@ -131,6 +141,9 @@ class MockPendingClientSocket : public ClientSocket { virtual int GetPeerAddress(AddressList* address) const{ return ERR_UNEXPECTED; } + virtual const BoundNetLog& NetLog() const { + return net_log_; + } // Socket methods: virtual int Read(IOBuffer* buf, int buf_len, @@ -164,6 +177,7 @@ class MockPendingClientSocket : public ClientSocket { bool should_stall_; int delay_ms_; bool is_connected_; + BoundNetLog net_log_; }; class MockClientSocketFactory : public ClientSocketFactory { @@ -183,7 +197,8 @@ class MockClientSocketFactory : public ClientSocketFactory { : allocation_count_(0), client_socket_type_(MOCK_CLIENT_SOCKET), client_socket_types_(NULL), client_socket_index_(0) {} - virtual ClientSocket* CreateTCPClientSocket(const AddressList& addresses) { + virtual ClientSocket* CreateTCPClientSocket(const AddressList& addresses, + NetLog* /* net_log */) { allocation_count_++; ClientSocketType type = client_socket_type_; |