From 5a05c47ae2a497d4efbbb9166fa5ff7aebfd4ecf Mon Sep 17 00:00:00 2001 From: "willchan@chromium.org" Date: Mon, 2 Nov 2009 23:25:19 +0000 Subject: Add LoadLog to ClientSocket::Connect(). TODO: Use LoadLog in FLIP code. Review URL: http://codereview.chromium.org/344026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30765 0039d316-1c4b-4281-b951-d872f2087c98 --- net/base/load_log_event_type_list.h | 17 ++++++++++++++++- net/base/load_log_unittest.h | 24 ++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) (limited to 'net/base') diff --git a/net/base/load_log_event_type_list.h b/net/base/load_log_event_type_list.h index 3639003..f17bfb9 100644 --- a/net/base/load_log_event_type_list.h +++ b/net/base/load_log_event_type_list.h @@ -77,6 +77,22 @@ EVENT_TYPE(PROXY_RESOLVER_V8_DNS_RESOLVE) EVENT_TYPE(PROXY_RESOLVER_V8_DNS_RESOLVE_EX) // ------------------------------------------------------------------------ +// ClientSocket::Connect +// ------------------------------------------------------------------------ + +// The start/end of a TCP connect(). +EVENT_TYPE(TCP_CONNECT) + +// The start/end of a SOCKS connect(). +EVENT_TYPE(SOCKS_CONNECT) + +// The start/end of a SOCKS5 connect(). +EVENT_TYPE(SOCKS5_CONNECT) + +// The start/end of a SSL connect(). +EVENT_TYPE(SSL_CONNECT) + +// ------------------------------------------------------------------------ // ClientSocketPoolBase::ConnectJob // ------------------------------------------------------------------------ @@ -128,4 +144,3 @@ EVENT_TYPE(HTTP_CACHE_READ_INFO) // the cache entry to become available (for example if we are waiting for // exclusive access to an existing entry). EVENT_TYPE(HTTP_CACHE_WAITING) - diff --git a/net/base/load_log_unittest.h b/net/base/load_log_unittest.h index da892a0..f67c8bc 100644 --- a/net/base/load_log_unittest.h +++ b/net/base/load_log_unittest.h @@ -5,6 +5,7 @@ #ifndef NET_BASE_LOAD_LOG_UNITTEST_H_ #define NET_BASE_LOAD_LOG_UNITTEST_H_ +#include #include "net/base/load_log.h" #include "testing/gtest/include/gtest/gtest.h" @@ -40,6 +41,29 @@ inline void ExpectLogContains(const LoadLog* log, EXPECT_EQ(expected_phase, log->events()[i].phase); } +inline ::testing::AssertionResult LogContains( + const LoadLog& log, + int i, // Negative indices are reverse indices. + LoadLog::EventType expected_event, + LoadLog::EventPhase expected_phase) { + // Negative indices are reverse indices. + size_t j = (i < 0) ? log.events().size() + i : i; + if (j >= log.events().size()) + return ::testing::AssertionFailure() << j << " is out of bounds."; + if (expected_event != log.events()[j].type) { + return ::testing::AssertionFailure() + << "Actual event: " << LoadLog::EventTypeToString(log.events()[j].type) + << ". Expected event: " << LoadLog::EventTypeToString(expected_event) + << "."; + } + if (expected_phase != log.events()[j].phase) { + return ::testing::AssertionFailure() + << "Actual phase: " << log.events()[j].phase + << ". Expected phase: " << expected_phase << "."; + } + return ::testing::AssertionSuccess(); +} + } // namespace net #endif // NET_BASE_LOAD_LOG_UNITTEST_H_ -- cgit v1.1