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

Unified Diff: net/proxy/proxy_resolver_js_bindings_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/proxy/multi_threaded_proxy_resolver_unittest.cc ('k') | net/proxy/proxy_resolver_v8_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/proxy_resolver_js_bindings_unittest.cc
===================================================================
--- net/proxy/proxy_resolver_js_bindings_unittest.cc (revision 67848)
+++ net/proxy/proxy_resolver_js_bindings_unittest.cc (working copy)
@@ -304,65 +304,82 @@
bindings->set_current_request_context(&context);
std::string ip_address;
+ net::CapturingNetLog::EntryList entries;
+ log.GetEntries(&entries);
+ ASSERT_EQ(0u, entries.size());
- ASSERT_EQ(0u, log.entries().size());
-
// Call all the bindings. Each call should be logging something to
// our NetLog.
bindings->MyIpAddress(&ip_address);
- EXPECT_EQ(2u, log.entries().size());
+
+ log.GetEntries(&entries);
+ EXPECT_EQ(2u, entries.size());
EXPECT_TRUE(LogContainsBeginEvent(
- log.entries(), 0, NetLog::TYPE_PAC_JAVASCRIPT_MY_IP_ADDRESS));
+ entries, 0, NetLog::TYPE_PAC_JAVASCRIPT_MY_IP_ADDRESS));
EXPECT_TRUE(LogContainsEndEvent(
- log.entries(), 1, NetLog::TYPE_PAC_JAVASCRIPT_MY_IP_ADDRESS));
+ entries, 1, NetLog::TYPE_PAC_JAVASCRIPT_MY_IP_ADDRESS));
bindings->MyIpAddressEx(&ip_address);
- EXPECT_EQ(4u, log.entries().size());
+
+ log.GetEntries(&entries);
+ EXPECT_EQ(4u, entries.size());
EXPECT_TRUE(LogContainsBeginEvent(
- log.entries(), 2, NetLog::TYPE_PAC_JAVASCRIPT_MY_IP_ADDRESS_EX));
+ entries, 2, NetLog::TYPE_PAC_JAVASCRIPT_MY_IP_ADDRESS_EX));
EXPECT_TRUE(LogContainsEndEvent(
- log.entries(), 3, NetLog::TYPE_PAC_JAVASCRIPT_MY_IP_ADDRESS_EX));
+ entries, 3, NetLog::TYPE_PAC_JAVASCRIPT_MY_IP_ADDRESS_EX));
bindings->DnsResolve("foo", &ip_address);
- EXPECT_EQ(6u, log.entries().size());
+
+ log.GetEntries(&entries);
+ EXPECT_EQ(6u, entries.size());
EXPECT_TRUE(LogContainsBeginEvent(
- log.entries(), 4, NetLog::TYPE_PAC_JAVASCRIPT_DNS_RESOLVE));
+ entries, 4, NetLog::TYPE_PAC_JAVASCRIPT_DNS_RESOLVE));
EXPECT_TRUE(LogContainsEndEvent(
- log.entries(), 5, NetLog::TYPE_PAC_JAVASCRIPT_DNS_RESOLVE));
+ entries, 5, NetLog::TYPE_PAC_JAVASCRIPT_DNS_RESOLVE));
bindings->DnsResolveEx("foo", &ip_address);
- EXPECT_EQ(8u, log.entries().size());
+
+ log.GetEntries(&entries);
+ EXPECT_EQ(8u, entries.size());
EXPECT_TRUE(LogContainsBeginEvent(
- log.entries(), 6, NetLog::TYPE_PAC_JAVASCRIPT_DNS_RESOLVE_EX));
+ entries, 6, NetLog::TYPE_PAC_JAVASCRIPT_DNS_RESOLVE_EX));
EXPECT_TRUE(LogContainsEndEvent(
- log.entries(), 7, NetLog::TYPE_PAC_JAVASCRIPT_DNS_RESOLVE_EX));
+ entries, 7, NetLog::TYPE_PAC_JAVASCRIPT_DNS_RESOLVE_EX));
// Nothing has been emitted globally yet.
- EXPECT_EQ(0u, global_log.entries().size());
+ net::CapturingNetLog::EntryList global_log_entries;
+ global_log.GetEntries(&global_log_entries);
+ EXPECT_EQ(0u, global_log_entries.size());
bindings->OnError(30, string16());
- EXPECT_EQ(9u, log.entries().size());
+
+ log.GetEntries(&entries);
+ EXPECT_EQ(9u, entries.size());
EXPECT_TRUE(LogContainsEvent(
- log.entries(), 8, NetLog::TYPE_PAC_JAVASCRIPT_ERROR,
+ entries, 8, NetLog::TYPE_PAC_JAVASCRIPT_ERROR,
NetLog::PHASE_NONE));
// We also emit errors to the top-level log stream.
- EXPECT_EQ(1u, global_log.entries().size());
+ global_log.GetEntries(&global_log_entries);
+ EXPECT_EQ(1u, global_log_entries.size());
EXPECT_TRUE(LogContainsEvent(
- global_log.entries(), 0, NetLog::TYPE_PAC_JAVASCRIPT_ERROR,
+ global_log_entries, 0, NetLog::TYPE_PAC_JAVASCRIPT_ERROR,
NetLog::PHASE_NONE));
bindings->Alert(string16());
- EXPECT_EQ(10u, log.entries().size());
+
+ log.GetEntries(&entries);
+ EXPECT_EQ(10u, entries.size());
EXPECT_TRUE(LogContainsEvent(
- log.entries(), 9, NetLog::TYPE_PAC_JAVASCRIPT_ALERT,
+ entries, 9, NetLog::TYPE_PAC_JAVASCRIPT_ALERT,
NetLog::PHASE_NONE));
// We also emit javascript alerts to the top-level log stream.
- EXPECT_EQ(2u, global_log.entries().size());
+ global_log.GetEntries(&global_log_entries);
+ EXPECT_EQ(2u, global_log_entries.size());
EXPECT_TRUE(LogContainsEvent(
- global_log.entries(), 1, NetLog::TYPE_PAC_JAVASCRIPT_ALERT,
+ global_log_entries, 1, NetLog::TYPE_PAC_JAVASCRIPT_ALERT,
NetLog::PHASE_NONE));
}
« no previous file with comments | « net/proxy/multi_threaded_proxy_resolver_unittest.cc ('k') | net/proxy/proxy_resolver_v8_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698