Rename NetLog test classes to match the renamed TestNetLog class.
CapturedNetLogEntry -> TestNetLogEntry
CapturingNetLogObserver -> TestNetLogObserver
net_log_unittest.h -> test_net_log_util.h
[email protected]
BUG=481277
Review URL: https://codereview.chromium.org/1092403005
Cr-Commit-Position: refs/heads/master@{#328183}
diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_event_store_unittest.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_event_store_unittest.cc
index 9f512d42..e3343b24 100644
--- a/components/data_reduction_proxy/core/common/data_reduction_proxy_event_store_unittest.cc
+++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_event_store_unittest.cc
@@ -11,9 +11,9 @@
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_event_creator.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.h"
#include "net/http/http_status_code.h"
-#include "net/log/captured_net_log_entry.h"
#include "net/log/net_log.h"
#include "net/log/test_net_log.h"
+#include "net/log/test_net_log_entry.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace data_reduction_proxy {
@@ -31,8 +31,8 @@
new DataReductionProxyEventCreator(event_store_.get()));
}
- net::CapturedNetLogEntry GetSingleEntry() const {
- net::CapturedNetLogEntry::List entries;
+ net::TestNetLogEntry GetSingleEntry() const {
+ net::TestNetLogEntry::List entries;
net_log_->GetEntries(&entries);
EXPECT_EQ(1u, entries.size());
return entries[0];
@@ -64,7 +64,7 @@
TestDataReductionProxyParams::DefaultFallbackOrigin(),
TestDataReductionProxyParams::DefaultSSLOrigin());
EXPECT_EQ(1u, event_store()->stored_events_.size());
- net::CapturedNetLogEntry entry = GetSingleEntry();
+ net::TestNetLogEntry entry = GetSingleEntry();
EXPECT_EQ(net::NetLog::TYPE_DATA_REDUCTION_PROXY_ENABLED,
entry.type);
}
@@ -73,7 +73,7 @@
EXPECT_EQ(0u, event_store()->stored_events_.size());
event_creator()->AddProxyDisabledEvent(net_log());
EXPECT_EQ(1u, event_store()->stored_events_.size());
- net::CapturedNetLogEntry entry = GetSingleEntry();
+ net::TestNetLogEntry entry = GetSingleEntry();
EXPECT_EQ(net::NetLog::TYPE_DATA_REDUCTION_PROXY_ENABLED,
entry.type);
}
@@ -84,7 +84,7 @@
event_creator()->AddBypassActionEvent(bound_net_log(), "bypass", GURL(),
base::TimeDelta::FromMinutes(1));
EXPECT_EQ(1u, event_store()->stored_events_.size());
- net::CapturedNetLogEntry entry = GetSingleEntry();
+ net::TestNetLogEntry entry = GetSingleEntry();
EXPECT_EQ(net::NetLog::TYPE_DATA_REDUCTION_PROXY_BYPASS_REQUESTED,
entry.type);
EXPECT_NE(nullptr, event_store()->last_bypass_event_.get());
@@ -97,7 +97,7 @@
GURL(), base::TimeDelta::FromMinutes(1));
EXPECT_EQ(1u, event_store()->stored_events_.size());
EXPECT_EQ(1u, net_log()->GetSize());
- net::CapturedNetLogEntry entry = GetSingleEntry();
+ net::TestNetLogEntry entry = GetSingleEntry();
EXPECT_EQ(net::NetLog::TYPE_DATA_REDUCTION_PROXY_BYPASS_REQUESTED,
entry.type);
EXPECT_NE(nullptr, event_store()->last_bypass_event_.get());
@@ -110,7 +110,7 @@
event_creator()->BeginSecureProxyCheck(bound_net_log(), GURL());
EXPECT_EQ(1u, event_store()->stored_events_.size());
EXPECT_EQ(1u, net_log()->GetSize());
- net::CapturedNetLogEntry entry = GetSingleEntry();
+ net::TestNetLogEntry entry = GetSingleEntry();
EXPECT_EQ(net::NetLog::TYPE_DATA_REDUCTION_PROXY_CANARY_REQUEST,
entry.type);
EXPECT_EQ(DataReductionProxyEventStorageDelegate::CHECK_PENDING,
@@ -124,7 +124,7 @@
event_creator()->EndSecureProxyCheck(bound_net_log(), 0, net::HTTP_OK, true);
EXPECT_EQ(1u, event_store()->stored_events_.size());
EXPECT_EQ(1u, net_log()->GetSize());
- net::CapturedNetLogEntry entry = GetSingleEntry();
+ net::TestNetLogEntry entry = GetSingleEntry();
EXPECT_EQ(net::NetLog::TYPE_DATA_REDUCTION_PROXY_CANARY_REQUEST,
entry.type);
EXPECT_EQ(DataReductionProxyEventStorageDelegate::CHECK_SUCCESS,
diff --git a/net/BUILD.gn b/net/BUILD.gn
index 110a265f..371ef94 100644
--- a/net/BUILD.gn
+++ b/net/BUILD.gn
@@ -616,12 +616,13 @@
"dns/mock_mdns_socket_factory.h",
"http/http_transaction_test_util.cc",
"http/http_transaction_test_util.h",
- "log/captured_net_log_entry.cc",
- "log/captured_net_log_entry.h",
- "log/capturing_net_log_observer.cc",
- "log/capturing_net_log_observer.h",
"log/test_net_log.cc",
"log/test_net_log.h",
+ "log/test_net_log_entry.cc",
+ "log/test_net_log_entry.h",
+ "log/test_net_log_observer.cc",
+ "log/test_net_log_observer.h",
+ "log/test_net_log_util.h",
"proxy/mock_proxy_resolver.cc",
"proxy/mock_proxy_resolver.h",
"proxy/mock_proxy_script_fetcher.cc",
diff --git a/net/cert/multi_log_ct_verifier_unittest.cc b/net/cert/multi_log_ct_verifier_unittest.cc
index 6fa4477..8a8e1d2e 100644
--- a/net/cert/multi_log_ct_verifier_unittest.cc
+++ b/net/cert/multi_log_ct_verifier_unittest.cc
@@ -21,9 +21,9 @@
#include "net/cert/sct_status_flags.h"
#include "net/cert/signed_certificate_timestamp.h"
#include "net/cert/x509_certificate.h"
-#include "net/log/captured_net_log_entry.h"
#include "net/log/net_log.h"
#include "net/log/test_net_log.h"
+#include "net/log/test_net_log_entry.h"
#include "net/test/cert_test_util.h"
#include "net/test/ct_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -73,19 +73,19 @@
}
bool CheckForEmbeddedSCTInNetLog(TestNetLog& net_log) {
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
net_log.GetEntries(&entries);
if (entries.size() != 2)
return false;
- const CapturedNetLogEntry& received = entries[0];
+ const TestNetLogEntry& received = entries[0];
std::string embedded_scts;
if (!received.GetStringValue("embedded_scts", &embedded_scts))
return false;
if (embedded_scts.empty())
return false;
- const CapturedNetLogEntry& parsed = entries[1];
+ const TestNetLogEntry& parsed = entries[1];
base::ListValue* verified_scts;
if (!parsed.GetListValue("verified_scts", &verified_scts) ||
verified_scts->GetSize() != 1) {
diff --git a/net/http/http_auth_handler_unittest.cc b/net/http/http_auth_handler_unittest.cc
index 6ffd81b..5757bb6 100644
--- a/net/http/http_auth_handler_unittest.cc
+++ b/net/http/http_auth_handler_unittest.cc
@@ -11,9 +11,9 @@
#include "net/http/http_auth_challenge_tokenizer.h"
#include "net/http/http_auth_handler_mock.h"
#include "net/http/http_request_info.h"
-#include "net/log/captured_net_log_entry.h"
-#include "net/log/net_log_unittest.h"
#include "net/log/test_net_log.h"
+#include "net/log/test_net_log_entry.h"
+#include "net/log/test_net_log_util.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace net {
@@ -39,9 +39,9 @@
HttpAuthChallengeTokenizer tokenizer(
challenge.begin(), challenge.end());
HttpAuthHandlerMock mock_handler;
- TestNetLog capturing_net_log;
+ TestNetLog test_net_log;
BoundNetLog bound_net_log(
- BoundNetLog::Make(&capturing_net_log, NetLog::SOURCE_NONE));
+ BoundNetLog::Make(&test_net_log, NetLog::SOURCE_NONE));
mock_handler.InitFromChallenge(&tokenizer, target,
origin, bound_net_log);
@@ -51,8 +51,8 @@
if (async)
test_callback.WaitForResult();
- CapturedNetLogEntry::List entries;
- capturing_net_log.GetEntries(&entries);
+ TestNetLogEntry::List entries;
+ test_net_log.GetEntries(&entries);
EXPECT_EQ(2u, entries.size());
EXPECT_TRUE(LogContainsBeginEvent(entries, 0, event_type));
diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc
index 5f855a7..0173343 100644
--- a/net/http/http_cache_unittest.cc
+++ b/net/http/http_cache_unittest.cc
@@ -34,9 +34,9 @@
#include "net/http/http_transaction_test_util.h"
#include "net/http/http_util.h"
#include "net/http/mock_http_cache.h"
-#include "net/log/captured_net_log_entry.h"
-#include "net/log/net_log_unittest.h"
#include "net/log/test_net_log.h"
+#include "net/log/test_net_log_entry.h"
+#include "net/log/test_net_log_util.h"
#include "net/socket/client_socket_handle.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "net/websockets/websocket_handshake_stream_base.h"
@@ -534,7 +534,7 @@
// Returns true if |entry| is not one of the log types paid attention to in this
// test. Note that TYPE_HTTP_CACHE_WRITE_INFO and TYPE_HTTP_CACHE_*_DATA are
// ignored.
-bool ShouldIgnoreLogEntry(const CapturedNetLogEntry& entry) {
+bool ShouldIgnoreLogEntry(const TestNetLogEntry& entry) {
switch (entry.type) {
case NetLog::TYPE_HTTP_CACHE_GET_BACKEND:
case NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY:
@@ -550,7 +550,7 @@
// Modifies |entries| to only include log entries created by the cache layer and
// asserted on in these tests.
-void FilterLogEntries(CapturedNetLogEntry::List* entries) {
+void FilterLogEntries(TestNetLogEntry::List* entries) {
entries->erase(std::remove_if(entries->begin(), entries->end(),
&ShouldIgnoreLogEntry),
entries->end());
@@ -558,7 +558,7 @@
bool LogContainsEventType(const BoundTestNetLog& log,
NetLog::EventType expected) {
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
for (size_t i = 0; i < entries.size(); i++) {
if (entries[i].type == expected)
@@ -620,7 +620,7 @@
// Check that the NetLog was filled as expected.
// (We attempted to both Open and Create entries, but both failed).
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
FilterLogEntries(&entries);
@@ -785,7 +785,7 @@
log.bound(), &load_timing_info);
// Check that the NetLog was filled as expected.
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
FilterLogEntries(&entries);
@@ -1043,7 +1043,7 @@
&load_timing_info);
// Check that the NetLog was filled as expected.
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
FilterLogEntries(&entries);
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc
index aba2828..7939921e 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -51,10 +51,10 @@
#include "net/http/http_stream_factory.h"
#include "net/http/http_stream_parser.h"
#include "net/http/http_transaction_test_util.h"
-#include "net/log/captured_net_log_entry.h"
#include "net/log/net_log.h"
-#include "net/log/net_log_unittest.h"
#include "net/log/test_net_log.h"
+#include "net/log/test_net_log_entry.h"
+#include "net/log/test_net_log_util.h"
#include "net/proxy/mock_proxy_resolver.h"
#include "net/proxy/proxy_config_service_fixed.h"
#include "net/proxy/proxy_info.h"
@@ -358,7 +358,7 @@
rv = ReadTransaction(trans.get(), &out.response_data);
EXPECT_EQ(OK, rv);
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
size_t pos = ExpectLogContainsSomewhere(
entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST_HEADERS,
@@ -2454,7 +2454,7 @@
rv = callback1.WaitForResult();
EXPECT_EQ(OK, rv);
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
size_t pos = ExpectLogContainsSomewhere(
entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
@@ -2573,7 +2573,7 @@
rv = callback1.WaitForResult();
EXPECT_EQ(OK, rv);
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
size_t pos = ExpectLogContainsSomewhere(
entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
@@ -2689,7 +2689,7 @@
rv = callback1.WaitForResult();
EXPECT_EQ(OK, rv);
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
size_t pos = ExpectLogContainsSomewhere(
entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
@@ -2794,7 +2794,7 @@
rv = callback1.WaitForResult();
EXPECT_EQ(OK, rv);
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
size_t pos = ExpectLogContainsSomewhere(
entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
@@ -3057,7 +3057,7 @@
rv = callback1.WaitForResult();
EXPECT_EQ(ERR_UNEXPECTED_PROXY_AUTH, rv);
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
size_t pos = ExpectLogContainsSomewhere(
entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
@@ -6817,7 +6817,7 @@
rv = callback1.WaitForResult();
EXPECT_EQ(OK, rv);
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
size_t pos = ExpectLogContainsSomewhere(
entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
@@ -10878,7 +10878,7 @@
rv = callback1.WaitForResult();
EXPECT_EQ(OK, rv);
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
size_t pos = ExpectLogContainsSomewhere(
entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
@@ -10952,7 +10952,7 @@
rv = callback1.WaitForResult();
EXPECT_EQ(ERR_EMPTY_RESPONSE, rv);
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
size_t pos = ExpectLogContainsSomewhere(
entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
diff --git a/net/log/captured_net_log_entry.cc b/net/log/captured_net_log_entry.cc
deleted file mode 100644
index efd344b5..0000000
--- a/net/log/captured_net_log_entry.cc
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "net/log/captured_net_log_entry.h"
-
-#include "base/json/json_writer.h"
-#include "base/logging.h"
-#include "base/values.h"
-
-namespace net {
-
-CapturedNetLogEntry::CapturedNetLogEntry(
- NetLog::EventType type,
- const base::TimeTicks& time,
- NetLog::Source source,
- NetLog::EventPhase phase,
- scoped_ptr<base::DictionaryValue> params)
- : type(type),
- time(time),
- source(source),
- phase(phase),
- params(params.Pass()) {
- // Only entries without a NetLog should have an invalid source.
- CHECK(source.IsValid());
-}
-
-CapturedNetLogEntry::CapturedNetLogEntry(const CapturedNetLogEntry& entry) {
- *this = entry;
-}
-
-CapturedNetLogEntry::~CapturedNetLogEntry() {
-}
-
-CapturedNetLogEntry& CapturedNetLogEntry::operator=(
- const CapturedNetLogEntry& entry) {
- type = entry.type;
- time = entry.time;
- source = entry.source;
- phase = entry.phase;
- params.reset(entry.params ? entry.params->DeepCopy() : NULL);
- return *this;
-}
-
-bool CapturedNetLogEntry::GetStringValue(const std::string& name,
- std::string* value) const {
- if (!params)
- return false;
- return params->GetString(name, value);
-}
-
-bool CapturedNetLogEntry::GetIntegerValue(const std::string& name,
- int* value) const {
- if (!params)
- return false;
- return params->GetInteger(name, value);
-}
-
-bool CapturedNetLogEntry::GetListValue(const std::string& name,
- base::ListValue** value) const {
- if (!params)
- return false;
- return params->GetList(name, value);
-}
-
-bool CapturedNetLogEntry::GetNetErrorCode(int* value) const {
- return GetIntegerValue("net_error", value);
-}
-
-std::string CapturedNetLogEntry::GetParamsJson() const {
- if (!params)
- return std::string();
- std::string json;
- base::JSONWriter::Write(params.get(), &json);
- return json;
-}
-
-} // namespace net
diff --git a/net/log/capturing_net_log_observer.cc b/net/log/capturing_net_log_observer.cc
deleted file mode 100644
index 3e7b960b..0000000
--- a/net/log/capturing_net_log_observer.cc
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "net/log/capturing_net_log_observer.h"
-
-#include "base/values.h"
-
-namespace net {
-
-CapturingNetLogObserver::CapturingNetLogObserver() {
-}
-
-CapturingNetLogObserver::~CapturingNetLogObserver() {
-}
-
-void CapturingNetLogObserver::GetEntries(
- CapturedNetLogEntry::List* entry_list) const {
- base::AutoLock lock(lock_);
- *entry_list = captured_entries_;
-}
-
-void CapturingNetLogObserver::GetEntriesForSource(
- NetLog::Source source,
- CapturedNetLogEntry::List* entry_list) const {
- base::AutoLock lock(lock_);
- entry_list->clear();
- for (CapturedNetLogEntry::List::const_iterator entry =
- captured_entries_.begin();
- entry != captured_entries_.end(); ++entry) {
- if (entry->source.id == source.id)
- entry_list->push_back(*entry);
- }
-}
-
-size_t CapturingNetLogObserver::GetSize() const {
- base::AutoLock lock(lock_);
- return captured_entries_.size();
-}
-
-void CapturingNetLogObserver::Clear() {
- base::AutoLock lock(lock_);
- captured_entries_.clear();
-}
-
-void CapturingNetLogObserver::OnAddEntry(const NetLog::Entry& entry) {
- // Using Dictionaries instead of Values makes checking values a little
- // simpler.
- base::DictionaryValue* param_dict = nullptr;
- base::Value* param_value = entry.ParametersToValue();
- if (param_value && !param_value->GetAsDictionary(¶m_dict))
- delete param_value;
-
- // Only need to acquire the lock when accessing class variables.
- base::AutoLock lock(lock_);
- captured_entries_.push_back(CapturedNetLogEntry(
- entry.type(), base::TimeTicks::Now(), entry.source(), entry.phase(),
- scoped_ptr<base::DictionaryValue>(param_dict)));
-}
-
-} // namespace net
diff --git a/net/log/net_log_unittest.cc b/net/log/net_log_unittest.cc
index 9f1696b..26e71ce 100644
--- a/net/log/net_log_unittest.cc
+++ b/net/log/net_log_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "net/log/net_log_unittest.h"
+#include "net/log/net_log.h"
#include "base/bind.h"
#include "base/memory/scoped_vector.h"
@@ -10,6 +10,9 @@
#include "base/threading/simple_thread.h"
#include "base/values.h"
#include "net/base/net_errors.h"
+#include "net/log/test_net_log.h"
+#include "net/log/test_net_log_entry.h"
+#include "net/log/test_net_log_util.h"
namespace net {
@@ -30,7 +33,7 @@
TEST(NetLogTest, Basic) {
TestNetLog net_log;
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
net_log.GetEntries(&entries);
EXPECT_EQ(0u, entries.size());
@@ -63,7 +66,7 @@
net_log.AddGlobalEntry(NetLog::TYPE_SOCKET_ALIVE,
base::Bind(NetCaptureModeCallback));
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
net_log.GetEntries(&entries);
ASSERT_EQ(1u, entries.size());
diff --git a/net/log/net_log_util_unittest.cc b/net/log/net_log_util_unittest.cc
index 27b2967..7fbcb4c 100644
--- a/net/log/net_log_util_unittest.cc
+++ b/net/log/net_log_util_unittest.cc
@@ -13,7 +13,7 @@
#include "net/base/test_completion_callback.h"
#include "net/http/http_cache.h"
#include "net/http/http_transaction.h"
-#include "net/log/capturing_net_log_observer.h"
+#include "net/log/test_net_log_observer.h"
#include "net/test/spawned_test_server/spawned_test_server.h"
#include "net/url_request/url_request_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -71,10 +71,10 @@
}
std::set<URLRequestContext*> contexts;
contexts.insert(&context);
- CapturingNetLogObserver capturing_observer;
- CreateNetLogEntriesForActiveObjects(contexts, &capturing_observer);
- CapturedNetLogEntry::List entry_list;
- capturing_observer.GetEntries(&entry_list);
+ TestNetLogObserver test_net_log_observer;
+ CreateNetLogEntriesForActiveObjects(contexts, &test_net_log_observer);
+ TestNetLogEntry::List entry_list;
+ test_net_log_observer.GetEntries(&entry_list);
ASSERT_EQ(num_requests, entry_list.size());
for (size_t i = 0; i < num_requests; ++i) {
@@ -102,10 +102,10 @@
->CreateRequest(GURL("about:hats"), DEFAULT_PRIORITY, &delegate)
.release());
}
- CapturingNetLogObserver capturing_observer;
- CreateNetLogEntriesForActiveObjects(context_set, &capturing_observer);
- CapturedNetLogEntry::List entry_list;
- capturing_observer.GetEntries(&entry_list);
+ TestNetLogObserver test_net_log_observer;
+ CreateNetLogEntriesForActiveObjects(context_set, &test_net_log_observer);
+ TestNetLogEntry::List entry_list;
+ test_net_log_observer.GetEntries(&entry_list);
ASSERT_EQ(num_requests, entry_list.size());
for (size_t i = 0; i < num_requests; ++i) {
diff --git a/net/log/test_net_log.cc b/net/log/test_net_log.cc
index 2c38b2f..a2ff30d 100644
--- a/net/log/test_net_log.cc
+++ b/net/log/test_net_log.cc
@@ -7,63 +7,62 @@
namespace net {
TestNetLog::TestNetLog() {
- DeprecatedAddObserver(&capturing_net_log_observer_,
+ DeprecatedAddObserver(&test_net_log_observer_,
NetLogCaptureMode::IncludeCookiesAndCredentials());
}
TestNetLog::~TestNetLog() {
- DeprecatedRemoveObserver(&capturing_net_log_observer_);
+ DeprecatedRemoveObserver(&test_net_log_observer_);
}
void TestNetLog::SetCaptureMode(NetLogCaptureMode capture_mode) {
- SetObserverCaptureMode(&capturing_net_log_observer_, capture_mode);
+ SetObserverCaptureMode(&test_net_log_observer_, capture_mode);
}
-void TestNetLog::GetEntries(CapturedNetLogEntry::List* entry_list) const {
- capturing_net_log_observer_.GetEntries(entry_list);
+void TestNetLog::GetEntries(TestNetLogEntry::List* entry_list) const {
+ test_net_log_observer_.GetEntries(entry_list);
}
-void TestNetLog::GetEntriesForSource(
- NetLog::Source source,
- CapturedNetLogEntry::List* entry_list) const {
- capturing_net_log_observer_.GetEntriesForSource(source, entry_list);
+void TestNetLog::GetEntriesForSource(NetLog::Source source,
+ TestNetLogEntry::List* entry_list) const {
+ test_net_log_observer_.GetEntriesForSource(source, entry_list);
}
size_t TestNetLog::GetSize() const {
- return capturing_net_log_observer_.GetSize();
+ return test_net_log_observer_.GetSize();
}
void TestNetLog::Clear() {
- capturing_net_log_observer_.Clear();
+ test_net_log_observer_.Clear();
}
BoundTestNetLog::BoundTestNetLog()
- : net_log_(BoundNetLog::Make(&capturing_net_log_, NetLog::SOURCE_NONE)) {
+ : net_log_(BoundNetLog::Make(&test_net_log_, NetLog::SOURCE_NONE)) {
}
BoundTestNetLog::~BoundTestNetLog() {
}
-void BoundTestNetLog::GetEntries(CapturedNetLogEntry::List* entry_list) const {
- capturing_net_log_.GetEntries(entry_list);
+void BoundTestNetLog::GetEntries(TestNetLogEntry::List* entry_list) const {
+ test_net_log_.GetEntries(entry_list);
}
void BoundTestNetLog::GetEntriesForSource(
NetLog::Source source,
- CapturedNetLogEntry::List* entry_list) const {
- capturing_net_log_.GetEntriesForSource(source, entry_list);
+ TestNetLogEntry::List* entry_list) const {
+ test_net_log_.GetEntriesForSource(source, entry_list);
}
size_t BoundTestNetLog::GetSize() const {
- return capturing_net_log_.GetSize();
+ return test_net_log_.GetSize();
}
void BoundTestNetLog::Clear() {
- capturing_net_log_.Clear();
+ test_net_log_.Clear();
}
void BoundTestNetLog::SetCaptureMode(NetLogCaptureMode capture_mode) {
- capturing_net_log_.SetCaptureMode(capture_mode);
+ test_net_log_.SetCaptureMode(capture_mode);
}
} // namespace net
diff --git a/net/log/test_net_log.h b/net/log/test_net_log.h
index 3099dedf..769f672 100644
--- a/net/log/test_net_log.h
+++ b/net/log/test_net_log.h
@@ -10,14 +10,14 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
-#include "net/log/captured_net_log_entry.h"
-#include "net/log/capturing_net_log_observer.h"
#include "net/log/net_log.h"
+#include "net/log/test_net_log_entry.h"
+#include "net/log/test_net_log_observer.h"
namespace net {
// TestNetLog is convenience class which combines a NetLog and a
-// CapturingNetLogObserver. It is intended for testing only, and is part of the
+// TestNetLogObserver. It is intended for testing only, and is part of the
// net_test_support project.
class TestNetLog : public NetLog {
public:
@@ -26,15 +26,15 @@
void SetCaptureMode(NetLogCaptureMode capture_mode);
- // Below methods are forwarded to capturing_net_log_observer_.
- void GetEntries(CapturedNetLogEntry::List* entry_list) const;
+ // Below methods are forwarded to test_net_log_observer_.
+ void GetEntries(TestNetLogEntry::List* entry_list) const;
void GetEntriesForSource(Source source,
- CapturedNetLogEntry::List* entry_list) const;
+ TestNetLogEntry::List* entry_list) const;
size_t GetSize() const;
void Clear();
private:
- CapturingNetLogObserver capturing_net_log_observer_;
+ TestNetLogObserver test_net_log_observer_;
DISALLOW_COPY_AND_ASSIGN(TestNetLog);
};
@@ -53,11 +53,11 @@
BoundNetLog bound() const { return net_log_; }
// Fills |entry_list| with all entries in the log.
- void GetEntries(CapturedNetLogEntry::List* entry_list) const;
+ void GetEntries(TestNetLogEntry::List* entry_list) const;
// Fills |entry_list| with all entries in the log from the specified Source.
void GetEntriesForSource(NetLog::Source source,
- CapturedNetLogEntry::List* entry_list) const;
+ TestNetLogEntry::List* entry_list) const;
// Returns number of entries in the log.
size_t GetSize() const;
@@ -68,7 +68,7 @@
void SetCaptureMode(NetLogCaptureMode capture_mode);
private:
- TestNetLog capturing_net_log_;
+ TestNetLog test_net_log_;
const BoundNetLog net_log_;
DISALLOW_COPY_AND_ASSIGN(BoundTestNetLog);
diff --git a/net/log/test_net_log_entry.cc b/net/log/test_net_log_entry.cc
new file mode 100644
index 0000000..d22515f1
--- /dev/null
+++ b/net/log/test_net_log_entry.cc
@@ -0,0 +1,76 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/log/test_net_log_entry.h"
+
+#include "base/json/json_writer.h"
+#include "base/logging.h"
+#include "base/values.h"
+
+namespace net {
+
+TestNetLogEntry::TestNetLogEntry(NetLog::EventType type,
+ const base::TimeTicks& time,
+ NetLog::Source source,
+ NetLog::EventPhase phase,
+ scoped_ptr<base::DictionaryValue> params)
+ : type(type),
+ time(time),
+ source(source),
+ phase(phase),
+ params(params.Pass()) {
+ // Only entries without a NetLog should have an invalid source.
+ CHECK(source.IsValid());
+}
+
+TestNetLogEntry::TestNetLogEntry(const TestNetLogEntry& entry) {
+ *this = entry;
+}
+
+TestNetLogEntry::~TestNetLogEntry() {
+}
+
+TestNetLogEntry& TestNetLogEntry::operator=(const TestNetLogEntry& entry) {
+ type = entry.type;
+ time = entry.time;
+ source = entry.source;
+ phase = entry.phase;
+ params.reset(entry.params ? entry.params->DeepCopy() : NULL);
+ return *this;
+}
+
+bool TestNetLogEntry::GetStringValue(const std::string& name,
+ std::string* value) const {
+ if (!params)
+ return false;
+ return params->GetString(name, value);
+}
+
+bool TestNetLogEntry::GetIntegerValue(const std::string& name,
+ int* value) const {
+ if (!params)
+ return false;
+ return params->GetInteger(name, value);
+}
+
+bool TestNetLogEntry::GetListValue(const std::string& name,
+ base::ListValue** value) const {
+ if (!params)
+ return false;
+ return params->GetList(name, value);
+}
+
+bool TestNetLogEntry::GetNetErrorCode(int* value) const {
+ return GetIntegerValue("net_error", value);
+}
+
+std::string TestNetLogEntry::GetParamsJson() const {
+ if (!params)
+ return std::string();
+ std::string json;
+ base::JSONWriter::Write(params.get(), &json);
+ return json;
+}
+
+} // namespace net
diff --git a/net/log/captured_net_log_entry.h b/net/log/test_net_log_entry.h
similarity index 61%
rename from net/log/captured_net_log_entry.h
rename to net/log/test_net_log_entry.h
index bfc4751a..a3c6a2a 100644
--- a/net/log/captured_net_log_entry.h
+++ b/net/log/test_net_log_entry.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef NET_LOG_CAPTURED_NET_LOG_ENTRY_H_
-#define NET_LOG_CAPTURED_NET_LOG_ENTRY_H_
+#ifndef NET_LOG_TEST_NET_LOG_ENTRY_H_
+#define NET_LOG_TEST_NET_LOG_ENTRY_H_
#include <string>
#include <vector>
@@ -19,28 +19,28 @@
namespace net {
-// CapturedNetLogEntry is much like NetLog::Entry, except it has its own copy of
-// all log data, so a list of entries can be gathered over the course of a test,
-// and then inspected at the end. It is intended for testing only, and is part
-// of the net_test_support project.
-struct CapturedNetLogEntry {
+// TestNetLogEntry is much like NetLog::Entry, except it has its own copy of all
+// log data, so a list of entries can be gathered over the course of a test, and
+// then inspected at the end. It is intended for testing only, and is part of
+// the net_test_support project.
+struct TestNetLogEntry {
// Ordered set of logged entries.
- typedef std::vector<CapturedNetLogEntry> List;
+ typedef std::vector<TestNetLogEntry> List;
- CapturedNetLogEntry(NetLog::EventType type,
- const base::TimeTicks& time,
- NetLog::Source source,
- NetLog::EventPhase phase,
- scoped_ptr<base::DictionaryValue> params);
+ TestNetLogEntry(NetLog::EventType type,
+ const base::TimeTicks& time,
+ NetLog::Source source,
+ NetLog::EventPhase phase,
+ scoped_ptr<base::DictionaryValue> params);
// Copy constructor needed to store in a std::vector because of the
// scoped_ptr.
- CapturedNetLogEntry(const CapturedNetLogEntry& entry);
+ TestNetLogEntry(const TestNetLogEntry& entry);
- ~CapturedNetLogEntry();
+ ~TestNetLogEntry();
// Equality operator needed to store in a std::vector because of the
// scoped_ptr.
- CapturedNetLogEntry& operator=(const CapturedNetLogEntry& entry);
+ TestNetLogEntry& operator=(const TestNetLogEntry& entry);
// Attempt to retrieve an value of the specified type with the given name
// from |params|. Returns true on success, false on failure. Does not
@@ -66,4 +66,4 @@
} // namespace net
-#endif // NET_LOG_CAPTURED_NET_LOG_ENTRY_H_
+#endif // NET_LOG_TEST_NET_LOG_ENTRY_H_
diff --git a/net/log/test_net_log_observer.cc b/net/log/test_net_log_observer.cc
new file mode 100644
index 0000000..888c8c0
--- /dev/null
+++ b/net/log/test_net_log_observer.cc
@@ -0,0 +1,59 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/log/test_net_log_observer.h"
+
+#include "base/values.h"
+
+namespace net {
+
+TestNetLogObserver::TestNetLogObserver() {
+}
+
+TestNetLogObserver::~TestNetLogObserver() {
+}
+
+void TestNetLogObserver::GetEntries(TestNetLogEntry::List* entry_list) const {
+ base::AutoLock lock(lock_);
+ *entry_list = entry_list_;
+}
+
+void TestNetLogObserver::GetEntriesForSource(
+ NetLog::Source source,
+ TestNetLogEntry::List* entry_list) const {
+ base::AutoLock lock(lock_);
+ entry_list->clear();
+ for (TestNetLogEntry::List::const_iterator entry = entry_list_.begin();
+ entry != entry_list_.end(); ++entry) {
+ if (entry->source.id == source.id)
+ entry_list->push_back(*entry);
+ }
+}
+
+size_t TestNetLogObserver::GetSize() const {
+ base::AutoLock lock(lock_);
+ return entry_list_.size();
+}
+
+void TestNetLogObserver::Clear() {
+ base::AutoLock lock(lock_);
+ entry_list_.clear();
+}
+
+void TestNetLogObserver::OnAddEntry(const NetLog::Entry& entry) {
+ // Using Dictionaries instead of Values makes checking values a little
+ // simpler.
+ base::DictionaryValue* param_dict = nullptr;
+ base::Value* param_value = entry.ParametersToValue();
+ if (param_value && !param_value->GetAsDictionary(¶m_dict))
+ delete param_value;
+
+ // Only need to acquire the lock when accessing class variables.
+ base::AutoLock lock(lock_);
+ entry_list_.push_back(TestNetLogEntry(
+ entry.type(), base::TimeTicks::Now(), entry.source(), entry.phase(),
+ scoped_ptr<base::DictionaryValue>(param_dict)));
+}
+
+} // namespace net
diff --git a/net/log/capturing_net_log_observer.h b/net/log/test_net_log_observer.h
similarity index 62%
rename from net/log/capturing_net_log_observer.h
rename to net/log/test_net_log_observer.h
index d9faa06..35697961 100644
--- a/net/log/capturing_net_log_observer.h
+++ b/net/log/test_net_log_observer.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef NET_LOG_CAPTURING_NET_LOG_OBSERVER_H_
-#define NET_LOG_CAPTURING_NET_LOG_OBSERVER_H_
+#ifndef NET_LOG_TEST_NET_LOG_OBSERVER_H_
+#define NET_LOG_TEST_NET_LOG_OBSERVER_H_
#include <string>
#include <vector>
@@ -11,8 +11,8 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/synchronization/lock.h"
-#include "net/log/captured_net_log_entry.h"
#include "net/log/net_log.h"
+#include "net/log/test_net_log_entry.h"
namespace base {
class DictionaryValue;
@@ -21,20 +21,20 @@
namespace net {
-// CapturingNetLogObserver is an implementation of NetLog::ThreadSafeObserver
+// TestNetLogObserver is an implementation of NetLog::ThreadSafeObserver
// that saves messages to a bounded buffer. It is intended for testing only,
// and is part of the net_test_support project.
-class CapturingNetLogObserver : public NetLog::ThreadSafeObserver {
+class TestNetLogObserver : public NetLog::ThreadSafeObserver {
public:
- CapturingNetLogObserver();
- ~CapturingNetLogObserver() override;
+ TestNetLogObserver();
+ ~TestNetLogObserver() override;
// Returns the list of all entries in the log.
- void GetEntries(CapturedNetLogEntry::List* entry_list) const;
+ void GetEntries(TestNetLogEntry::List* entry_list) const;
// Fills |entry_list| with all entries in the log from the specified Source.
void GetEntriesForSource(NetLog::Source source,
- CapturedNetLogEntry::List* entry_list) const;
+ TestNetLogEntry::List* entry_list) const;
// Returns number of entries in the log.
size_t GetSize() const;
@@ -48,11 +48,11 @@
// Needs to be "mutable" so can use it in GetEntries().
mutable base::Lock lock_;
- CapturedNetLogEntry::List captured_entries_;
+ TestNetLogEntry::List entry_list_;
- DISALLOW_COPY_AND_ASSIGN(CapturingNetLogObserver);
+ DISALLOW_COPY_AND_ASSIGN(TestNetLogObserver);
};
} // namespace net
-#endif // NET_LOG_CAPTURING_NET_LOG_OBSERVER_H_
+#endif // NET_LOG_TEST_NET_LOG_OBSERVER_H_
diff --git a/net/log/net_log_unittest.h b/net/log/test_net_log_util.h
similarity index 80%
rename from net/log/net_log_unittest.h
rename to net/log/test_net_log_util.h
index 119d8cf..b15c883 100644
--- a/net/log/net_log_unittest.h
+++ b/net/log/test_net_log_util.h
@@ -2,26 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef NET_LOG_NET_LOG_UNITTEST_H_
-#define NET_LOG_NET_LOG_UNITTEST_H_
+#ifndef NET_LOG_TEST_NET_LOG_UTIL_H_
+#define NET_LOG_TEST_NET_LOG_UTIL_H_
#include <cstddef>
-#include "net/log/captured_net_log_entry.h"
#include "net/log/test_net_log.h"
+#include "net/log/test_net_log_entry.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace net {
-// Create a timestamp with internal value of |t| milliseconds from the epoch.
-inline base::TimeTicks MakeTime(int t) {
- base::TimeTicks ticks; // initialized to 0.
- ticks += base::TimeDelta::FromMilliseconds(t);
- return ticks;
-}
-
inline ::testing::AssertionResult LogContainsEventHelper(
- const CapturedNetLogEntry::List& entries,
+ const TestNetLogEntry::List& entries,
int i, // Negative indices are reverse indices.
const base::TimeTicks& expected_time,
bool check_time,
@@ -32,7 +25,7 @@
: static_cast<size_t>(i);
if (j >= entries.size())
return ::testing::AssertionFailure() << j << " is out of bounds.";
- const CapturedNetLogEntry& entry = entries[j];
+ const TestNetLogEntry& entry = entries[j];
if (expected_event != entry.type) {
return ::testing::AssertionFailure()
<< "Actual event: " << NetLog::EventTypeToString(entry.type)
@@ -55,7 +48,7 @@
}
inline ::testing::AssertionResult LogContainsEventAtTime(
- const CapturedNetLogEntry::List& log,
+ const TestNetLogEntry::List& log,
int i, // Negative indices are reverse indices.
const base::TimeTicks& expected_time,
NetLog::EventType expected_event,
@@ -66,7 +59,7 @@
// Version without timestamp.
inline ::testing::AssertionResult LogContainsEvent(
- const CapturedNetLogEntry::List& log,
+ const TestNetLogEntry::List& log,
int i, // Negative indices are reverse indices.
NetLog::EventType expected_event,
NetLog::EventPhase expected_phase) {
@@ -76,7 +69,7 @@
// Version for PHASE_BEGIN (and no timestamp).
inline ::testing::AssertionResult LogContainsBeginEvent(
- const CapturedNetLogEntry::List& log,
+ const TestNetLogEntry::List& log,
int i, // Negative indices are reverse indices.
NetLog::EventType expected_event) {
return LogContainsEvent(log, i, expected_event, NetLog::PHASE_BEGIN);
@@ -84,14 +77,14 @@
// Version for PHASE_END (and no timestamp).
inline ::testing::AssertionResult LogContainsEndEvent(
- const CapturedNetLogEntry::List& log,
+ const TestNetLogEntry::List& log,
int i, // Negative indices are reverse indices.
NetLog::EventType expected_event) {
return LogContainsEvent(log, i, expected_event, NetLog::PHASE_END);
}
inline ::testing::AssertionResult LogContainsEntryWithType(
- const CapturedNetLogEntry::List& entries,
+ const TestNetLogEntry::List& entries,
int i, // Negative indices are reverse indices.
NetLog::EventType type) {
// Negative indices are reverse indices.
@@ -99,7 +92,7 @@
: static_cast<size_t>(i);
if (j >= entries.size())
return ::testing::AssertionFailure() << j << " is out of bounds.";
- const CapturedNetLogEntry& entry = entries[j];
+ const TestNetLogEntry& entry = entries[j];
if (entry.type != type)
return ::testing::AssertionFailure() << "Type does not match.";
return ::testing::AssertionSuccess();
@@ -108,7 +101,7 @@
// Check if the log contains any entry of the given type at |min_index| or
// after.
inline ::testing::AssertionResult LogContainsEntryWithTypeAfter(
- const CapturedNetLogEntry::List& entries,
+ const TestNetLogEntry::List& entries,
int min_index, // Negative indices are reverse indices.
NetLog::EventType type) {
// Negative indices are reverse indices.
@@ -117,7 +110,7 @@
? static_cast<size_t>(static_cast<int>(entries.size()) + min_index)
: static_cast<size_t>(min_index);
for (size_t i = real_index; i < entries.size(); ++i) {
- const CapturedNetLogEntry& entry = entries[i];
+ const TestNetLogEntry& entry = entries[i];
if (entry.type == type)
return ::testing::AssertionSuccess();
}
@@ -127,14 +120,13 @@
// Expect that the log contains an event, but don't care about where
// as long as the first index where it is found is at least |min_index|.
// Returns the position where the event was found.
-inline size_t ExpectLogContainsSomewhere(
- const CapturedNetLogEntry::List& entries,
- size_t min_index,
- NetLog::EventType expected_event,
- NetLog::EventPhase expected_phase) {
+inline size_t ExpectLogContainsSomewhere(const TestNetLogEntry::List& entries,
+ size_t min_index,
+ NetLog::EventType expected_event,
+ NetLog::EventPhase expected_phase) {
size_t i = 0;
for (; i < entries.size(); ++i) {
- const CapturedNetLogEntry& entry = entries[i];
+ const TestNetLogEntry& entry = entries[i];
if (entry.type == expected_event && entry.phase == expected_phase)
break;
}
@@ -147,13 +139,13 @@
// as long as one index where it is found is at least |min_index|.
// Returns the first such position where the event was found.
inline size_t ExpectLogContainsSomewhereAfter(
- const CapturedNetLogEntry::List& entries,
+ const TestNetLogEntry::List& entries,
size_t min_index,
NetLog::EventType expected_event,
NetLog::EventPhase expected_phase) {
size_t i = min_index;
for (; i < entries.size(); ++i) {
- const CapturedNetLogEntry& entry = entries[i];
+ const TestNetLogEntry& entry = entries[i];
if (entry.type == expected_event && entry.phase == expected_phase)
break;
}
@@ -163,4 +155,4 @@
} // namespace net
-#endif // NET_LOG_NET_LOG_UNITTEST_H_
+#endif // NET_LOG_TEST_NET_LOG_UTIL_H_
diff --git a/net/log/trace_net_log_observer_unittest.cc b/net/log/trace_net_log_observer_unittest.cc
index 10d249f..15f4926ca 100644
--- a/net/log/trace_net_log_observer_unittest.cc
+++ b/net/log/trace_net_log_observer_unittest.cc
@@ -17,9 +17,9 @@
#include "base/trace_event/trace_event.h"
#include "base/trace_event/trace_event_impl.h"
#include "base/values.h"
-#include "net/log/captured_net_log_entry.h"
#include "net/log/net_log.h"
#include "net/log/test_net_log.h"
+#include "net/log/test_net_log_entry.h"
#include "testing/gtest/include/gtest/gtest.h"
using base::trace_event::TraceLog;
@@ -157,7 +157,7 @@
}
TEST_F(TraceNetLogObserverTest, TraceEventCaptured) {
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
net_log()->GetEntries(&entries);
EXPECT_TRUE(entries.empty());
@@ -224,7 +224,7 @@
EndTraceAndFlush();
trace_net_log_observer()->StopWatchForTraceStart();
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
net_log()->GetEntries(&entries);
EXPECT_EQ(3u, entries.size());
EXPECT_EQ(2u, trace_events()->GetSize());
@@ -264,7 +264,7 @@
EndTraceAndFlush();
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
net_log()->GetEntries(&entries);
EXPECT_EQ(2u, entries.size());
EXPECT_EQ(1u, trace_events()->GetSize());
@@ -293,7 +293,7 @@
EndTraceAndFlush();
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
net_log()->GetEntries(&entries);
EXPECT_EQ(3u, entries.size());
EXPECT_EQ(0u, trace_events()->GetSize());
@@ -311,7 +311,7 @@
EndTraceAndFlush();
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
net_log()->GetEntries(&entries);
EXPECT_EQ(3u, entries.size());
EXPECT_EQ(0u, trace_events()->GetSize());
@@ -330,7 +330,7 @@
EndTraceAndFlush();
trace_net_log_observer()->StopWatchForTraceStart();
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
net_log()->GetEntries(&entries);
EXPECT_EQ(2u, entries.size());
EXPECT_EQ(2u, trace_events()->GetSize());
diff --git a/net/net.gyp b/net/net.gyp
index f4498918..1595dd0 100644
--- a/net/net.gyp
+++ b/net/net.gyp
@@ -538,12 +538,13 @@
'dns/mock_mdns_socket_factory.h',
'http/http_transaction_test_util.cc',
'http/http_transaction_test_util.h',
- 'log/captured_net_log_entry.cc',
- 'log/captured_net_log_entry.h',
'log/test_net_log.cc',
'log/test_net_log.h',
- 'log/capturing_net_log_observer.cc',
- 'log/capturing_net_log_observer.h',
+ 'log/test_net_log_entry.cc',
+ 'log/test_net_log_entry.h',
+ 'log/test_net_log_observer.cc',
+ 'log/test_net_log_observer.h',
+ 'log/test_net_log_util.h',
'proxy/mock_proxy_resolver.cc',
'proxy/mock_proxy_resolver.h',
'proxy/mock_proxy_script_fetcher.cc',
diff --git a/net/net.gypi b/net/net.gypi
index 874d9616..f5610d7c 100644
--- a/net/net.gypi
+++ b/net/net.gypi
@@ -1452,10 +1452,9 @@
'http/url_security_manager_unittest.cc',
'log/net_log_capture_mode_unittest.cc',
'log/net_log_unittest.cc',
- 'log/write_to_file_net_log_observer_unittest.cc',
- 'log/net_log_unittest.h',
'log/net_log_util_unittest.cc',
'log/trace_net_log_observer_unittest.cc',
+ 'log/write_to_file_net_log_observer_unittest.cc',
'proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc',
'proxy/dhcp_proxy_script_fetcher_factory_unittest.cc',
'proxy/dhcp_proxy_script_fetcher_win_unittest.cc',
diff --git a/net/proxy/multi_threaded_proxy_resolver_unittest.cc b/net/proxy/multi_threaded_proxy_resolver_unittest.cc
index 9142029..2682b46 100644
--- a/net/proxy/multi_threaded_proxy_resolver_unittest.cc
+++ b/net/proxy/multi_threaded_proxy_resolver_unittest.cc
@@ -17,10 +17,10 @@
#include "base/threading/platform_thread.h"
#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
-#include "net/log/captured_net_log_entry.h"
#include "net/log/net_log.h"
-#include "net/log/net_log_unittest.h"
#include "net/log/test_net_log.h"
+#include "net/log/test_net_log_entry.h"
+#include "net/log/test_net_log_util.h"
#include "net/proxy/mock_proxy_resolver.h"
#include "net/proxy/proxy_info.h"
#include "net/proxy/proxy_resolver_factory.h"
@@ -261,7 +261,7 @@
// on completion, this should have been copied into |log0|.
// We also have 1 log entry that was emitted by the
// MultiThreadedProxyResolver.
- CapturedNetLogEntry::List entries0;
+ TestNetLogEntry::List entries0;
log0.GetEntries(&entries0);
ASSERT_EQ(2u, entries0.size());
@@ -351,7 +351,7 @@
EXPECT_EQ(0, callback0.WaitForResult());
EXPECT_EQ("PROXY request0:80", results0.ToPacString());
- CapturedNetLogEntry::List entries0;
+ TestNetLogEntry::List entries0;
log0.GetEntries(&entries0);
ASSERT_EQ(2u, entries0.size());
@@ -362,7 +362,7 @@
EXPECT_EQ(1, callback1.WaitForResult());
EXPECT_EQ("PROXY request1:80", results1.ToPacString());
- CapturedNetLogEntry::List entries1;
+ TestNetLogEntry::List entries1;
log1.GetEntries(&entries1);
ASSERT_EQ(4u, entries1.size());
@@ -377,7 +377,7 @@
EXPECT_EQ(2, callback2.WaitForResult());
EXPECT_EQ("PROXY request2:80", results2.ToPacString());
- CapturedNetLogEntry::List entries2;
+ TestNetLogEntry::List entries2;
log2.GetEntries(&entries2);
ASSERT_EQ(4u, entries2.size());
diff --git a/net/proxy/proxy_resolver_v8_tracing_unittest.cc b/net/proxy/proxy_resolver_v8_tracing_unittest.cc
index 7294937..f52b1d4 100644
--- a/net/proxy/proxy_resolver_v8_tracing_unittest.cc
+++ b/net/proxy/proxy_resolver_v8_tracing_unittest.cc
@@ -18,10 +18,10 @@
#include "net/base/test_completion_callback.h"
#include "net/dns/host_cache.h"
#include "net/dns/mock_host_resolver.h"
-#include "net/log/captured_net_log_entry.h"
#include "net/log/net_log.h"
-#include "net/log/net_log_unittest.h"
#include "net/log/test_net_log.h"
+#include "net/log/test_net_log_entry.h"
+#include "net/log/test_net_log_util.h"
#include "net/proxy/proxy_info.h"
#include "net/proxy/proxy_resolver_error_observer.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -154,12 +154,12 @@
// Check the NetLogs -- there was 1 alert and 1 javascript error, and they
// were output to both the global log, and per-request log.
- CapturedNetLogEntry::List entries_list[2];
+ TestNetLogEntry::List entries_list[2];
log.GetEntries(&entries_list[0]);
request_log.GetEntries(&entries_list[1]);
for (size_t list_i = 0; list_i < arraysize(entries_list); list_i++) {
- const CapturedNetLogEntry::List& entries = entries_list[list_i];
+ const TestNetLogEntry::List& entries = entries_list[list_i];
EXPECT_EQ(2u, entries.size());
EXPECT_TRUE(
LogContainsEvent(entries, 0, NetLog::TYPE_PAC_JAVASCRIPT_ALERT,
@@ -208,12 +208,12 @@
// Check the NetLogs -- the script generated 50 alerts, which were mirrored
// to both the global and per-request logs.
- CapturedNetLogEntry::List entries_list[2];
+ TestNetLogEntry::List entries_list[2];
log.GetEntries(&entries_list[0]);
request_log.GetEntries(&entries_list[1]);
for (size_t list_i = 0; list_i < arraysize(entries_list); list_i++) {
- const CapturedNetLogEntry::List& entries = entries_list[list_i];
+ const TestNetLogEntry::List& entries = entries_list[list_i];
EXPECT_EQ(50u, entries.size());
for (size_t i = 0; i < entries.size(); ++i) {
ASSERT_TRUE(
@@ -256,12 +256,12 @@
// Check the NetLogs -- the script generated 50 alerts, which were mirrored
// to both the global and per-request logs.
- CapturedNetLogEntry::List entries_list[2];
+ TestNetLogEntry::List entries_list[2];
log.GetEntries(&entries_list[0]);
request_log.GetEntries(&entries_list[1]);
for (size_t list_i = 0; list_i < arraysize(entries_list); list_i++) {
- const CapturedNetLogEntry::List& entries = entries_list[list_i];
+ const TestNetLogEntry::List& entries = entries_list[list_i];
EXPECT_EQ(1000u, entries.size());
for (size_t i = 0; i < entries.size(); ++i) {
ASSERT_TRUE(
@@ -334,12 +334,12 @@
// Check the NetLogs -- the script generated 1 alert, mirrored to both
// the per-request and global logs.
- CapturedNetLogEntry::List entries_list[2];
+ TestNetLogEntry::List entries_list[2];
log.GetEntries(&entries_list[0]);
request_log.GetEntries(&entries_list[1]);
for (size_t list_i = 0; list_i < arraysize(entries_list); list_i++) {
- const CapturedNetLogEntry::List& entries = entries_list[list_i];
+ const TestNetLogEntry::List& entries = entries_list[list_i];
EXPECT_EQ(1u, entries.size());
EXPECT_TRUE(
LogContainsEvent(entries, 0, NetLog::TYPE_PAC_JAVASCRIPT_ALERT,
@@ -443,12 +443,12 @@
// Check the NetLogs -- the script generated 1 alert, mirrored to both
// the per-request and global logs.
- CapturedNetLogEntry::List entries_list[2];
+ TestNetLogEntry::List entries_list[2];
log.GetEntries(&entries_list[0]);
request_log.GetEntries(&entries_list[1]);
for (size_t list_i = 0; list_i < arraysize(entries_list); list_i++) {
- const CapturedNetLogEntry::List& entries = entries_list[list_i];
+ const TestNetLogEntry::List& entries = entries_list[list_i];
EXPECT_EQ(1u, entries.size());
EXPECT_TRUE(
LogContainsEvent(entries, 0, NetLog::TYPE_PAC_JAVASCRIPT_ALERT,
@@ -616,7 +616,7 @@
// Check the NetLogs -- the script generated 2 alerts during initialization.
EXPECT_EQ(0u, request_log.GetSize());
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
ASSERT_EQ(2u, entries.size());
diff --git a/net/proxy/proxy_resolver_v8_unittest.cc b/net/proxy/proxy_resolver_v8_unittest.cc
index 14272255..d1932df 100644
--- a/net/proxy/proxy_resolver_v8_unittest.cc
+++ b/net/proxy/proxy_resolver_v8_unittest.cc
@@ -9,9 +9,9 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "net/base/net_errors.h"
-#include "net/log/captured_net_log_entry.h"
-#include "net/log/net_log_unittest.h"
#include "net/log/test_net_log.h"
+#include "net/log/test_net_log_entry.h"
+#include "net/log/test_net_log_util.h"
#include "net/proxy/proxy_info.h"
#include "net/proxy/proxy_resolver_v8.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -157,7 +157,7 @@
EXPECT_EQ(0U, resolver.mock_js_bindings()->alerts.size());
EXPECT_EQ(0U, resolver.mock_js_bindings()->errors.size());
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
// No bindings were called, so no log entries.
EXPECT_EQ(0u, entries.size());
diff --git a/net/proxy/proxy_script_decider_unittest.cc b/net/proxy/proxy_script_decider_unittest.cc
index d92dfc2..45f5199 100644
--- a/net/proxy/proxy_script_decider_unittest.cc
+++ b/net/proxy/proxy_script_decider_unittest.cc
@@ -14,10 +14,10 @@
#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
#include "net/dns/mock_host_resolver.h"
-#include "net/log/captured_net_log_entry.h"
#include "net/log/net_log.h"
-#include "net/log/net_log_unittest.h"
#include "net/log/test_net_log.h"
+#include "net/log/test_net_log_entry.h"
+#include "net/log/test_net_log_util.h"
#include "net/proxy/dhcp_proxy_script_fetcher.h"
#include "net/proxy/mock_proxy_script_fetcher.h"
#include "net/proxy/proxy_config.h"
@@ -197,7 +197,7 @@
EXPECT_EQ(rule.text(), decider.script_data()->utf16());
// Check the NetLog was filled correctly.
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_EQ(4u, entries.size());
@@ -234,7 +234,7 @@
EXPECT_EQ(NULL, decider.script_data());
// Check the NetLog was filled correctly.
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_EQ(4u, entries.size());
@@ -494,7 +494,7 @@
// Check the NetLog was filled correctly.
// (Note that various states are repeated since both WPAD and custom
// PAC scripts are tried).
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_EQ(10u, entries.size());
@@ -594,7 +594,7 @@
EXPECT_EQ(NULL, decider.script_data());
// Check the NetLog was filled correctly.
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_EQ(6u, entries.size());
@@ -634,7 +634,7 @@
EXPECT_EQ(NULL, decider.script_data());
// Check the NetLog was filled correctly.
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_EQ(4u, entries.size());
diff --git a/net/proxy/proxy_service_unittest.cc b/net/proxy/proxy_service_unittest.cc
index b7aacc2..609067145 100644
--- a/net/proxy/proxy_service_unittest.cc
+++ b/net/proxy/proxy_service_unittest.cc
@@ -14,10 +14,10 @@
#include "net/base/net_errors.h"
#include "net/base/network_delegate_impl.h"
#include "net/base/test_completion_callback.h"
-#include "net/log/captured_net_log_entry.h"
#include "net/log/net_log.h"
-#include "net/log/net_log_unittest.h"
#include "net/log/test_net_log.h"
+#include "net/log/test_net_log_entry.h"
+#include "net/log/test_net_log_util.h"
#include "net/proxy/dhcp_proxy_script_fetcher.h"
#include "net/proxy/mock_proxy_resolver.h"
#include "net/proxy/mock_proxy_script_fetcher.h"
@@ -262,7 +262,7 @@
EXPECT_TRUE(info.proxy_resolve_end_time().is_null());
// Check the NetLog was filled correctly.
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_EQ(3u, entries.size());
@@ -415,7 +415,7 @@
EXPECT_LE(info.proxy_resolve_start_time(), info.proxy_resolve_end_time());
// Check the NetLog was filled correctly.
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_EQ(5u, entries.size());
@@ -2058,7 +2058,7 @@
EXPECT_FALSE(callback1.have_result()); // Cancelled.
EXPECT_FALSE(callback2.have_result()); // Cancelled.
- CapturedNetLogEntry::List entries1;
+ TestNetLogEntry::List entries1;
log1.GetEntries(&entries1);
// Check the NetLog for request 1 (which was cancelled) got filled properly.
@@ -2599,7 +2599,7 @@
// Check that the expected events were output to the log stream. In particular
// PROXY_CONFIG_CHANGED should have only been emitted once (for the initial
// setup), and NOT a second time when the IP address changed.
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_TRUE(LogContainsEntryWithType(entries, 0,
diff --git a/net/quic/quic_network_transaction_unittest.cc b/net/quic/quic_network_transaction_unittest.cc
index b98e177f..7d23928 100644
--- a/net/quic/quic_network_transaction_unittest.cc
+++ b/net/quic/quic_network_transaction_unittest.cc
@@ -19,9 +19,9 @@
#include "net/http/http_stream_factory.h"
#include "net/http/http_transaction_test_util.h"
#include "net/http/transport_security_state.h"
-#include "net/log/captured_net_log_entry.h"
-#include "net/log/net_log_unittest.h"
#include "net/log/test_net_log.h"
+#include "net/log/test_net_log_entry.h"
+#include "net/log/test_net_log_util.h"
#include "net/proxy/proxy_config_service_fixed.h"
#include "net/proxy/proxy_resolver.h"
#include "net/proxy/proxy_service.h"
@@ -413,7 +413,7 @@
SendRequestAndExpectQuicResponse("hello!");
// Check that the NetLog was filled reasonably.
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
net_log_.GetEntries(&entries);
EXPECT_LT(0u, entries.size());
diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc
index f989a462..087db231 100644
--- a/net/socket/client_socket_pool_base_unittest.cc
+++ b/net/socket/client_socket_pool_base_unittest.cc
@@ -24,10 +24,10 @@
#include "net/base/request_priority.h"
#include "net/base/test_completion_callback.h"
#include "net/http/http_response_headers.h"
-#include "net/log/captured_net_log_entry.h"
#include "net/log/net_log.h"
-#include "net/log/net_log_unittest.h"
#include "net/log/test_net_log.h"
+#include "net/log/test_net_log_entry.h"
+#include "net/log/test_net_log_util.h"
#include "net/socket/client_socket_factory.h"
#include "net/socket/client_socket_handle.h"
#include "net/socket/socket_test_util.h"
@@ -774,7 +774,7 @@
base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(1));
EXPECT_EQ(ERR_TIMED_OUT, delegate.WaitForResult());
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_EQ(6u, entries.size());
@@ -816,7 +816,7 @@
handle.Reset();
TestLoadTimingInfoNotConnected(handle);
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_EQ(4u, entries.size());
@@ -857,7 +857,7 @@
EXPECT_TRUE(handle.ssl_error_response_info().headers.get() == NULL);
TestLoadTimingInfoNotConnected(handle);
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_EQ(3u, entries.size());
@@ -1692,7 +1692,7 @@
handle.Reset();
TestLoadTimingInfoNotConnected(handle);
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_EQ(4u, entries.size());
@@ -1732,7 +1732,7 @@
EXPECT_FALSE(handle.is_ssl_error());
EXPECT_TRUE(handle.ssl_error_response_info().headers.get() == NULL);
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_EQ(3u, entries.size());
@@ -2246,7 +2246,7 @@
EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a"));
EXPECT_EQ(1, pool_->NumActiveSocketsInGroup("a"));
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_TRUE(LogContainsEntryWithType(
entries, 1, NetLog::TYPE_SOCKET_POOL_REUSED_AN_EXISTING_SOCKET));
@@ -2328,7 +2328,7 @@
EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a"));
EXPECT_EQ(1, pool_->NumActiveSocketsInGroup("a"));
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_FALSE(LogContainsEntryWithType(
entries, 1, NetLog::TYPE_SOCKET_POOL_REUSED_AN_EXISTING_SOCKET));
@@ -2400,7 +2400,7 @@
EXPECT_EQ(OK, rv);
EXPECT_TRUE(handle.is_reused());
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_TRUE(LogContainsEntryWithType(
entries, 1, NetLog::TYPE_SOCKET_POOL_REUSED_AN_EXISTING_SOCKET));
diff --git a/net/socket/socks5_client_socket_unittest.cc b/net/socket/socks5_client_socket_unittest.cc
index 775ba8c..76146c7 100644
--- a/net/socket/socks5_client_socket_unittest.cc
+++ b/net/socket/socks5_client_socket_unittest.cc
@@ -13,10 +13,10 @@
#include "net/base/test_completion_callback.h"
#include "net/base/winsock_init.h"
#include "net/dns/mock_host_resolver.h"
-#include "net/log/captured_net_log_entry.h"
#include "net/log/net_log.h"
-#include "net/log/net_log_unittest.h"
#include "net/log/test_net_log.h"
+#include "net/log/test_net_log_entry.h"
+#include "net/log/test_net_log_util.h"
#include "net/socket/client_socket_factory.h"
#include "net/socket/socket_test_util.h"
#include "net/socket/tcp_client_socket.h"
@@ -148,7 +148,7 @@
EXPECT_EQ(ERR_IO_PENDING, rv);
EXPECT_FALSE(user_sock_->IsConnected());
- CapturedNetLogEntry::List net_log_entries;
+ TestNetLogEntry::List net_log_entries;
net_log_.GetEntries(&net_log_entries);
EXPECT_TRUE(LogContainsBeginEvent(net_log_entries, 0,
NetLog::TYPE_SOCKS5_CONNECT));
@@ -272,7 +272,7 @@
int rv = user_sock_->Connect(callback_.callback());
EXPECT_EQ(ERR_IO_PENDING, rv);
- CapturedNetLogEntry::List net_log_entries;
+ TestNetLogEntry::List net_log_entries;
net_log_.GetEntries(&net_log_entries);
EXPECT_TRUE(LogContainsBeginEvent(net_log_entries, 0,
NetLog::TYPE_SOCKS5_CONNECT));
@@ -303,7 +303,7 @@
int rv = user_sock_->Connect(callback_.callback());
EXPECT_EQ(ERR_IO_PENDING, rv);
- CapturedNetLogEntry::List net_log_entries;
+ TestNetLogEntry::List net_log_entries;
net_log_.GetEntries(&net_log_entries);
EXPECT_TRUE(LogContainsBeginEvent(net_log_entries, 0,
NetLog::TYPE_SOCKS5_CONNECT));
@@ -332,7 +332,7 @@
hostname, 80, &net_log_);
int rv = user_sock_->Connect(callback_.callback());
EXPECT_EQ(ERR_IO_PENDING, rv);
- CapturedNetLogEntry::List net_log_entries;
+ TestNetLogEntry::List net_log_entries;
net_log_.GetEntries(&net_log_entries);
EXPECT_TRUE(LogContainsBeginEvent(net_log_entries, 0,
NetLog::TYPE_SOCKS5_CONNECT));
@@ -363,7 +363,7 @@
hostname, 80, &net_log_);
int rv = user_sock_->Connect(callback_.callback());
EXPECT_EQ(ERR_IO_PENDING, rv);
- CapturedNetLogEntry::List net_log_entries;
+ TestNetLogEntry::List net_log_entries;
net_log_.GetEntries(&net_log_entries);
EXPECT_TRUE(LogContainsBeginEvent(net_log_entries, 0,
NetLog::TYPE_SOCKS5_CONNECT));
diff --git a/net/socket/socks_client_socket_unittest.cc b/net/socket/socks_client_socket_unittest.cc
index 7f8e7d4..27b4c70 100644
--- a/net/socket/socks_client_socket_unittest.cc
+++ b/net/socket/socks_client_socket_unittest.cc
@@ -10,10 +10,10 @@
#include "net/base/winsock_init.h"
#include "net/dns/host_resolver.h"
#include "net/dns/mock_host_resolver.h"
-#include "net/log/captured_net_log_entry.h"
#include "net/log/net_log.h"
-#include "net/log/net_log_unittest.h"
#include "net/log/test_net_log.h"
+#include "net/log/test_net_log_entry.h"
+#include "net/log/test_net_log_util.h"
#include "net/socket/client_socket_factory.h"
#include "net/socket/socket_test_util.h"
#include "net/socket/tcp_client_socket.h"
@@ -161,7 +161,7 @@
int rv = user_sock_->Connect(callback_.callback());
EXPECT_EQ(ERR_IO_PENDING, rv);
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_TRUE(
LogContainsBeginEvent(entries, 0, NetLog::TYPE_SOCKS_CONNECT));
@@ -233,7 +233,7 @@
int rv = user_sock_->Connect(callback_.callback());
EXPECT_EQ(ERR_IO_PENDING, rv);
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_TRUE(LogContainsBeginEvent(
entries, 0, NetLog::TYPE_SOCKS_CONNECT));
@@ -269,7 +269,7 @@
int rv = user_sock_->Connect(callback_.callback());
EXPECT_EQ(ERR_IO_PENDING, rv);
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_TRUE(LogContainsBeginEvent(
entries, 0, NetLog::TYPE_SOCKS_CONNECT));
@@ -307,7 +307,7 @@
int rv = user_sock_->Connect(callback_.callback());
EXPECT_EQ(ERR_IO_PENDING, rv);
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_TRUE(LogContainsBeginEvent(
entries, 0, NetLog::TYPE_SOCKS_CONNECT));
@@ -339,7 +339,7 @@
int rv = user_sock_->Connect(callback_.callback());
EXPECT_EQ(ERR_IO_PENDING, rv);
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_TRUE(LogContainsBeginEvent(
entries, 0, NetLog::TYPE_SOCKS_CONNECT));
@@ -369,7 +369,7 @@
int rv = user_sock_->Connect(callback_.callback());
EXPECT_EQ(ERR_IO_PENDING, rv);
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_TRUE(LogContainsBeginEvent(
entries, 0, NetLog::TYPE_SOCKS_CONNECT));
diff --git a/net/socket/ssl_client_socket_openssl_unittest.cc b/net/socket/ssl_client_socket_openssl_unittest.cc
index 7f3c2b1f..0a08f8c7 100644
--- a/net/socket/ssl_client_socket_openssl_unittest.cc
+++ b/net/socket/ssl_client_socket_openssl_unittest.cc
@@ -30,7 +30,6 @@
#include "net/dns/host_resolver.h"
#include "net/http/transport_security_state.h"
#include "net/log/net_log.h"
-#include "net/log/net_log_unittest.h"
#include "net/socket/client_socket_factory.h"
#include "net/socket/client_socket_handle.h"
#include "net/socket/socket_test_util.h"
@@ -184,7 +183,7 @@
scoped_ptr<SpawnedTestServer> test_server_;
AddressList addr_;
TestCompletionCallback callback_;
- TestNetLog log_;
+ NetLog log_;
scoped_ptr<StreamSocket> transport_;
scoped_ptr<SSLClientSocket> sock_;
};
diff --git a/net/socket/ssl_client_socket_unittest.cc b/net/socket/ssl_client_socket_unittest.cc
index 9b90ae8..b837a149 100644
--- a/net/socket/ssl_client_socket_unittest.cc
+++ b/net/socket/ssl_client_socket_unittest.cc
@@ -19,10 +19,10 @@
#include "net/cert/test_root_certs.h"
#include "net/dns/host_resolver.h"
#include "net/http/transport_security_state.h"
-#include "net/log/captured_net_log_entry.h"
#include "net/log/net_log.h"
-#include "net/log/net_log_unittest.h"
#include "net/log/test_net_log.h"
+#include "net/log/test_net_log_entry.h"
+#include "net/log/test_net_log_util.h"
#include "net/socket/client_socket_factory.h"
#include "net/socket/client_socket_handle.h"
#include "net/socket/socket_test_util.h"
@@ -971,7 +971,7 @@
// they'll give up waiting for application data and send the Finished after a
// timeout. This means that an SSL connect end event may appear as a socket
// write.
-static bool LogContainsSSLConnectEndEvent(const CapturedNetLogEntry::List& log,
+static bool LogContainsSSLConnectEndEvent(const TestNetLogEntry::List& log,
int i) {
return LogContainsEndEvent(log, i, NetLog::TYPE_SSL_CONNECT) ||
LogContainsEvent(
@@ -1015,7 +1015,7 @@
rv = sock->Connect(callback.callback());
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_TRUE(LogContainsBeginEvent(entries, 5, NetLog::TYPE_SSL_CONNECT));
if (rv == ERR_IO_PENDING)
@@ -1057,7 +1057,7 @@
rv = sock->Connect(callback.callback());
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_TRUE(LogContainsBeginEvent(entries, 5, NetLog::TYPE_SSL_CONNECT));
if (rv == ERR_IO_PENDING)
@@ -1101,7 +1101,7 @@
rv = sock->Connect(callback.callback());
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_TRUE(LogContainsBeginEvent(entries, 5, NetLog::TYPE_SSL_CONNECT));
if (rv == ERR_IO_PENDING)
@@ -1145,7 +1145,7 @@
rv = sock->Connect(callback.callback());
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_TRUE(LogContainsBeginEvent(entries, 5, NetLog::TYPE_SSL_CONNECT));
if (rv == ERR_IO_PENDING)
@@ -1210,7 +1210,7 @@
// TODO(davidben): Add a test which requires them and verify the error.
rv = sock->Connect(callback.callback());
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_TRUE(LogContainsBeginEvent(entries, 5, NetLog::TYPE_SSL_CONNECT));
if (rv == ERR_IO_PENDING)
@@ -2137,7 +2137,7 @@
rv = callback.WaitForResult();
EXPECT_EQ(static_cast<int>(arraysize(request_text) - 1), rv);
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
size_t last_index = ExpectLogContainsSomewhereAfter(
entries, 5, NetLog::TYPE_SSL_SOCKET_BYTES_SENT, NetLog::PHASE_NONE);
@@ -2249,7 +2249,7 @@
EXPECT_FALSE(sock->IsConnected());
rv = sock->Connect(callback.callback());
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_TRUE(LogContainsBeginEvent(entries, 5, NetLog::TYPE_SSL_CONNECT));
@@ -2543,7 +2543,7 @@
EXPECT_FALSE(sock->IsConnected());
rv = sock->Connect(callback.callback());
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_TRUE(LogContainsBeginEvent(entries, 5, NetLog::TYPE_SSL_CONNECT));
if (rv == ERR_IO_PENDING)
diff --git a/net/socket/transport_client_socket_unittest.cc b/net/socket/transport_client_socket_unittest.cc
index a4c142140..9ab358c 100644
--- a/net/socket/transport_client_socket_unittest.cc
+++ b/net/socket/transport_client_socket_unittest.cc
@@ -14,10 +14,10 @@
#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
#include "net/dns/mock_host_resolver.h"
-#include "net/log/captured_net_log_entry.h"
#include "net/log/net_log.h"
-#include "net/log/net_log_unittest.h"
#include "net/log/test_net_log.h"
+#include "net/log/test_net_log_entry.h"
+#include "net/log/test_net_log_util.h"
#include "net/socket/client_socket_factory.h"
#include "net/socket/tcp_client_socket.h"
#include "net/socket/tcp_server_socket.h"
@@ -235,7 +235,7 @@
// Wait for |listen_sock_| to accept a connection.
connect_loop_.Run();
- CapturedNetLogEntry::List net_log_entries;
+ TestNetLogEntry::List net_log_entries;
net_log_.GetEntries(&net_log_entries);
EXPECT_TRUE(
LogContainsBeginEvent(net_log_entries, 0, NetLog::TYPE_SOCKET_ALIVE));
diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc
index 28f4a18..5544630 100644
--- a/net/spdy/spdy_network_transaction_unittest.cc
+++ b/net/spdy/spdy_network_transaction_unittest.cc
@@ -25,9 +25,9 @@
#include "net/http/http_network_transaction.h"
#include "net/http/http_server_properties.h"
#include "net/http/http_transaction_test_util.h"
-#include "net/log/captured_net_log_entry.h"
-#include "net/log/net_log_unittest.h"
#include "net/log/test_net_log.h"
+#include "net/log/test_net_log_entry.h"
+#include "net/log/test_net_log_util.h"
#include "net/socket/client_socket_pool_base.h"
#include "net/socket/next_proto.h"
#include "net/spdy/buffered_spdy_framer.h"
@@ -3589,7 +3589,7 @@
// This test is intentionally non-specific about the exact ordering of the
// log; instead we just check to make sure that certain events exist, and that
// they are in the right order.
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_LT(0u, entries.size());
diff --git a/net/spdy/spdy_proxy_client_socket_unittest.cc b/net/spdy/spdy_proxy_client_socket_unittest.cc
index 8b24e43..c42ff3f6 100644
--- a/net/spdy/spdy_proxy_client_socket_unittest.cc
+++ b/net/spdy/spdy_proxy_client_socket_unittest.cc
@@ -13,10 +13,10 @@
#include "net/dns/mock_host_resolver.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_response_info.h"
-#include "net/log/captured_net_log_entry.h"
#include "net/log/net_log.h"
-#include "net/log/net_log_unittest.h"
#include "net/log/test_net_log.h"
+#include "net/log/test_net_log_entry.h"
+#include "net/log/test_net_log_util.h"
#include "net/socket/client_socket_factory.h"
#include "net/socket/next_proto.h"
#include "net/socket/socket_test_util.h"
@@ -1275,7 +1275,7 @@
NetLog::Source sock_source = sock_->NetLog().source();
sock_.reset();
- CapturedNetLogEntry::List entry_list;
+ TestNetLogEntry::List entry_list;
net_log_.GetEntriesForSource(sock_source, &entry_list);
ASSERT_EQ(entry_list.size(), 10u);
diff --git a/net/spdy/spdy_session_unittest.cc b/net/spdy/spdy_session_unittest.cc
index 9282fc6a..a8196e4 100644
--- a/net/spdy/spdy_session_unittest.cc
+++ b/net/spdy/spdy_session_unittest.cc
@@ -15,9 +15,9 @@
#include "net/base/request_priority.h"
#include "net/base/test_data_directory.h"
#include "net/base/test_data_stream.h"
-#include "net/log/captured_net_log_entry.h"
-#include "net/log/net_log_unittest.h"
#include "net/log/test_net_log.h"
+#include "net/log/test_net_log_entry.h"
+#include "net/log/test_net_log_util.h"
#include "net/socket/client_socket_pool_manager.h"
#include "net/socket/next_proto.h"
#include "net/socket/socket_test_util.h"
@@ -1634,7 +1634,7 @@
// Flush the read completion task.
base::MessageLoop::current()->RunUntilIdle();
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_LT(0u, entries.size());
@@ -1643,7 +1643,7 @@
entries, 0, NetLog::TYPE_HTTP2_SESSION_INITIALIZED, NetLog::PHASE_NONE);
EXPECT_LT(0, pos);
- CapturedNetLogEntry entry = entries[pos];
+ TestNetLogEntry entry = entries[pos];
NetLog::Source socket_source;
EXPECT_TRUE(NetLog::Source::FromEventParameters(entry.params.get(),
&socket_source));
@@ -1679,7 +1679,7 @@
EXPECT_TRUE(session == NULL);
// Check that the NetLog was filled reasonably.
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_LT(0u, entries.size());
@@ -1688,7 +1688,7 @@
entries, 0, NetLog::TYPE_HTTP2_SESSION_CLOSE, NetLog::PHASE_NONE);
if (pos < static_cast<int>(entries.size())) {
- CapturedNetLogEntry entry = entries[pos];
+ TestNetLogEntry entry = entries[pos];
int error_code = 0;
ASSERT_TRUE(entry.GetNetErrorCode(&error_code));
EXPECT_EQ(OK, error_code);
@@ -1723,7 +1723,7 @@
EXPECT_TRUE(session == NULL);
// Check that the NetLog was filled reasonably.
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_LT(0u, entries.size());
@@ -1732,7 +1732,7 @@
entries, 0, NetLog::TYPE_HTTP2_SESSION_CLOSE, NetLog::PHASE_NONE);
if (pos < static_cast<int>(entries.size())) {
- CapturedNetLogEntry entry = entries[pos];
+ TestNetLogEntry entry = entries[pos];
int error_code = 0;
ASSERT_TRUE(entry.GetNetErrorCode(&error_code));
EXPECT_EQ(ERR_CONNECTION_CLOSED, error_code);
diff --git a/net/spdy/spdy_stream_unittest.cc b/net/spdy/spdy_stream_unittest.cc
index b237412..f538e0f 100644
--- a/net/spdy/spdy_stream_unittest.cc
+++ b/net/spdy/spdy_stream_unittest.cc
@@ -12,9 +12,9 @@
#include "base/strings/string_piece.h"
#include "net/base/completion_callback.h"
#include "net/base/request_priority.h"
-#include "net/log/captured_net_log_entry.h"
-#include "net/log/net_log_unittest.h"
#include "net/log/test_net_log.h"
+#include "net/log/test_net_log_entry.h"
+#include "net/log/test_net_log_util.h"
#include "net/socket/next_proto.h"
#include "net/socket/socket_test_util.h"
#include "net/spdy/buffered_spdy_framer.h"
@@ -295,7 +295,7 @@
EXPECT_TRUE(data.AllWriteDataConsumed());
// Check that the NetLog was filled reasonably.
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
log.GetEntries(&entries);
EXPECT_LT(0u, entries.size());
diff --git a/net/udp/udp_socket_perftest.cc b/net/udp/udp_socket_perftest.cc
index 8d237b8..00c6c70 100644
--- a/net/udp/udp_socket_perftest.cc
+++ b/net/udp/udp_socket_perftest.cc
@@ -13,7 +13,6 @@
#include "net/base/net_errors.h"
#include "net/base/net_util.h"
#include "net/base/test_completion_callback.h"
-#include "net/log/net_log_unittest.h"
#include "net/test/net_test_suite.h"
#include "net/udp/udp_client_socket.h"
#include "net/udp/udp_server_socket.h"
@@ -90,9 +89,8 @@
// Setup the server to listen.
IPEndPoint bind_address;
CreateUDPAddress("127.0.0.1", kPort, &bind_address);
- TestNetLog server_log;
scoped_ptr<UDPServerSocket> server(
- new UDPServerSocket(&server_log, NetLog::Source()));
+ new UDPServerSocket(nullptr, NetLog::Source()));
#if defined(OS_WIN)
if (use_nonblocking_io)
server->UseNonBlockingIO();
@@ -103,10 +101,9 @@
// Setup the client.
IPEndPoint server_address;
CreateUDPAddress("127.0.0.1", kPort, &server_address);
- TestNetLog client_log;
scoped_ptr<UDPClientSocket> client(
new UDPClientSocket(DatagramSocket::DEFAULT_BIND, RandIntCallback(),
- &client_log, NetLog::Source()));
+ nullptr, NetLog::Source()));
#if defined(OS_WIN)
if (use_nonblocking_io)
client->UseNonBlockingIO();
diff --git a/net/udp/udp_socket_unittest.cc b/net/udp/udp_socket_unittest.cc
index f356cee0..4cbec73 100644
--- a/net/udp/udp_socket_unittest.cc
+++ b/net/udp/udp_socket_unittest.cc
@@ -19,9 +19,9 @@
#include "net/base/net_errors.h"
#include "net/base/net_util.h"
#include "net/base/test_completion_callback.h"
-#include "net/log/captured_net_log_entry.h"
-#include "net/log/net_log_unittest.h"
#include "net/log/test_net_log.h"
+#include "net/log/test_net_log_entry.h"
+#include "net/log/test_net_log_util.h"
#include "net/test/net_test_suite.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
@@ -215,7 +215,7 @@
client.reset();
// Check the server's log.
- CapturedNetLogEntry::List server_entries;
+ TestNetLogEntry::List server_entries;
server_log.GetEntries(&server_entries);
EXPECT_EQ(5u, server_entries.size());
EXPECT_TRUE(
@@ -230,7 +230,7 @@
LogContainsEndEvent(server_entries, 4, NetLog::TYPE_SOCKET_ALIVE));
// Check the client's log.
- CapturedNetLogEntry::List client_entries;
+ TestNetLogEntry::List client_entries;
client_log.GetEntries(&client_entries);
EXPECT_EQ(7u, client_entries.size());
EXPECT_TRUE(
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc
index 77438c2..5e5cdd8f 100644
--- a/net/url_request/url_request_unittest.cc
+++ b/net/url_request/url_request_unittest.cc
@@ -58,10 +58,10 @@
#include "net/http/http_request_headers.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_util.h"
-#include "net/log/captured_net_log_entry.h"
#include "net/log/net_log.h"
-#include "net/log/net_log_unittest.h"
#include "net/log/test_net_log.h"
+#include "net/log/test_net_log_entry.h"
+#include "net/log/test_net_log_util.h"
#include "net/proxy/proxy_service.h"
#include "net/socket/ssl_client_socket.h"
#include "net/ssl/ssl_cipher_suite_names.h"
@@ -4165,7 +4165,7 @@
// DELEGATE_INFO NetLog events that an AsyncDelegateLogger should have
// recorded. Returns the index of entry after the expected number of
// events this logged, or entries.size() if there aren't enough entries.
- static size_t CheckDelegateInfo(const CapturedNetLogEntry::List& entries,
+ static size_t CheckDelegateInfo(const TestNetLogEntry::List& entries,
size_t log_position) {
// There should be 4 DELEGATE_INFO events: Two begins and two ends.
if (log_position + 3 >= entries.size()) {
@@ -4199,9 +4199,8 @@
// Find delegate request begin and end messages for OnBeforeNetworkStart.
// Returns the position of the end message.
- static size_t ExpectBeforeNetworkEvents(
- const CapturedNetLogEntry::List& entries,
- size_t log_position) {
+ static size_t ExpectBeforeNetworkEvents(const TestNetLogEntry::List& entries,
+ size_t log_position) {
log_position =
ExpectLogContainsSomewhereAfter(entries,
log_position,
@@ -4467,7 +4466,7 @@
EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status());
}
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
net_log_.GetEntries(&entries);
size_t log_position = ExpectLogContainsSomewhereAfter(
entries,
@@ -4512,7 +4511,7 @@
EXPECT_EQ(1, network_delegate.destroyed_requests());
size_t log_position = 0;
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
net_log_.GetEntries(&entries);
for (size_t i = 0; i < 3; ++i) {
log_position = ExpectLogContainsSomewhereAfter(
@@ -4569,7 +4568,7 @@
EXPECT_EQ(1, network_delegate.destroyed_requests());
size_t log_position = 0;
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
net_log_.GetEntries(&entries);
// The NetworkDelegate logged information in OnBeforeURLRequest,
// OnBeforeSendHeaders, and OnHeadersReceived.
@@ -4651,7 +4650,7 @@
EXPECT_EQ(1, network_delegate.destroyed_requests());
size_t log_position = 0;
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
net_log_.GetEntries(&entries);
// The NetworkDelegate should have logged information in OnBeforeURLRequest,
// OnBeforeSendHeaders, OnHeadersReceived, OnAuthRequired, and then again in
@@ -4708,7 +4707,7 @@
EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status());
}
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
net_log_.GetEntries(&entries);
size_t log_position = 0;
@@ -4761,7 +4760,7 @@
EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status());
}
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
net_log_.GetEntries(&entries);
// Delegate info should only have been logged in OnReceivedRedirect and
@@ -4823,7 +4822,7 @@
EXPECT_EQ(URLRequestStatus::CANCELED, r->status().status());
}
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
net_log.GetEntries(&entries);
// Delegate info is always logged in both OnReceivedRedirect and
@@ -7303,7 +7302,7 @@
EXPECT_EQ(expected_version,
SSLConnectionStatusToVersion(r->ssl_info().connection_status));
- CapturedNetLogEntry::List entries;
+ TestNetLogEntry::List entries;
net_log.GetEntries(&entries);
ExpectLogContainsSomewhere(entries, 0, NetLog::TYPE_SSL_CIPHER_FALLBACK,
NetLog::PHASE_NONE);