Rename TestNetLog->RecordingTestNetLog and BoundTestNetLog->RecordingBoundTestNetLog
These names are more descriptive and also free up the name TestNetLog
for use in a future CL.
Bug: 177538
Change-Id: I46a0680a690e7868bb4c325cbe27c161c2e95b7d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1912783
Reviewed-by: Brandon Tolsch <[email protected]>
Reviewed-by: Gauthier Ambard <[email protected]>
Reviewed-by: Clark DuVall <[email protected]>
Reviewed-by: Eric Roman <[email protected]>
Commit-Queue: Matt Mueller <[email protected]>
Cr-Commit-Position: refs/heads/master@{#718950}
diff --git a/net/log/net_log_unittest.cc b/net/log/net_log_unittest.cc
index bd7b0f7..8dfef14 100644
--- a/net/log/net_log_unittest.cc
+++ b/net/log/net_log_unittest.cc
@@ -36,7 +36,7 @@
}
TEST(NetLogTest, Basic) {
- TestNetLog net_log;
+ RecordingTestNetLog net_log;
auto entries = net_log.GetEntries();
EXPECT_EQ(0u, entries.size());
@@ -60,7 +60,7 @@
NetLogCaptureMode::kEverything,
};
- TestNetLog net_log;
+ RecordingTestNetLog net_log;
for (NetLogCaptureMode mode : kModes) {
net_log.SetObserverCaptureMode(mode);
diff --git a/net/log/net_log_util_unittest.cc b/net/log/net_log_util_unittest.cc
index a40d6c7d..87c554c 100644
--- a/net/log/net_log_util_unittest.cc
+++ b/net/log/net_log_util_unittest.cc
@@ -78,7 +78,7 @@
}
std::set<URLRequestContext*> contexts;
contexts.insert(&context);
- TestNetLog test_net_log;
+ RecordingTestNetLog test_net_log;
CreateNetLogEntriesForActiveObjects(contexts, test_net_log.GetObserver());
auto entry_list = test_net_log.GetEntries();
ASSERT_EQ(num_requests, entry_list.size());
@@ -109,7 +109,7 @@
contexts[i]->CreateRequest(GURL("about:hats"), DEFAULT_PRIORITY,
&delegate, TRAFFIC_ANNOTATION_FOR_TESTS));
}
- TestNetLog test_net_log;
+ RecordingTestNetLog test_net_log;
CreateNetLogEntriesForActiveObjects(context_set,
test_net_log.GetObserver());
auto entry_list = test_net_log.GetEntries();
diff --git a/net/log/test_net_log.cc b/net/log/test_net_log.cc
index 0bb9ab1..b531f6b 100644
--- a/net/log/test_net_log.cc
+++ b/net/log/test_net_log.cc
@@ -14,15 +14,15 @@
namespace net {
-TestNetLog::TestNetLog() {
+RecordingTestNetLog::RecordingTestNetLog() {
AddObserver(this, NetLogCaptureMode::kIncludeSensitive);
}
-TestNetLog::~TestNetLog() {
+RecordingTestNetLog::~RecordingTestNetLog() {
RemoveObserver(this);
}
-std::vector<NetLogEntry> TestNetLog::GetEntries() const {
+std::vector<NetLogEntry> RecordingTestNetLog::GetEntries() const {
base::AutoLock lock(lock_);
std::vector<NetLogEntry> result;
for (const auto& entry : entry_list_)
@@ -30,7 +30,7 @@
return result;
}
-std::vector<NetLogEntry> TestNetLog::GetEntriesForSource(
+std::vector<NetLogEntry> RecordingTestNetLog::GetEntriesForSource(
NetLogSource source) const {
base::AutoLock lock(lock_);
std::vector<NetLogEntry> result;
@@ -41,7 +41,7 @@
return result;
}
-std::vector<NetLogEntry> TestNetLog::GetEntriesWithType(
+std::vector<NetLogEntry> RecordingTestNetLog::GetEntriesWithType(
NetLogEventType type) const {
base::AutoLock lock(lock_);
std::vector<NetLogEntry> result;
@@ -52,17 +52,17 @@
return result;
}
-size_t TestNetLog::GetSize() const {
+size_t RecordingTestNetLog::GetSize() const {
base::AutoLock lock(lock_);
return entry_list_.size();
}
-void TestNetLog::Clear() {
+void RecordingTestNetLog::Clear() {
base::AutoLock lock(lock_);
entry_list_.clear();
}
-void TestNetLog::OnAddEntry(const NetLogEntry& entry) {
+void RecordingTestNetLog::OnAddEntry(const NetLogEntry& entry) {
base::Value params = entry.params.Clone();
auto time = base::TimeTicks::Now();
@@ -72,44 +72,46 @@
std::move(params));
}
-NetLog::ThreadSafeObserver* TestNetLog::GetObserver() {
+NetLog::ThreadSafeObserver* RecordingTestNetLog::GetObserver() {
return this;
}
-void TestNetLog::SetObserverCaptureMode(NetLogCaptureMode capture_mode) {
+void RecordingTestNetLog::SetObserverCaptureMode(
+ NetLogCaptureMode capture_mode) {
RemoveObserver(this);
AddObserver(this, capture_mode);
}
-BoundTestNetLog::BoundTestNetLog()
+RecordingBoundTestNetLog::RecordingBoundTestNetLog()
: net_log_(NetLogWithSource::Make(&test_net_log_, NetLogSourceType::NONE)) {
}
-BoundTestNetLog::~BoundTestNetLog() = default;
+RecordingBoundTestNetLog::~RecordingBoundTestNetLog() = default;
-std::vector<NetLogEntry> BoundTestNetLog::GetEntries() const {
+std::vector<NetLogEntry> RecordingBoundTestNetLog::GetEntries() const {
return test_net_log_.GetEntries();
}
-std::vector<NetLogEntry> BoundTestNetLog::GetEntriesForSource(
+std::vector<NetLogEntry> RecordingBoundTestNetLog::GetEntriesForSource(
NetLogSource source) const {
return test_net_log_.GetEntriesForSource(source);
}
-std::vector<NetLogEntry> BoundTestNetLog::GetEntriesWithType(
+std::vector<NetLogEntry> RecordingBoundTestNetLog::GetEntriesWithType(
NetLogEventType type) const {
return test_net_log_.GetEntriesWithType(type);
}
-size_t BoundTestNetLog::GetSize() const {
+size_t RecordingBoundTestNetLog::GetSize() const {
return test_net_log_.GetSize();
}
-void BoundTestNetLog::Clear() {
+void RecordingBoundTestNetLog::Clear() {
test_net_log_.Clear();
}
-void BoundTestNetLog::SetObserverCaptureMode(NetLogCaptureMode capture_mode) {
+void RecordingBoundTestNetLog::SetObserverCaptureMode(
+ NetLogCaptureMode capture_mode) {
test_net_log_.SetObserverCaptureMode(capture_mode);
}
diff --git a/net/log/test_net_log.h b/net/log/test_net_log.h
index 96ba8ea..20b8f28 100644
--- a/net/log/test_net_log.h
+++ b/net/log/test_net_log.h
@@ -25,10 +25,10 @@
// SetObserverCaptureMode().
//
// This class is for testing only.
-class TestNetLog : public NetLog, public NetLog::ThreadSafeObserver {
+class RecordingTestNetLog : public NetLog, public NetLog::ThreadSafeObserver {
public:
- TestNetLog();
- ~TestNetLog() override;
+ RecordingTestNetLog();
+ ~RecordingTestNetLog() override;
void SetObserverCaptureMode(NetLogCaptureMode capture_mode);
@@ -59,18 +59,18 @@
mutable base::Lock lock_;
std::vector<NetLogEntry> entry_list_;
- DISALLOW_COPY_AND_ASSIGN(TestNetLog);
+ DISALLOW_COPY_AND_ASSIGN(RecordingTestNetLog);
};
// Helper class that exposes a similar API as NetLogWithSource, but uses a
-// TestNetLog rather than the more generic NetLog.
+// RecordingTestNetLog rather than the more generic NetLog.
//
-// A BoundTestNetLog can easily be converted to a NetLogWithSource using the
-// bound() method.
-class BoundTestNetLog {
+// A RecordingBoundTestNetLog can easily be converted to a NetLogWithSource
+// using the bound() method.
+class RecordingBoundTestNetLog {
public:
- BoundTestNetLog();
- ~BoundTestNetLog();
+ RecordingBoundTestNetLog();
+ ~RecordingBoundTestNetLog();
// The returned NetLogWithSource is only valid while |this| is alive.
NetLogWithSource bound() const { return net_log_; }
@@ -89,14 +89,14 @@
void Clear();
- // Sets the observer capture mode of the underlying TestNetLog.
+ // Sets the observer capture mode of the underlying RecordingTestNetLog.
void SetObserverCaptureMode(NetLogCaptureMode capture_mode);
private:
- TestNetLog test_net_log_;
+ RecordingTestNetLog test_net_log_;
const NetLogWithSource net_log_;
- DISALLOW_COPY_AND_ASSIGN(BoundTestNetLog);
+ DISALLOW_COPY_AND_ASSIGN(RecordingBoundTestNetLog);
};
} // namespace net
diff --git a/net/log/trace_net_log_observer_unittest.cc b/net/log/trace_net_log_observer_unittest.cc
index aed7762..694e7e4 100644
--- a/net/log/trace_net_log_observer_unittest.cc
+++ b/net/log/trace_net_log_observer_unittest.cc
@@ -157,7 +157,7 @@
base::ListValue* trace_events() const { return trace_events_.get(); }
- TestNetLog* net_log() { return &net_log_; }
+ RecordingTestNetLog* net_log() { return &net_log_; }
TraceNetLogObserver* trace_net_log_observer() const {
return trace_net_log_observer_.get();
@@ -167,7 +167,7 @@
std::unique_ptr<base::ListValue> trace_events_;
base::trace_event::TraceResultBuffer trace_buffer_;
base::trace_event::TraceResultBuffer::SimpleOutput json_output_;
- TestNetLog net_log_;
+ RecordingTestNetLog net_log_;
std::unique_ptr<TraceNetLogObserver> trace_net_log_observer_;
};