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

Unified Diff: net/base/net_log_unittest.cc

Issue 5560013: A scoped NetLog event that automatically logs an end event on destruction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years 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/net_log.cc ('k') | net/net.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/net_log_unittest.cc
===================================================================
--- net/base/net_log_unittest.cc (revision 0)
+++ net/base/net_log_unittest.cc (revision 0)
@@ -0,0 +1,34 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/base/capturing_net_log.h"
+#include "net/base/net_log.h"
+#include "net/base/net_log_unittest.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace net {
+
+namespace {
+
+TEST(NetLog, ScopedNetLogEventTest) {
+ CapturingNetLog log(CapturingNetLog::kUnbounded);
+ BoundNetLog net_log(BoundNetLog::Make(&log, NetLog::SOURCE_URL_REQUEST));
+
+ scoped_ptr<ScopedNetLogEvent> net_log_event(
+ new ScopedNetLogEvent(net_log, NetLog::TYPE_REQUEST_ALIVE, NULL));
+
+ CapturingNetLog::EntryList entries;
+ log.GetEntries(&entries);
+ EXPECT_EQ(1u, entries.size());
+ EXPECT_TRUE(LogContainsBeginEvent(entries, 0, NetLog::TYPE_REQUEST_ALIVE));
+
+ net_log_event.reset();
+ log.GetEntries(&entries);
+ EXPECT_EQ(2u, entries.size());
+ EXPECT_TRUE(LogContainsEndEvent(entries, 1, NetLog::TYPE_REQUEST_ALIVE));
+}
+
+} // namespace
+
+} // namespace net
Property changes on: net\base\net_log_unittest.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « net/base/net_log.cc ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698