vishal.b | 62985ca9 | 2015-04-17 08:45:51 | [diff] [blame^] | 1 | // Copyright (c) 2012 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/log/test_net_log.h" |
| 6 | |
| 7 | namespace net { |
| 8 | |
| 9 | TestNetLog::TestNetLog() { |
| 10 | DeprecatedAddObserver(&capturing_net_log_observer_, LOG_ALL_BUT_BYTES); |
| 11 | } |
| 12 | |
| 13 | TestNetLog::~TestNetLog() { |
| 14 | DeprecatedRemoveObserver(&capturing_net_log_observer_); |
| 15 | } |
| 16 | |
| 17 | void TestNetLog::SetLogLevel(NetLog::LogLevel log_level) { |
| 18 | SetObserverLogLevel(&capturing_net_log_observer_, log_level); |
| 19 | } |
| 20 | |
| 21 | void TestNetLog::GetEntries(TestNetLog::CapturedEntryList* entry_list) const { |
| 22 | capturing_net_log_observer_.GetEntries(entry_list); |
| 23 | } |
| 24 | |
| 25 | void TestNetLog::GetEntriesForSource(NetLog::Source source, |
| 26 | CapturedEntryList* entry_list) const { |
| 27 | capturing_net_log_observer_.GetEntriesForSource(source, entry_list); |
| 28 | } |
| 29 | |
| 30 | size_t TestNetLog::GetSize() const { |
| 31 | return capturing_net_log_observer_.GetSize(); |
| 32 | } |
| 33 | |
| 34 | void TestNetLog::Clear() { |
| 35 | capturing_net_log_observer_.Clear(); |
| 36 | } |
| 37 | |
| 38 | BoundTestNetLog::BoundTestNetLog() |
| 39 | : net_log_( |
| 40 | BoundNetLog::Make(&capturing_net_log_, net::NetLog::SOURCE_NONE)) { |
| 41 | } |
| 42 | |
| 43 | BoundTestNetLog::~BoundTestNetLog() { |
| 44 | } |
| 45 | |
| 46 | void BoundTestNetLog::GetEntries( |
| 47 | TestNetLog::CapturedEntryList* entry_list) const { |
| 48 | capturing_net_log_.GetEntries(entry_list); |
| 49 | } |
| 50 | |
| 51 | void BoundTestNetLog::GetEntriesForSource( |
| 52 | NetLog::Source source, |
| 53 | TestNetLog::CapturedEntryList* entry_list) const { |
| 54 | capturing_net_log_.GetEntriesForSource(source, entry_list); |
| 55 | } |
| 56 | |
| 57 | size_t BoundTestNetLog::GetSize() const { |
| 58 | return capturing_net_log_.GetSize(); |
| 59 | } |
| 60 | |
| 61 | void BoundTestNetLog::Clear() { |
| 62 | capturing_net_log_.Clear(); |
| 63 | } |
| 64 | |
| 65 | void BoundTestNetLog::SetLogLevel(NetLog::LogLevel log_level) { |
| 66 | capturing_net_log_.SetLogLevel(log_level); |
| 67 | } |
| 68 | |
| 69 | } // namespace net |