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,30 @@ |
+// 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" |
+ |
+TEST(NetLog, ScopedNetLogEventTest) { |
+ net::CapturingNetLog log(net::CapturingNetLog::kUnbounded); |
eroman
2010/12/09 02:00:14
nit: I generally like to put my unit tests inside
mmenke
2010/12/09 15:12:01
Both namespaces added. Does make for cleaner code
|
+ net::BoundNetLog net_log( |
+ net::BoundNetLog::Make(&log, net::NetLog::SOURCE_URL_REQUEST)); |
+ |
+ scoped_ptr<net::ScopedNetLogEvent> net_log_event( |
+ new net::ScopedNetLogEvent(net_log, net::NetLog::TYPE_REQUEST_ALIVE, |
+ NULL)); |
+ |
+ net::CapturingNetLog::EntryList entries; |
+ log.GetEntries(&entries); |
+ EXPECT_EQ(1u, entries.size()); |
+ EXPECT_TRUE(net::LogContainsBeginEvent( |
+ entries, 0, net::NetLog::TYPE_REQUEST_ALIVE)); |
+ |
+ net_log_event.reset(); |
+ log.GetEntries(&entries); |
+ EXPECT_EQ(2u, entries.size()); |
+ EXPECT_TRUE(net::LogContainsEndEvent( |
+ entries, 1, net::NetLog::TYPE_REQUEST_ALIVE)); |
+} |
Property changes on: net\base\net_log_unittest.cc |
___________________________________________________________________ |
Added: svn:eol-style |
+ LF |