summaryrefslogtreecommitdiffstats
path: root/net/base
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-02 23:25:19 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-02 23:25:19 +0000
commit5a05c47ae2a497d4efbbb9166fa5ff7aebfd4ecf (patch)
tree4f39f1f44be3eb179f8368bca0bc18512e398a40 /net/base
parentf852667f469ea8fd31b8a1dd0f0130382efe591f (diff)
downloadchromium_src-5a05c47ae2a497d4efbbb9166fa5ff7aebfd4ecf.zip
chromium_src-5a05c47ae2a497d4efbbb9166fa5ff7aebfd4ecf.tar.gz
chromium_src-5a05c47ae2a497d4efbbb9166fa5ff7aebfd4ecf.tar.bz2
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
Diffstat (limited to 'net/base')
-rw-r--r--net/base/load_log_event_type_list.h17
-rw-r--r--net/base/load_log_unittest.h24
2 files changed, 40 insertions, 1 deletions
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 <cstddef>
#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_