OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "net/base/capturing_net_log.h" |
| 6 #include "net/base/net_log.h" |
| 7 #include "net/base/net_log_unittest.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 |
| 10 TEST(NetLog, ScopedNetLogEventTest) { |
| 11 net::CapturingNetLog log(net::CapturingNetLog::kUnbounded); |
| 12 net::BoundNetLog net_log( |
| 13 net::BoundNetLog::Make(&log, net::NetLog::SOURCE_URL_REQUEST)); |
| 14 |
| 15 scoped_ptr<net::ScopedNetLogEvent> net_log_event( |
| 16 new net::ScopedNetLogEvent(net_log, net::NetLog::TYPE_REQUEST_ALIVE, |
| 17 NULL)); |
| 18 |
| 19 net::CapturingNetLog::EntryList entries; |
| 20 log.GetEntries(&entries); |
| 21 EXPECT_EQ(1u, entries.size()); |
| 22 EXPECT_TRUE(net::LogContainsBeginEvent( |
| 23 entries, 0, net::NetLog::TYPE_REQUEST_ALIVE)); |
| 24 |
| 25 net_log_event.reset(); |
| 26 log.GetEntries(&entries); |
| 27 EXPECT_EQ(2u, entries.size()); |
| 28 EXPECT_TRUE(net::LogContainsEndEvent( |
| 29 entries, 1, net::NetLog::TYPE_REQUEST_ALIVE)); |
| 30 } |
OLD | NEW |