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 BoundTestNetLog::~BoundTestNetLog() { | 109 BoundTestNetLog::~BoundTestNetLog() { |
110 } | 110 } |
111 | 111 |
112 void BoundTestNetLog::GetEntries(TestNetLogEntry::List* entry_list) const { | 112 void BoundTestNetLog::GetEntries(TestNetLogEntry::List* entry_list) const { |
113 test_net_log_.GetEntries(entry_list); | 113 test_net_log_.GetEntries(entry_list); |
114 } | 114 } |
115 | 115 |
116 void BoundTestNetLog::GetEntriesForSource( | 116 void BoundTestNetLog::GetEntriesForSource( |
117 NetLog::Source source, | 117 NetLog::Source source, |
118 TestNetLogEntry::List* entry_list) const { | 118 TestNetLogEntry::List* entry_list) const { |
119 test_net_log_.GetEntriesForSource(source, entry_list); | 119 test_net_log_.GetEntriesForSource(source, entry_list); |
120 } | 120 } |
121 | 121 |
122 size_t BoundTestNetLog::GetSize() const { | 122 size_t BoundTestNetLog::GetSize() const { |
123 return test_net_log_.GetSize(); | 123 return test_net_log_.GetSize(); |
124 } | 124 } |
125 | 125 |
126 void BoundTestNetLog::Clear() { | 126 void BoundTestNetLog::Clear() { |
127 test_net_log_.Clear(); | 127 test_net_log_.Clear(); |
128 } | 128 } |
129 | 129 |
130 void BoundTestNetLog::SetCaptureMode(NetLogCaptureMode capture_mode) { | 130 void BoundTestNetLog::SetCaptureMode(NetLogCaptureMode capture_mode) { |
131 test_net_log_.SetCaptureMode(capture_mode); | 131 test_net_log_.SetCaptureMode(capture_mode); |
132 } | 132 } |
133 | 133 |
134 } // namespace net | 134 } // namespace net |
OLD | NEW |