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

Unified Diff: net/base/load_log_util_unittest.cc

Issue 363025: Improve the display of LoadLogs when truncation occurs.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Change -1 to be a constant instead Created 11 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/load_log_util.cc ('k') | net/http/http_cache_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/load_log_util_unittest.cc
===================================================================
--- net/base/load_log_util_unittest.cc (revision 31195)
+++ net/base/load_log_util_unittest.cc (working copy)
@@ -10,7 +10,7 @@
namespace {
TEST(LoadLogUtilTest, Basic) {
- scoped_refptr<LoadLog> log(new LoadLog);
+ scoped_refptr<LoadLog> log(new LoadLog(10));
log->Add(MakeTime(1), LoadLog::TYPE_HOST_RESOLVER_IMPL, LoadLog::PHASE_BEGIN);
log->Add(MakeTime(5), LoadLog::TYPE_HOST_RESOLVER_IMPL_OBSERVER_ONSTART,
@@ -30,7 +30,7 @@
}
TEST(LoadLogUtilTest, UnmatchedOpen) {
- scoped_refptr<LoadLog> log(new LoadLog);
+ scoped_refptr<LoadLog> log(new LoadLog(10));
log->Add(MakeTime(3), LoadLog::TYPE_HOST_RESOLVER_IMPL, LoadLog::PHASE_BEGIN);
// Note that there is no matching call to PHASE_END for all of the following.
@@ -53,5 +53,26 @@
LoadLogUtil::PrettyPrintAsEventTree(log));
}
+TEST(LoadLogUtilTest, DisplayOfTruncated) {
+ size_t kMaxNumEntries = 5;
+ scoped_refptr<LoadLog> log(new LoadLog(kMaxNumEntries));
+
+ // Add a total of 10 events. This means that 5 will be truncated.
+ log->Add(MakeTime(0), LoadLog::TYPE_TCP_CONNECT, LoadLog::PHASE_BEGIN);
+ for (size_t i = 1; i < 8; ++i) {
+ log->Add(MakeTime(i), LoadLog::TYPE_CANCELLED, LoadLog::PHASE_NONE);
+ }
+ log->Add(MakeTime(9), LoadLog::TYPE_TCP_CONNECT, LoadLog::PHASE_END);
+
+ EXPECT_EQ(
+ "t=0: +TCP_CONNECT [dt=9]\n"
+ "t=1: CANCELLED\n"
+ "t=2: CANCELLED\n"
+ "t=3: CANCELLED\n"
+ " ... Truncated 4 entries ...\n"
+ "t=9: -TCP_CONNECT",
+ LoadLogUtil::PrettyPrintAsEventTree(log));
+}
+
} // namespace
} // namespace net
« no previous file with comments | « net/base/load_log_util.cc ('k') | net/http/http_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698