Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(906)

Unified Diff: net/base/host_resolver_impl_unittest.cc

Issue 4118004: Update NetLog to be thread safe. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Final sync with trunk Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/forwarding_net_log_unittest.cc ('k') | net/base/net_log.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/host_resolver_impl_unittest.cc
===================================================================
--- net/base/host_resolver_impl_unittest.cc (revision 67848)
+++ net/base/host_resolver_impl_unittest.cc (working copy)
@@ -271,11 +271,14 @@
int err = host_resolver->Resolve(info, &addrlist, NULL, NULL, log.bound());
EXPECT_EQ(OK, err);
- EXPECT_EQ(2u, log.entries().size());
+ net::CapturingNetLog::EntryList entries;
+ log.GetEntries(&entries);
+
+ EXPECT_EQ(2u, entries.size());
EXPECT_TRUE(LogContainsBeginEvent(
- log.entries(), 0, NetLog::TYPE_HOST_RESOLVER_IMPL));
+ entries, 0, NetLog::TYPE_HOST_RESOLVER_IMPL));
EXPECT_TRUE(LogContainsEndEvent(
- log.entries(), 1, NetLog::TYPE_HOST_RESOLVER_IMPL));
+ entries, 1, NetLog::TYPE_HOST_RESOLVER_IMPL));
const struct addrinfo* ainfo = addrlist.head();
EXPECT_EQ(static_cast<addrinfo*>(NULL), ainfo->ai_next);
@@ -304,18 +307,23 @@
log.bound());
EXPECT_EQ(ERR_IO_PENDING, err);
- EXPECT_EQ(1u, log.entries().size());
+ net::CapturingNetLog::EntryList entries;
+ log.GetEntries(&entries);
+
+ EXPECT_EQ(1u, entries.size());
EXPECT_TRUE(LogContainsBeginEvent(
- log.entries(), 0, NetLog::TYPE_HOST_RESOLVER_IMPL));
+ entries, 0, NetLog::TYPE_HOST_RESOLVER_IMPL));
MessageLoop::current()->Run();
ASSERT_TRUE(callback_called_);
ASSERT_EQ(OK, callback_result_);
- EXPECT_EQ(2u, log.entries().size());
+ log.GetEntries(&entries);
+
+ EXPECT_EQ(2u, entries.size());
EXPECT_TRUE(LogContainsEndEvent(
- log.entries(), 1, NetLog::TYPE_HOST_RESOLVER_IMPL));
+ entries, 1, NetLog::TYPE_HOST_RESOLVER_IMPL));
const struct addrinfo* ainfo = addrlist.head();
EXPECT_EQ(static_cast<addrinfo*>(NULL), ainfo->ai_next);
@@ -356,31 +364,37 @@
resolver_proc->Signal();
- EXPECT_EQ(2u, log.entries().size());
+ net::CapturingNetLog::EntryList entries;
+ log.GetEntries(&entries);
+
+ EXPECT_EQ(2u, entries.size());
EXPECT_TRUE(LogContainsBeginEvent(
- log.entries(), 0, NetLog::TYPE_HOST_RESOLVER_IMPL));
+ entries, 0, NetLog::TYPE_HOST_RESOLVER_IMPL));
EXPECT_TRUE(LogContainsEndEvent(
- log.entries(), 1, NetLog::TYPE_HOST_RESOLVER_IMPL));
+ entries, 1, NetLog::TYPE_HOST_RESOLVER_IMPL));
- int pos = net::ExpectLogContainsSomewhereAfter(net_log.entries(), 0,
+ net::CapturingNetLog::EntryList net_log_entries;
+ net_log.GetEntries(&net_log_entries);
+
+ int pos = net::ExpectLogContainsSomewhereAfter(net_log_entries, 0,
net::NetLog::TYPE_HOST_RESOLVER_IMPL_REQUEST,
net::NetLog::PHASE_BEGIN);
- pos = net::ExpectLogContainsSomewhereAfter(net_log.entries(), pos + 1,
+ pos = net::ExpectLogContainsSomewhereAfter(net_log_entries, pos + 1,
net::NetLog::TYPE_HOST_RESOLVER_IMPL_JOB,
net::NetLog::PHASE_BEGIN);
// Both Job and Request need to be cancelled.
- pos = net::ExpectLogContainsSomewhereAfter(net_log.entries(), pos + 1,
+ pos = net::ExpectLogContainsSomewhereAfter(net_log_entries, pos + 1,
net::NetLog::TYPE_CANCELLED,
net::NetLog::PHASE_NONE);
// Don't care about order in which they end, or when the other one is
// cancelled.
- net::ExpectLogContainsSomewhereAfter(net_log.entries(), pos + 1,
+ net::ExpectLogContainsSomewhereAfter(net_log_entries, pos + 1,
net::NetLog::TYPE_CANCELLED,
net::NetLog::PHASE_NONE);
- net::ExpectLogContainsSomewhereAfter(net_log.entries(), pos + 1,
+ net::ExpectLogContainsSomewhereAfter(net_log_entries, pos + 1,
net::NetLog::TYPE_HOST_RESOLVER_IMPL_REQUEST,
net::NetLog::PHASE_END);
- net::ExpectLogContainsSomewhereAfter(net_log.entries(), pos + 1,
+ net::ExpectLogContainsSomewhereAfter(net_log_entries, pos + 1,
net::NetLog::TYPE_HOST_RESOLVER_IMPL_JOB,
net::NetLog::PHASE_END);
@@ -943,11 +957,14 @@
int rv = host_resolver->Resolve(info1, &addrlist, NULL, NULL, log.bound());
EXPECT_EQ(OK, rv);
- EXPECT_EQ(2u, log.entries().size());
+ net::CapturingNetLog::EntryList entries;
+ log.GetEntries(&entries);
+
+ EXPECT_EQ(2u, entries.size());
EXPECT_TRUE(LogContainsBeginEvent(
- log.entries(), 0, NetLog::TYPE_HOST_RESOLVER_IMPL));
+ entries, 0, NetLog::TYPE_HOST_RESOLVER_IMPL));
EXPECT_TRUE(LogContainsEndEvent(
- log.entries(), 1, NetLog::TYPE_HOST_RESOLVER_IMPL));
+ entries, 1, NetLog::TYPE_HOST_RESOLVER_IMPL));
EXPECT_EQ(1U, observer.start_log.size());
EXPECT_EQ(1U, observer.finish_log.size());
« no previous file with comments | « net/base/forwarding_net_log_unittest.cc ('k') | net/base/net_log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698