| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/log/test_net_log.h" | 5 #include "net/log/test_net_log.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/synchronization/lock.h" | 8 #include "base/synchronization/lock.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "net/log/net_log_source_type.h" |
| 10 | 11 |
| 11 namespace net { | 12 namespace net { |
| 12 | 13 |
| 13 // TestNetLog::Observer is an implementation of NetLog::ThreadSafeObserver | 14 // TestNetLog::Observer is an implementation of NetLog::ThreadSafeObserver |
| 14 // that saves messages to a buffer. | 15 // that saves messages to a buffer. |
| 15 class TestNetLog::Observer : public NetLog::ThreadSafeObserver { | 16 class TestNetLog::Observer : public NetLog::ThreadSafeObserver { |
| 16 public: | 17 public: |
| 17 Observer() {} | 18 Observer() {} |
| 18 ~Observer() override {} | 19 ~Observer() override {} |
| 19 | 20 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 97 |
| 97 void TestNetLog::Clear() { | 98 void TestNetLog::Clear() { |
| 98 observer_->Clear(); | 99 observer_->Clear(); |
| 99 } | 100 } |
| 100 | 101 |
| 101 NetLog::ThreadSafeObserver* TestNetLog::GetObserver() const { | 102 NetLog::ThreadSafeObserver* TestNetLog::GetObserver() const { |
| 102 return observer_.get(); | 103 return observer_.get(); |
| 103 } | 104 } |
| 104 | 105 |
| 105 BoundTestNetLog::BoundTestNetLog() | 106 BoundTestNetLog::BoundTestNetLog() |
| 106 : net_log_(BoundNetLog::Make(&test_net_log_, NetLog::SOURCE_NONE)) { | 107 : net_log_(BoundNetLog::Make(&test_net_log_, NetLogSourceType::NONE)) { |
| 107 } | 108 } |
| 108 | 109 |
| 109 BoundTestNetLog::~BoundTestNetLog() { | 110 BoundTestNetLog::~BoundTestNetLog() { |
| 110 } | 111 } |
| 111 | 112 |
| 112 void BoundTestNetLog::GetEntries(TestNetLogEntry::List* entry_list) const { | 113 void BoundTestNetLog::GetEntries(TestNetLogEntry::List* entry_list) const { |
| 113 test_net_log_.GetEntries(entry_list); | 114 test_net_log_.GetEntries(entry_list); |
| 114 } | 115 } |
| 115 | 116 |
| 116 void BoundTestNetLog::GetEntriesForSource( | 117 void BoundTestNetLog::GetEntriesForSource( |
| 117 NetLog::Source source, | 118 NetLog::Source source, |
| 118 TestNetLogEntry::List* entry_list) const { | 119 TestNetLogEntry::List* entry_list) const { |
| 119 test_net_log_.GetEntriesForSource(source, entry_list); | 120 test_net_log_.GetEntriesForSource(source, entry_list); |
| 120 } | 121 } |
| 121 | 122 |
| 122 size_t BoundTestNetLog::GetSize() const { | 123 size_t BoundTestNetLog::GetSize() const { |
| 123 return test_net_log_.GetSize(); | 124 return test_net_log_.GetSize(); |
| 124 } | 125 } |
| 125 | 126 |
| 126 void BoundTestNetLog::Clear() { | 127 void BoundTestNetLog::Clear() { |
| 127 test_net_log_.Clear(); | 128 test_net_log_.Clear(); |
| 128 } | 129 } |
| 129 | 130 |
| 130 void BoundTestNetLog::SetCaptureMode(NetLogCaptureMode capture_mode) { | 131 void BoundTestNetLog::SetCaptureMode(NetLogCaptureMode capture_mode) { |
| 131 test_net_log_.SetCaptureMode(capture_mode); | 132 test_net_log_.SetCaptureMode(capture_mode); |
| 132 } | 133 } |
| 133 | 134 |
| 134 } // namespace net | 135 } // namespace net |
| OLD | NEW |