summaryrefslogtreecommitdiffstats
path: root/net/socket/client_socket_pool_base_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'net/socket/client_socket_pool_base_unittest.cc')
-rw-r--r--net/socket/client_socket_pool_base_unittest.cc70
1 files changed, 44 insertions, 26 deletions
diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc
index d145bdf..fd9e337 100644
--- a/net/socket/client_socket_pool_base_unittest.cc
+++ b/net/socket/client_socket_pool_base_unittest.cc
@@ -620,21 +620,24 @@ TEST_F(ClientSocketPoolBaseTest, ConnectJob_TimedOut) {
PlatformThread::Sleep(1);
EXPECT_EQ(ERR_TIMED_OUT, delegate.WaitForResult());
- EXPECT_EQ(6u, log.entries().size());
+ net::CapturingNetLog::EntryList entries;
+ log.GetEntries(&entries);
+
+ EXPECT_EQ(6u, entries.size());
EXPECT_TRUE(LogContainsBeginEvent(
- log.entries(), 0, NetLog::TYPE_SOCKET_POOL_CONNECT_JOB));
+ entries, 0, NetLog::TYPE_SOCKET_POOL_CONNECT_JOB));
EXPECT_TRUE(LogContainsBeginEvent(
- log.entries(), 1, NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_CONNECT));
+ entries, 1, NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_CONNECT));
EXPECT_TRUE(LogContainsEvent(
- log.entries(), 2, NetLog::TYPE_CONNECT_JOB_SET_SOCKET,
+ entries, 2, NetLog::TYPE_CONNECT_JOB_SET_SOCKET,
NetLog::PHASE_NONE));
EXPECT_TRUE(LogContainsEvent(
- log.entries(), 3, NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_TIMED_OUT,
+ entries, 3, NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_TIMED_OUT,
NetLog::PHASE_NONE));
EXPECT_TRUE(LogContainsEndEvent(
- log.entries(), 4, NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_CONNECT));
+ entries, 4, NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_CONNECT));
EXPECT_TRUE(LogContainsEndEvent(
- log.entries(), 5, NetLog::TYPE_SOCKET_POOL_CONNECT_JOB));
+ entries, 5, NetLog::TYPE_SOCKET_POOL_CONNECT_JOB));
}
TEST_F(ClientSocketPoolBaseTest, BasicSynchronous) {
@@ -655,17 +658,20 @@ TEST_F(ClientSocketPoolBaseTest, BasicSynchronous) {
EXPECT_TRUE(handle.socket());
handle.Reset();
- EXPECT_EQ(4u, log.entries().size());
+ net::CapturingNetLog::EntryList entries;
+ log.GetEntries(&entries);
+
+ EXPECT_EQ(4u, entries.size());
EXPECT_TRUE(LogContainsBeginEvent(
- log.entries(), 0, NetLog::TYPE_SOCKET_POOL));
+ entries, 0, NetLog::TYPE_SOCKET_POOL));
EXPECT_TRUE(LogContainsEvent(
- log.entries(), 1, NetLog::TYPE_SOCKET_POOL_BOUND_TO_CONNECT_JOB,
+ entries, 1, NetLog::TYPE_SOCKET_POOL_BOUND_TO_CONNECT_JOB,
NetLog::PHASE_NONE));
EXPECT_TRUE(LogContainsEvent(
- log.entries(), 2, NetLog::TYPE_SOCKET_POOL_BOUND_TO_SOCKET,
+ entries, 2, NetLog::TYPE_SOCKET_POOL_BOUND_TO_SOCKET,
NetLog::PHASE_NONE));
EXPECT_TRUE(LogContainsEndEvent(
- log.entries(), 3, NetLog::TYPE_SOCKET_POOL));
+ entries, 3, NetLog::TYPE_SOCKET_POOL));
}
TEST_F(ClientSocketPoolBaseTest, InitConnectionFailure) {
@@ -692,14 +698,17 @@ TEST_F(ClientSocketPoolBaseTest, InitConnectionFailure) {
EXPECT_FALSE(handle.is_ssl_error());
EXPECT_TRUE(handle.ssl_error_response_info().headers.get() == NULL);
- EXPECT_EQ(3u, log.entries().size());
+ net::CapturingNetLog::EntryList entries;
+ log.GetEntries(&entries);
+
+ EXPECT_EQ(3u, entries.size());
EXPECT_TRUE(LogContainsBeginEvent(
- log.entries(), 0, NetLog::TYPE_SOCKET_POOL));
+ entries, 0, NetLog::TYPE_SOCKET_POOL));
EXPECT_TRUE(LogContainsEvent(
- log.entries(), 1, NetLog::TYPE_SOCKET_POOL_BOUND_TO_CONNECT_JOB,
+ entries, 1, NetLog::TYPE_SOCKET_POOL_BOUND_TO_CONNECT_JOB,
NetLog::PHASE_NONE));
EXPECT_TRUE(LogContainsEndEvent(
- log.entries(), 2, NetLog::TYPE_SOCKET_POOL));
+ entries, 2, NetLog::TYPE_SOCKET_POOL));
}
TEST_F(ClientSocketPoolBaseTest, TotalLimit) {
@@ -1503,17 +1512,20 @@ TEST_F(ClientSocketPoolBaseTest, BasicAsynchronous) {
EXPECT_TRUE(handle.socket());
handle.Reset();
- EXPECT_EQ(4u, log.entries().size());
+ net::CapturingNetLog::EntryList entries;
+ log.GetEntries(&entries);
+
+ EXPECT_EQ(4u, entries.size());
EXPECT_TRUE(LogContainsBeginEvent(
- log.entries(), 0, NetLog::TYPE_SOCKET_POOL));
+ entries, 0, NetLog::TYPE_SOCKET_POOL));
EXPECT_TRUE(LogContainsEvent(
- log.entries(), 1, NetLog::TYPE_SOCKET_POOL_BOUND_TO_CONNECT_JOB,
+ entries, 1, NetLog::TYPE_SOCKET_POOL_BOUND_TO_CONNECT_JOB,
NetLog::PHASE_NONE));
EXPECT_TRUE(LogContainsEvent(
- log.entries(), 2, NetLog::TYPE_SOCKET_POOL_BOUND_TO_SOCKET,
+ entries, 2, NetLog::TYPE_SOCKET_POOL_BOUND_TO_SOCKET,
NetLog::PHASE_NONE));
EXPECT_TRUE(LogContainsEndEvent(
- log.entries(), 3, NetLog::TYPE_SOCKET_POOL));
+ entries, 3, NetLog::TYPE_SOCKET_POOL));
}
TEST_F(ClientSocketPoolBaseTest,
@@ -1540,14 +1552,17 @@ TEST_F(ClientSocketPoolBaseTest,
EXPECT_FALSE(handle.is_ssl_error());
EXPECT_TRUE(handle.ssl_error_response_info().headers.get() == NULL);
- EXPECT_EQ(3u, log.entries().size());
+ net::CapturingNetLog::EntryList entries;
+ log.GetEntries(&entries);
+
+ EXPECT_EQ(3u, entries.size());
EXPECT_TRUE(LogContainsBeginEvent(
- log.entries(), 0, NetLog::TYPE_SOCKET_POOL));
+ entries, 0, NetLog::TYPE_SOCKET_POOL));
EXPECT_TRUE(LogContainsEvent(
- log.entries(), 1, NetLog::TYPE_SOCKET_POOL_BOUND_TO_CONNECT_JOB,
+ entries, 1, NetLog::TYPE_SOCKET_POOL_BOUND_TO_CONNECT_JOB,
NetLog::PHASE_NONE));
EXPECT_TRUE(LogContainsEndEvent(
- log.entries(), 2, NetLog::TYPE_SOCKET_POOL));
+ entries, 2, NetLog::TYPE_SOCKET_POOL));
}
TEST_F(ClientSocketPoolBaseTest, TwoRequestsCancelOne) {
@@ -1892,8 +1907,11 @@ TEST_F(ClientSocketPoolBaseTest, CleanupTimedOutIdleSockets) {
log.bound());
EXPECT_EQ(OK, rv);
EXPECT_TRUE(handle.is_reused());
+
+ net::CapturingNetLog::EntryList entries;
+ log.GetEntries(&entries);
EXPECT_TRUE(LogContainsEntryWithType(
- log.entries(), 1, NetLog::TYPE_SOCKET_POOL_REUSED_AN_EXISTING_SOCKET));
+ entries, 1, NetLog::TYPE_SOCKET_POOL_REUSED_AN_EXISTING_SOCKET));
}
// Make sure that we process all pending requests even when we're stalling