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

Unified Diff: chrome/browser/net/passive_log_collector_unittest.cc

Issue 1556018: Add support for attaching custom parameters to NetLog events. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Address willchan's comments Created 10 years, 8 months 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 | « chrome/browser/net/passive_log_collector.cc ('k') | chrome/browser/net/view_net_internals_job_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/passive_log_collector_unittest.cc
===================================================================
--- chrome/browser/net/passive_log_collector_unittest.cc (revision 44049)
+++ chrome/browser/net/passive_log_collector_unittest.cc (working copy)
@@ -16,31 +16,28 @@
const net::NetLog::SourceType kSourceType = net::NetLog::SOURCE_NONE;
-net::NetLog::Entry MakeStartLogEntryWithURL(int source_id,
- const std::string& url) {
- net::NetLog::Entry entry;
- entry.source.type = kSourceType;
- entry.source.id = source_id;
- entry.type = net::NetLog::Entry::TYPE_EVENT;
- entry.event = net::NetLog::Event(net::NetLog::TYPE_REQUEST_ALIVE,
- net::NetLog::PHASE_BEGIN);
- entry.string = url;
- return entry;
+net::CapturingNetLog::Entry MakeStartLogEntryWithURL(int source_id,
+ const std::string& url) {
+ return net::CapturingNetLog::Entry(
+ net::NetLog::TYPE_URL_REQUEST_START,
+ base::TimeTicks(),
+ net::NetLog::Source(kSourceType, source_id),
+ net::NetLog::PHASE_BEGIN,
+ new net::NetLogStringParameter(url));
}
-net::NetLog::Entry MakeStartLogEntry(int source_id) {
+net::CapturingNetLog::Entry MakeStartLogEntry(int source_id) {
return MakeStartLogEntryWithURL(source_id,
StringPrintf("http://req%d", source_id));
}
-net::NetLog::Entry MakeEndLogEntry(int source_id) {
- net::NetLog::Entry entry;
- entry.source.type = kSourceType;
- entry.source.id = source_id;
- entry.type = net::NetLog::Entry::TYPE_EVENT;
- entry.event = net::NetLog::Event(net::NetLog::TYPE_REQUEST_ALIVE,
- net::NetLog::PHASE_END);
- return entry;
+net::CapturingNetLog::Entry MakeEndLogEntry(int source_id) {
+ return net::CapturingNetLog::Entry(
+ net::NetLog::TYPE_REQUEST_ALIVE,
+ base::TimeTicks(),
+ net::NetLog::Source(kSourceType, source_id),
+ net::NetLog::PHASE_END,
+ NULL);
}
static const int kMaxNumLoadLogEntries = 1;
@@ -134,22 +131,6 @@
}
}
-// Check that very long URLs are truncated.
-TEST(RequestTrackerTest, GraveyardURLBounded) {
- RequestTracker tracker(NULL);
- EXPECT_FALSE(tracker.IsUnbounded());
-
- std::string big_url("http://");
- big_url.resize(2 * RequestTracker::kMaxGraveyardURLSize, 'x');
-
- tracker.OnAddEntry(MakeStartLogEntryWithURL(1, big_url));
- tracker.OnAddEntry(MakeEndLogEntry(1));
-
- ASSERT_EQ(1u, tracker.GetRecentlyDeceased().size());
- EXPECT_EQ(RequestTracker::kMaxGraveyardURLSize,
- tracker.GetRecentlyDeceased()[0].url.size());
-}
-
// Check that we exclude "chrome://" URLs from being saved into the recent
// requests list (graveyard).
TEST(RequestTrackerTest, GraveyardIsFiltered) {
« no previous file with comments | « chrome/browser/net/passive_log_collector.cc ('k') | chrome/browser/net/view_net_internals_job_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698