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
diff --git a/net/socket/ssl_client_socket_unittest.cc b/net/socket/ssl_client_socket_unittest.cc
index 4984fc7..86243af 100644
--- a/net/socket/ssl_client_socket_unittest.cc
+++ b/net/socket/ssl_client_socket_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 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.
@@ -68,8 +68,9 @@
int rv = resolver_->Resolve(info, &addr, NULL, NULL, NULL);
EXPECT_EQ(net::OK, rv);
- net::ClientSocket *transport = new net::TCPClientSocket(addr);
- rv = transport->Connect(&callback, NULL);
+ net::CapturingNetLog log(net::CapturingNetLog::kUnbounded);
+ net::ClientSocket* transport = new net::TCPClientSocket(addr, &log);
+ rv = transport->Connect(&callback);
if (rv == net::ERR_IO_PENDING)
rv = callback.WaitForResult();
EXPECT_EQ(net::OK, rv);
@@ -80,10 +81,9 @@
EXPECT_FALSE(sock->IsConnected());
- net::CapturingBoundNetLog log(net::CapturingNetLog::kUnbounded);
- rv = sock->Connect(&callback, log.bound());
+ rv = sock->Connect(&callback);
EXPECT_TRUE(net::LogContainsBeginEvent(
- log.entries(), 0, net::NetLog::TYPE_SSL_CONNECT));
+ log.entries(), 2, net::NetLog::TYPE_SSL_CONNECT));
if (rv != net::OK) {
ASSERT_EQ(net::ERR_IO_PENDING, rv);
EXPECT_FALSE(sock->IsConnected());
@@ -112,8 +112,9 @@
int rv = resolver_->Resolve(info, &addr, NULL, NULL, NULL);
EXPECT_EQ(net::OK, rv);
- net::ClientSocket *transport = new net::TCPClientSocket(addr);
- rv = transport->Connect(&callback, NULL);
+ net::CapturingNetLog log(net::CapturingNetLog::kUnbounded);
+ net::ClientSocket* transport = new net::TCPClientSocket(addr, &log);
+ rv = transport->Connect(&callback);
if (rv == net::ERR_IO_PENDING)
rv = callback.WaitForResult();
EXPECT_EQ(net::OK, rv);
@@ -124,10 +125,9 @@
EXPECT_FALSE(sock->IsConnected());
- net::CapturingBoundNetLog log(net::CapturingNetLog::kUnbounded);
- rv = sock->Connect(&callback, log.bound());
+ rv = sock->Connect(&callback);
EXPECT_TRUE(net::LogContainsBeginEvent(
- log.entries(), 0, net::NetLog::TYPE_SSL_CONNECT));
+ log.entries(), 2, net::NetLog::TYPE_SSL_CONNECT));
if (rv != net::OK) {
ASSERT_EQ(net::ERR_IO_PENDING, rv);
EXPECT_FALSE(sock->IsConnected());
@@ -157,8 +157,9 @@
int rv = resolver_->Resolve(info, &addr, NULL, NULL, NULL);
EXPECT_EQ(net::OK, rv);
- net::ClientSocket *transport = new net::TCPClientSocket(addr);
- rv = transport->Connect(&callback, NULL);
+ net::CapturingNetLog log(net::CapturingNetLog::kUnbounded);
+ net::ClientSocket* transport = new net::TCPClientSocket(addr, &log);
+ rv = transport->Connect(&callback);
if (rv == net::ERR_IO_PENDING)
rv = callback.WaitForResult();
EXPECT_EQ(net::OK, rv);
@@ -169,10 +170,9 @@
EXPECT_FALSE(sock->IsConnected());
- net::CapturingBoundNetLog log(net::CapturingNetLog::kUnbounded);
- rv = sock->Connect(&callback, log.bound());
+ rv = sock->Connect(&callback);
EXPECT_TRUE(net::LogContainsBeginEvent(
- log.entries(), 0, net::NetLog::TYPE_SSL_CONNECT));
+ log.entries(), 2, net::NetLog::TYPE_SSL_CONNECT));
if (rv != net::ERR_CERT_COMMON_NAME_INVALID) {
ASSERT_EQ(net::ERR_IO_PENDING, rv);
EXPECT_FALSE(sock->IsConnected());
@@ -209,8 +209,8 @@
rv = callback.WaitForResult();
EXPECT_EQ(net::OK, rv);
- net::ClientSocket *transport = new net::TCPClientSocket(addr);
- rv = transport->Connect(&callback, NULL);
+ net::ClientSocket* transport = new net::TCPClientSocket(addr, NULL);
+ rv = transport->Connect(&callback);
if (rv == net::ERR_IO_PENDING)
rv = callback.WaitForResult();
EXPECT_EQ(net::OK, rv);
@@ -220,7 +220,7 @@
server_.kHostName,
kDefaultSSLConfig));
- rv = sock->Connect(&callback, NULL);
+ rv = sock->Connect(&callback);
if (rv != net::OK) {
ASSERT_EQ(net::ERR_IO_PENDING, rv);
@@ -271,8 +271,8 @@
rv = callback.WaitForResult();
EXPECT_EQ(net::OK, rv);
- net::ClientSocket *transport = new net::TCPClientSocket(addr);
- rv = transport->Connect(&callback, NULL);
+ net::ClientSocket* transport = new net::TCPClientSocket(addr, NULL);
+ rv = transport->Connect(&callback);
if (rv == net::ERR_IO_PENDING)
rv = callback.WaitForResult();
EXPECT_EQ(net::OK, rv);
@@ -282,7 +282,7 @@
server_.kHostName,
kDefaultSSLConfig));
- rv = sock->Connect(&callback, NULL);
+ rv = sock->Connect(&callback);
if (rv != net::OK) {
ASSERT_EQ(net::ERR_IO_PENDING, rv);
@@ -330,8 +330,8 @@
int rv = resolver_->Resolve(info, &addr, NULL, NULL, NULL);
EXPECT_EQ(net::OK, rv);
- net::ClientSocket *transport = new net::TCPClientSocket(addr);
- rv = transport->Connect(&callback, NULL);
+ net::ClientSocket* transport = new net::TCPClientSocket(addr, NULL);
+ rv = transport->Connect(&callback);
if (rv == net::ERR_IO_PENDING)
rv = callback.WaitForResult();
EXPECT_EQ(net::OK, rv);
@@ -340,7 +340,7 @@
socket_factory_->CreateSSLClientSocket(transport,
server_.kHostName, kDefaultSSLConfig));
- rv = sock->Connect(&callback, NULL);
+ rv = sock->Connect(&callback);
if (rv != net::OK) {
ASSERT_EQ(net::ERR_IO_PENDING, rv);
@@ -384,8 +384,8 @@
int rv = resolver_->Resolve(info, &addr, NULL, NULL, NULL);
EXPECT_EQ(net::OK, rv);
- net::ClientSocket *transport = new net::TCPClientSocket(addr);
- rv = transport->Connect(&callback, NULL);
+ net::ClientSocket* transport = new net::TCPClientSocket(addr, NULL);
+ rv = transport->Connect(&callback);
if (rv == net::ERR_IO_PENDING)
rv = callback.WaitForResult();
EXPECT_EQ(net::OK, rv);
@@ -394,7 +394,7 @@
socket_factory_->CreateSSLClientSocket(transport,
server_.kHostName, kDefaultSSLConfig));
- rv = sock->Connect(&callback, NULL);
+ rv = sock->Connect(&callback);
if (rv != net::OK) {
ASSERT_EQ(net::ERR_IO_PENDING, rv);