diff options
author | vishal.b <vishal.b@samsung.com> | 2015-04-17 01:45:51 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-17 08:46:07 +0000 |
commit | 62985ca964bae26730280620d01a606eeff1d226 (patch) | |
tree | 52f6c9ad2f7b20990796d14687a5d0b79780baf7 | |
parent | 817cf387dbb2b63fb8c00f0f9b1535a152d88b62 (diff) | |
download | chromium_src-62985ca964bae26730280620d01a606eeff1d226.zip chromium_src-62985ca964bae26730280620d01a606eeff1d226.tar.gz chromium_src-62985ca964bae26730280620d01a606eeff1d226.tar.bz2 |
Rename NetLogLogger and CapturingNetLog
Renaming two classes
CapturingNetLog --> TestNetLog
NetLogLogger --> WriteToFileNetLogObserver
BUG=473252
TBR=jam,mmenke
Review URL: https://codereview.chromium.org/1084533002
Cr-Commit-Position: refs/heads/master@{#325611}
69 files changed, 464 insertions, 463 deletions
@@ -570,6 +570,7 @@ Chanho Park <parkch98@gmail.com> Payal Pandey <payal.pandey@samsung.com> Kenneth Strickland <ken.strickland@gmail.com> Olli Syrjälä <olli.syrjala@intel.com> +Vishal Bhatnagar <vishal.b@samsung.com> BlackBerry Limited <*@blackberry.com> Code Aurora Forum <*@codeaurora.org> diff --git a/chrome/browser/extensions/api/dial/dial_service_unittest.cc b/chrome/browser/extensions/api/dial/dial_service_unittest.cc index 107a43f..5a5ab1a 100644 --- a/chrome/browser/extensions/api/dial/dial_service_unittest.cc +++ b/chrome/browser/extensions/api/dial/dial_service_unittest.cc @@ -8,7 +8,7 @@ #include "chrome/browser/extensions/api/dial/dial_device_data.h" #include "chrome/browser/extensions/api/dial/dial_service.h" #include "net/base/ip_endpoint.h" -#include "net/log/capturing_net_log.h" +#include "net/log/test_net_log.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -43,13 +43,13 @@ class MockObserver : public DialService::Observer { class DialServiceTest : public testing::Test { public: DialServiceTest() - : dial_service_(&capturing_net_log_) { + : dial_service_(&test_net_log_) { CHECK(net::ParseIPLiteralToNumber("0.0.0.0", &mock_ip_)); dial_service_.AddObserver(&mock_observer_); dial_socket_ = dial_service_.CreateDialSocket(); } protected: - net::CapturingNetLog capturing_net_log_; + net::TestNetLog test_net_log_; net::IPAddressNumber mock_ip_; DialServiceImpl dial_service_; scoped_ptr<DialServiceImpl::DialSocket> dial_socket_; diff --git a/chrome/browser/extensions/api/log_private/log_private_api.h b/chrome/browser/extensions/api/log_private/log_private_api.h index efc1889..77e8c03 100644 --- a/chrome/browser/extensions/api/log_private/log_private_api.h +++ b/chrome/browser/extensions/api/log_private/log_private_api.h @@ -20,7 +20,7 @@ #include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/extension_registry_observer.h" #include "net/log/net_log.h" -#include "net/log/net_log_logger.h" +#include "net/log/write_to_file_net_log_observer.h" class IOThread; @@ -113,7 +113,7 @@ class LogPrivateAPI : public BrowserContextKeyedAPI, api::log_private::EventSink event_sink_; std::set<std::string> net_internal_watches_; scoped_ptr<base::ListValue> pending_entries_; - scoped_ptr<net::NetLogLogger> net_log_logger_; + scoped_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_; // Listen to extension unloaded notifications. ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> extension_registry_observer_; diff --git a/chrome/browser/extensions/api/log_private/log_private_api_chromeos.cc b/chrome/browser/extensions/api/log_private/log_private_api_chromeos.cc index 582fe12..e53007b 100644 --- a/chrome/browser/extensions/api/log_private/log_private_api_chromeos.cc +++ b/chrome/browser/extensions/api/log_private/log_private_api_chromeos.cc @@ -287,10 +287,10 @@ void LogPrivateAPI::StartObservingNetEvents( if (!file->get()) return; - net_log_logger_.reset(new net::NetLogLogger()); - net_log_logger_->set_log_level(net::NetLog::LOG_ALL_BUT_BYTES); - net_log_logger_->StartObserving(io_thread->net_log(), file->Pass(), nullptr, - nullptr); + write_to_file_observer_.reset(new net::WriteToFileNetLogObserver()); + write_to_file_observer_->set_log_level(net::NetLog::LOG_ALL_BUT_BYTES); + write_to_file_observer_->StartObserving(io_thread->net_log(), file->Pass(), + nullptr, nullptr); } void LogPrivateAPI::MaybeStartNetInternalLogging( @@ -359,8 +359,8 @@ void LogPrivateAPI::StopNetInternalLogging() { net_log()->DeprecatedRemoveObserver(this); break; case api::log_private::EVENT_SINK_FILE: - net_log_logger_->StopObserving(nullptr); - net_log_logger_.reset(); + write_to_file_observer_->StopObserving(nullptr); + write_to_file_observer_.reset(); break; case api::log_private::EVENT_SINK_NONE: NOTREACHED(); diff --git a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc index ffaf046..f4e2313 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc +++ b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc @@ -45,7 +45,7 @@ #include "net/base/upload_bytes_element_reader.h" #include "net/base/upload_file_element_reader.h" #include "net/dns/mock_host_resolver.h" -#include "net/log/capturing_net_log.h" +#include "net/log/test_net_log.h" #include "net/url_request/url_request_job_factory_impl.h" #include "net/url_request/url_request_test_util.h" #include "testing/gtest/include/gtest/gtest-message.h" @@ -1321,7 +1321,7 @@ TEST(ExtensionWebRequestHelpersTest, TestCalculateOnAuthRequiredDelta) { TEST(ExtensionWebRequestHelpersTest, TestMergeCancelOfResponses) { EventResponseDeltas deltas; - net::CapturingBoundNetLog capturing_net_log; + net::BoundTestNetLog capturing_net_log; net::BoundNetLog net_log = capturing_net_log.bound(); bool canceled = false; @@ -1347,7 +1347,7 @@ TEST(ExtensionWebRequestHelpersTest, TestMergeCancelOfResponses) { TEST(ExtensionWebRequestHelpersTest, TestMergeOnBeforeRequestResponses) { EventResponseDeltas deltas; - net::CapturingBoundNetLog capturing_net_log; + net::BoundTestNetLog capturing_net_log; net::BoundNetLog net_log = capturing_net_log.bound(); WarningSet warning_set; GURL effective_new_url; @@ -1428,7 +1428,7 @@ TEST(ExtensionWebRequestHelpersTest, TestMergeOnBeforeRequestResponses) { // a kind of cancelling requests. TEST(ExtensionWebRequestHelpersTest, TestMergeOnBeforeRequestResponses2) { EventResponseDeltas deltas; - net::CapturingBoundNetLog capturing_net_log; + net::BoundTestNetLog capturing_net_log; net::BoundNetLog net_log = capturing_net_log.bound(); WarningSet warning_set; GURL effective_new_url; @@ -1497,7 +1497,7 @@ TEST(ExtensionWebRequestHelpersTest, TestMergeOnBeforeRequestResponses2) { // a kind of cancelling requests. TEST(ExtensionWebRequestHelpersTest, TestMergeOnBeforeRequestResponses3) { EventResponseDeltas deltas; - net::CapturingBoundNetLog capturing_net_log; + net::BoundTestNetLog capturing_net_log; net::BoundNetLog net_log = capturing_net_log.bound(); WarningSet warning_set; GURL effective_new_url; @@ -1533,7 +1533,7 @@ TEST(ExtensionWebRequestHelpersTest, TestMergeOnBeforeSendHeadersResponses) { net::HttpRequestHeaders base_headers; base_headers.AddHeaderFromString("key1: value 1"); base_headers.AddHeaderFromString("key2: value 2"); - net::CapturingBoundNetLog capturing_net_log; + net::BoundTestNetLog capturing_net_log; net::BoundNetLog net_log = capturing_net_log.bound(); WarningSet warning_set; std::string header_value; @@ -1629,7 +1629,7 @@ TEST(ExtensionWebRequestHelpersTest, net::HttpRequestHeaders base_headers; base_headers.AddHeaderFromString( "Cookie: name=value; name2=value2; name3=\"value3\""); - net::CapturingBoundNetLog capturing_net_log; + net::BoundTestNetLog capturing_net_log; net::BoundNetLog net_log = capturing_net_log.bound(); WarningSet warning_set; std::string header_value; @@ -1713,7 +1713,7 @@ std::string GetCookieExpirationDate(int delta_secs) { TEST(ExtensionWebRequestHelpersTest, TestMergeCookiesInOnHeadersReceivedResponses) { - net::CapturingBoundNetLog capturing_net_log; + net::BoundTestNetLog capturing_net_log; net::BoundNetLog net_log = capturing_net_log.bound(); WarningSet warning_set; std::string header_value; @@ -1948,7 +1948,7 @@ TEST(ExtensionWebRequestHelpersTest, } TEST(ExtensionWebRequestHelpersTest, TestMergeOnHeadersReceivedResponses) { - net::CapturingBoundNetLog capturing_net_log; + net::BoundTestNetLog capturing_net_log; net::BoundNetLog net_log = capturing_net_log.bound(); WarningSet warning_set; std::string header_value; @@ -2048,7 +2048,7 @@ TEST(ExtensionWebRequestHelpersTest, TestMergeOnHeadersReceivedResponses) { // Check that we do not delete too much TEST(ExtensionWebRequestHelpersTest, TestMergeOnHeadersReceivedResponsesDeletion) { - net::CapturingBoundNetLog capturing_net_log; + net::BoundTestNetLog capturing_net_log; net::BoundNetLog net_log = capturing_net_log.bound(); WarningSet warning_set; std::string header_value; @@ -2102,7 +2102,7 @@ TEST(ExtensionWebRequestHelpersTest, TEST(ExtensionWebRequestHelpersTest, TestMergeOnHeadersReceivedResponsesRedirect) { EventResponseDeltas deltas; - net::CapturingBoundNetLog capturing_net_log; + net::BoundTestNetLog capturing_net_log; net::BoundNetLog net_log = capturing_net_log.bound(); WarningSet warning_set; @@ -2155,7 +2155,7 @@ TEST(ExtensionWebRequestHelpersTest, } TEST(ExtensionWebRequestHelpersTest, TestMergeOnAuthRequiredResponses) { - net::CapturingBoundNetLog capturing_net_log; + net::BoundTestNetLog capturing_net_log; net::BoundNetLog net_log = capturing_net_log.bound(); WarningSet warning_set; EventResponseDeltas deltas; diff --git a/chrome/browser/net/chrome_net_log.cc b/chrome/browser/net/chrome_net_log.cc index 9cb6aac..1dda8cce 100644 --- a/chrome/browser/net/chrome_net_log.cc +++ b/chrome/browser/net/chrome_net_log.cc @@ -16,8 +16,8 @@ #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h" #include "chrome/common/chrome_switches.h" #include "content/public/common/content_switches.h" -#include "net/log/net_log_logger.h" #include "net/log/trace_net_log_observer.h" +#include "net/log/write_to_file_net_log_observer.h" ChromeNetLog::ChromeNetLog() : net_log_temp_file_(new NetLogTempFile(this)) { @@ -45,7 +45,7 @@ ChromeNetLog::ChromeNetLog() << " for net logging"; } else { scoped_ptr<base::Value> constants(NetInternalsUI::GetConstants()); - net_log_logger_.reset(new net::NetLogLogger()); + net_log_logger_.reset(new net::WriteToFileNetLogObserver()); if (command_line->HasSwitch(switches::kNetLogLevel)) { std::string log_level_string = command_line->GetSwitchValueASCII(switches::kNetLogLevel); diff --git a/chrome/browser/net/chrome_net_log.h b/chrome/browser/net/chrome_net_log.h index 6018000..ad4c4b0 100644 --- a/chrome/browser/net/chrome_net_log.h +++ b/chrome/browser/net/chrome_net_log.h @@ -12,7 +12,7 @@ #include "net/log/net_log.h" namespace net { -class NetLogLogger; +class WriteToFileNetLogObserver; class TraceNetLogObserver; } @@ -30,7 +30,7 @@ class ChromeNetLog : public net::NetLog { } private: - scoped_ptr<net::NetLogLogger> net_log_logger_; + scoped_ptr<net::WriteToFileNetLogObserver> net_log_logger_; scoped_ptr<NetLogTempFile> net_log_temp_file_; scoped_ptr<net::TraceNetLogObserver> trace_net_log_observer_; diff --git a/chrome/browser/net/net_log_temp_file.cc b/chrome/browser/net/net_log_temp_file.cc index 1da33e6..3674b2b 100644 --- a/chrome/browser/net/net_log_temp_file.cc +++ b/chrome/browser/net/net_log_temp_file.cc @@ -10,7 +10,7 @@ #include "chrome/browser/net/chrome_net_log.h" #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h" #include "content/public/browser/browser_thread.h" -#include "net/log/net_log_logger.h" +#include "net/log/write_to_file_net_log_observer.h" using content::BrowserThread; @@ -144,7 +144,7 @@ void NetLogTempFile::StartNetLog(LogType log_type) { state_ = STATE_LOGGING; scoped_ptr<base::Value> constants(NetInternalsUI::GetConstants()); - net_log_logger_.reset(new net::NetLogLogger()); + net_log_logger_.reset(new net::WriteToFileNetLogObserver()); net_log_logger_->set_log_level(GetLogLevelForLogType(log_type)); net_log_logger_->StartObserving(chrome_net_log_, file.Pass(), constants.get(), nullptr); diff --git a/chrome/browser/net/net_log_temp_file.h b/chrome/browser/net/net_log_temp_file.h index 3f2c2c7..46598e3 100644 --- a/chrome/browser/net/net_log_temp_file.h +++ b/chrome/browser/net/net_log_temp_file.h @@ -18,7 +18,7 @@ class DictionaryValue; } namespace net { -class NetLogLogger; +class WriteToFileNetLogObserver; } class ChromeNetLog; @@ -152,7 +152,7 @@ class NetLogTempFile { // |net_log_logger_| watches the NetLog event stream, and sends all entries to // the file created in StartNetLog(). - scoped_ptr<net::NetLogLogger> net_log_logger_; + scoped_ptr<net::WriteToFileNetLogObserver> net_log_logger_; // The |chrome_net_log_| is owned by the browser process, cached here to avoid // using global (g_browser_process). diff --git a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc index e8a6f64..78ca7bc 100644 --- a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc +++ b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc @@ -68,8 +68,8 @@ #include "net/http/http_server_properties.h" #include "net/http/http_stream_factory.h" #include "net/http/transport_security_state.h" -#include "net/log/net_log_logger.h" #include "net/log/net_log_util.h" +#include "net/log/write_to_file_net_log_observer.h" #include "net/proxy/proxy_service.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_getter.h" diff --git a/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc b/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc index 76f11a9..de6488e 100644 --- a/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc +++ b/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc @@ -37,7 +37,7 @@ #include "net/http/http_network_session.h" #include "net/http/http_transaction_factory.h" #include "net/log/net_log.h" -#include "net/log/net_log_logger.h" +#include "net/log/write_to_file_net_log_observer.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_getter.h" #include "testing/gtest/include/gtest/gtest.h" @@ -282,7 +282,8 @@ void NetInternalsTest::MessageHandler::GetNetLogLoggerLog( ASSERT_TRUE(temp_file_handle); scoped_ptr<base::Value> constants(NetInternalsUI::GetConstants()); - scoped_ptr<net::NetLogLogger> net_log_logger(new net::NetLogLogger()); + scoped_ptr<net::WriteToFileNetLogObserver> net_log_logger( + new net::WriteToFileNetLogObserver()); net_log_logger->StartObserving( g_browser_process->net_log(), temp_file_handle.Pass(), constants.get(), nullptr); diff --git a/components/cronet/android/cronet_url_request_context_adapter.cc b/components/cronet/android/cronet_url_request_context_adapter.cc index ef4e9f5c..5a1f569 100644 --- a/components/cronet/android/cronet_url_request_context_adapter.cc +++ b/components/cronet/android/cronet_url_request_context_adapter.cc @@ -18,7 +18,7 @@ #include "net/base/net_errors.h" #include "net/base/network_delegate_impl.h" #include "net/http/http_auth_handler_factory.h" -#include "net/log/net_log_logger.h" +#include "net/log/write_to_file_net_log_observer.h" #include "net/proxy/proxy_service.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_builder.h" @@ -293,7 +293,7 @@ void CronetURLRequestContextAdapter::StartNetLogToFileOnNetworkThread( if (!file) return; - net_log_logger_.reset(new net::NetLogLogger()); + net_log_logger_.reset(new net::WriteToFileNetLogObserver()); net_log_logger_->StartObserving(context_->net_log(), file.Pass(), nullptr, context_.get()); } diff --git a/components/cronet/android/cronet_url_request_context_adapter.h b/components/cronet/android/cronet_url_request_context_adapter.h index da44d0f..d20c02fc 100644 --- a/components/cronet/android/cronet_url_request_context_adapter.h +++ b/components/cronet/android/cronet_url_request_context_adapter.h @@ -22,7 +22,7 @@ class SingleThreadTaskRunner; } // namespace base namespace net { -class NetLogLogger; +class WriteToFileNetLogObserver; class URLRequestContext; class ProxyConfigService; } // namespace net @@ -87,7 +87,7 @@ class CronetURLRequestContextAdapter { // Network thread is owned by |this|, but is destroyed from java thread. base::Thread* network_thread_; // |net_log_logger_| and |context_| should only be accessed on network thread. - scoped_ptr<net::NetLogLogger> net_log_logger_; + scoped_ptr<net::WriteToFileNetLogObserver> net_log_logger_; scoped_ptr<net::URLRequestContext> context_; scoped_ptr<net::ProxyConfigService> proxy_config_service_; diff --git a/components/cronet/android/url_request_context_adapter.cc b/components/cronet/android/url_request_context_adapter.cc index 6ce58d0..45ed5fb 100644 --- a/components/cronet/android/url_request_context_adapter.cc +++ b/components/cronet/android/url_request_context_adapter.cc @@ -21,7 +21,7 @@ #include "net/http/http_auth_handler_factory.h" #include "net/http/http_network_layer.h" #include "net/http/http_server_properties.h" -#include "net/log/net_log_logger.h" +#include "net/log/write_to_file_net_log_observer.h" #include "net/proxy/proxy_service.h" #include "net/ssl/ssl_config_service_defaults.h" #include "net/url_request/static_http_user_agent_settings.h" @@ -285,7 +285,7 @@ void URLRequestContextAdapter::StartNetLogToFileHelper( if (!file) return; - net_log_logger_.reset(new net::NetLogLogger()); + net_log_logger_.reset(new net::WriteToFileNetLogObserver()); net_log_logger_->StartObserving(context_->net_log(), file.Pass(), nullptr, context_.get()); } diff --git a/components/cronet/android/url_request_context_adapter.h b/components/cronet/android/url_request_context_adapter.h index bc741f1..932ad92 100644 --- a/components/cronet/android/url_request_context_adapter.h +++ b/components/cronet/android/url_request_context_adapter.h @@ -21,7 +21,7 @@ namespace net { -class NetLogLogger; +class WriteToFileNetLogObserver; class ProxyConfigService; @@ -107,7 +107,7 @@ class URLRequestContextAdapter : public net::URLRequestContextGetter { bool load_disable_cache_; base::Thread* network_thread_; scoped_ptr<NetLogObserver> net_log_observer_; - scoped_ptr<net::NetLogLogger> net_log_logger_; + scoped_ptr<net::WriteToFileNetLogObserver> net_log_logger_; scoped_ptr<net::ProxyConfigService> proxy_config_service_; scoped_ptr<URLRequestContextConfig> config_; diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc index 44746c1..c397da4 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc @@ -13,7 +13,7 @@ #include "components/data_reduction_proxy/core/common/data_reduction_proxy_event_store.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switches.h" -#include "net/log/capturing_net_log.h" +#include "net/log/test_net_log.h" #include "net/proxy/proxy_server.h" #include "net/url_request/test_url_fetcher_factory.h" #include "net/url_request/url_request_test_util.h" diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator_unittest.cc index bb8fb3d..ee10e1d 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator_unittest.cc @@ -10,7 +10,7 @@ #include "base/test/test_simple_task_runner.h" #include "base/values.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_event_store.h" -#include "net/log/capturing_net_log.h" +#include "net/log/test_net_log.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -20,7 +20,7 @@ class DataReductionProxyConfiguratorTest : public testing::Test { public: void SetUp() override { task_runner_ = new base::TestSimpleTaskRunner(); - net_log_.reset(new net::CapturingNetLog()); + net_log_.reset(new net::TestNetLog()); data_reduction_proxy_event_store_.reset( new data_reduction_proxy::DataReductionProxyEventStore(task_runner_)); config_.reset(new DataReductionProxyConfigurator( diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor_unittest.cc index 8475211..b4189e2 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor_unittest.cc @@ -24,7 +24,7 @@ #include "net/base/net_errors.h" #include "net/base/request_priority.h" #include "net/http/http_response_headers.h" -#include "net/log/capturing_net_log.h" +#include "net/log/test_net_log.h" #include "net/proxy/proxy_server.h" #include "net/socket/socket_test_util.h" #include "net/test/embedded_test_server/embedded_test_server.h" @@ -235,7 +235,7 @@ class DataReductionProxyInterceptorWithServerTest : public testing::Test { } private: - net::CapturingNetLog net_log_; + net::TestNetLog net_log_; net::TestNetworkDelegate network_delegate_; net::TestURLRequestContext context_; net::test_server::EmbeddedTestServer proxy_; diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc index bf130c2..2556ed2 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc @@ -18,8 +18,8 @@ #include "net/base/host_port_pair.h" #include "net/base/load_flags.h" #include "net/http/http_response_headers.h" -#include "net/log/capturing_net_log.h" #include "net/log/net_log.h" +#include "net/log/test_net_log.h" #include "net/proxy/proxy_config.h" #include "net/proxy/proxy_server.h" #include "net/url_request/url_request.h" diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.h index bfe3947..3df3671 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.h +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.h @@ -12,7 +12,7 @@ #include "base/prefs/testing_pref_service.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h" #include "net/base/net_util.h" -#include "net/log/capturing_net_log.h" +#include "net/log/test_net_log.h" #include "net/url_request/test_url_fetcher_factory.h" #include "net/url_request/url_request_test_util.h" #include "testing/gmock/include/gmock/gmock.h" diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.cc index 921a99a..7aff4be 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.cc @@ -296,7 +296,7 @@ DataReductionProxyTestContext::Builder::Build() { scoped_refptr<net::URLRequestContextGetter> request_context_getter; scoped_ptr<TestingPrefServiceSimple> pref_service( new TestingPrefServiceSimple()); - scoped_ptr<net::CapturingNetLog> net_log(new net::CapturingNetLog()); + scoped_ptr<net::TestNetLog> net_log(new net::TestNetLog()); if (request_context_) { request_context_getter = new net::TrivialURLRequestContextGetter( request_context_, task_runner); @@ -400,7 +400,7 @@ DataReductionProxyTestContext::DataReductionProxyTestContext( scoped_ptr<base::MessageLoop> loop, scoped_refptr<base::SingleThreadTaskRunner> task_runner, scoped_ptr<TestingPrefServiceSimple> simple_pref_service, - scoped_ptr<net::CapturingNetLog> net_log, + scoped_ptr<net::TestNetLog> net_log, scoped_refptr<net::URLRequestContextGetter> request_context_getter, net::MockClientSocketFactory* mock_socket_factory, scoped_ptr<TestDataReductionProxyIOData> io_data, diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h index 7b2add4..d51e316 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h @@ -19,7 +19,7 @@ #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_service.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.h" #include "net/base/backoff_entry.h" -#include "net/log/capturing_net_log.h" +#include "net/log/test_net_log.h" #include "testing/gmock/include/gmock/gmock.h" class TestingPrefServiceSimple; @@ -391,7 +391,7 @@ class DataReductionProxyTestContext { scoped_ptr<base::MessageLoop> loop, scoped_refptr<base::SingleThreadTaskRunner> task_runner, scoped_ptr<TestingPrefServiceSimple> simple_pref_service, - scoped_ptr<net::CapturingNetLog> net_log, + scoped_ptr<net::TestNetLog> net_log, scoped_refptr<net::URLRequestContextGetter> request_context_getter, net::MockClientSocketFactory* mock_socket_factory, scoped_ptr<TestDataReductionProxyIOData> io_data, @@ -410,7 +410,7 @@ class DataReductionProxyTestContext { scoped_refptr<base::SingleThreadTaskRunner> task_runner_; scoped_ptr<TestingPrefServiceSimple> simple_pref_service_; - scoped_ptr<net::CapturingNetLog> net_log_; + scoped_ptr<net::TestNetLog> net_log_; scoped_refptr<net::URLRequestContextGetter> request_context_getter_; // Non-owned pointer. Will be NULL if |this| was built without specifying a // |net::MockClientSocketFactory|. 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 a02d92a..6f266dd 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 @@ -10,8 +10,8 @@ #include "base/strings/string_number_conversions.h" #include "base/test/test_simple_task_runner.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.h" -#include "net/log/capturing_net_log.h" #include "net/log/net_log.h" +#include "net/log/test_net_log.h" #include "testing/gtest/include/gtest/gtest.h" namespace data_reduction_proxy { @@ -20,8 +20,8 @@ class DataReductionProxyEventStoreTest : public testing::Test { public: DataReductionProxyEventStoreTest() : task_runner_(scoped_refptr<base::TestSimpleTaskRunner>( - new base::TestSimpleTaskRunner())), - net_log_(new net::CapturingNetLog()) { + new base::TestSimpleTaskRunner())), + net_log_(new net::TestNetLog()) { bound_net_log_ = net::BoundNetLog::Make( net_log_.get(), net::NetLog::SOURCE_DATA_REDUCTION_PROXY); } @@ -30,8 +30,8 @@ class DataReductionProxyEventStoreTest : public testing::Test { proxy_.reset(new DataReductionProxyEventStore(task_runner_)); } - net::CapturingNetLog::CapturedEntry GetSingleEntry() const { - net::CapturingNetLog::CapturedEntryList entries; + net::TestNetLog::CapturedEntry GetSingleEntry() const { + net::TestNetLog::CapturedEntryList entries; net_log_->GetEntries(&entries); EXPECT_EQ(1u, entries.size()); return entries[0]; @@ -45,9 +45,7 @@ class DataReductionProxyEventStoreTest : public testing::Test { return task_runner_.get(); } - net::CapturingNetLog* net_log() { - return net_log_.get(); - } + net::TestNetLog* net_log() { return net_log_.get(); } const net::BoundNetLog& bound_net_log() { return bound_net_log_; @@ -55,7 +53,7 @@ class DataReductionProxyEventStoreTest : public testing::Test { private: scoped_refptr<base::TestSimpleTaskRunner> task_runner_; - scoped_ptr<net::CapturingNetLog> net_log_; + scoped_ptr<net::TestNetLog> net_log_; scoped_ptr<DataReductionProxyEventStore> proxy_; net::BoundNetLog bound_net_log_; }; @@ -69,7 +67,7 @@ TEST_F(DataReductionProxyEventStoreTest, TestAddProxyEnabledEvent) { TestDataReductionProxyParams::DefaultSSLOrigin()); task_runner()->RunPendingTasks(); EXPECT_EQ(1u, proxy()->stored_events_.size()); - net::CapturingNetLog::CapturedEntry entry = GetSingleEntry(); + net::TestNetLog::CapturedEntry entry = GetSingleEntry(); EXPECT_EQ(net::NetLog::TYPE_DATA_REDUCTION_PROXY_ENABLED, entry.type); } @@ -79,7 +77,7 @@ TEST_F(DataReductionProxyEventStoreTest, TestAddProxyDisabledEvent) { proxy()->AddProxyDisabledEvent(net_log()); task_runner()->RunPendingTasks(); EXPECT_EQ(1u, proxy()->stored_events_.size()); - net::CapturingNetLog::CapturedEntry entry = GetSingleEntry(); + net::TestNetLog::CapturedEntry entry = GetSingleEntry(); EXPECT_EQ(net::NetLog::TYPE_DATA_REDUCTION_PROXY_ENABLED, entry.type); } @@ -91,7 +89,7 @@ TEST_F(DataReductionProxyEventStoreTest, TestAddBypassActionEvent) { base::TimeDelta::FromMinutes(1)); task_runner()->RunPendingTasks(); EXPECT_EQ(1u, proxy()->stored_events_.size()); - net::CapturingNetLog::CapturedEntry entry = GetSingleEntry(); + net::TestNetLog::CapturedEntry entry = GetSingleEntry(); EXPECT_EQ(net::NetLog::TYPE_DATA_REDUCTION_PROXY_BYPASS_REQUESTED, entry.type); EXPECT_NE(nullptr, proxy()->last_bypass_event_.get()); @@ -105,7 +103,7 @@ TEST_F(DataReductionProxyEventStoreTest, TestAddBypassTypeEvent) { task_runner()->RunPendingTasks(); EXPECT_EQ(1u, proxy()->stored_events_.size()); EXPECT_EQ(1u, net_log()->GetSize()); - net::CapturingNetLog::CapturedEntry entry = GetSingleEntry(); + net::TestNetLog::CapturedEntry entry = GetSingleEntry(); EXPECT_EQ(net::NetLog::TYPE_DATA_REDUCTION_PROXY_BYPASS_REQUESTED, entry.type); EXPECT_NE(nullptr, proxy()->last_bypass_event_.get()); @@ -118,7 +116,7 @@ TEST_F(DataReductionProxyEventStoreTest, TestBeginSecureProxyCheck) { task_runner()->RunPendingTasks(); EXPECT_EQ(1u, proxy()->stored_events_.size()); EXPECT_EQ(1u, net_log()->GetSize()); - net::CapturingNetLog::CapturedEntry entry = GetSingleEntry(); + net::TestNetLog::CapturedEntry entry = GetSingleEntry(); EXPECT_EQ(net::NetLog::TYPE_DATA_REDUCTION_PROXY_CANARY_REQUEST, entry.type); EXPECT_EQ(CHECK_PENDING, proxy()->secure_proxy_check_state_); @@ -131,7 +129,7 @@ TEST_F(DataReductionProxyEventStoreTest, TestEndSecureProxyCheck) { task_runner()->RunPendingTasks(); EXPECT_EQ(1u, proxy()->stored_events_.size()); EXPECT_EQ(1u, net_log()->GetSize()); - net::CapturingNetLog::CapturedEntry entry = GetSingleEntry(); + net::TestNetLog::CapturedEntry entry = GetSingleEntry(); EXPECT_EQ(net::NetLog::TYPE_DATA_REDUCTION_PROXY_CANARY_REQUEST, entry.type); EXPECT_EQ(CHECK_SUCCESS, proxy()->secure_proxy_check_state_); diff --git a/content/shell/browser/shell_net_log.cc b/content/shell/browser/shell_net_log.cc index a71f19a..eb5b0cb 100644 --- a/content/shell/browser/shell_net_log.cc +++ b/content/shell/browser/shell_net_log.cc @@ -11,8 +11,8 @@ #include "base/files/scoped_file.h" #include "base/values.h" #include "content/public/common/content_switches.h" -#include "net/log/net_log_logger.h" #include "net/log/net_log_util.h" +#include "net/log/write_to_file_net_log_observer.h" namespace content { @@ -63,7 +63,7 @@ ShellNetLog::ShellNetLog(const std::string& app_name) { << " for net logging"; } else { scoped_ptr<base::Value> constants(GetShellConstants(app_name)); - net_log_logger_.reset(new net::NetLogLogger()); + net_log_logger_.reset(new net::WriteToFileNetLogObserver()); net_log_logger_->StartObserving(this, file.Pass(), constants.get(), nullptr); } diff --git a/content/shell/browser/shell_net_log.h b/content/shell/browser/shell_net_log.h index d7e8cf4..8a74e3d 100644 --- a/content/shell/browser/shell_net_log.h +++ b/content/shell/browser/shell_net_log.h @@ -8,7 +8,7 @@ #include <string> #include "base/memory/scoped_ptr.h" -#include "net/log/net_log_logger.h" +#include "net/log/write_to_file_net_log_observer.h" namespace content { @@ -18,7 +18,7 @@ class ShellNetLog : public net::NetLog { ~ShellNetLog() override; private: - scoped_ptr<net::NetLogLogger> net_log_logger_; + scoped_ptr<net::WriteToFileNetLogObserver> net_log_logger_; DISALLOW_COPY_AND_ASSIGN(ShellNetLog); }; diff --git a/extensions/browser/api/cast_channel/cast_channel_apitest.cc b/extensions/browser/api/cast_channel/cast_channel_apitest.cc index e118cd2..3a9d228 100644 --- a/extensions/browser/api/cast_channel/cast_channel_apitest.cc +++ b/extensions/browser/api/cast_channel/cast_channel_apitest.cc @@ -23,7 +23,7 @@ #include "extensions/test/result_catcher.h" #include "net/base/completion_callback.h" #include "net/base/net_errors.h" -#include "net/log/capturing_net_log.h" +#include "net/log/test_net_log.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock_mutant.h" @@ -232,7 +232,7 @@ class CastChannelAPITest : public ExtensionApiTest { net::IPEndPoint ip_endpoint_; LastErrors last_errors_; CastTransport::Delegate* message_delegate_; - net::CapturingNetLog capturing_net_log_; + net::TestNetLog capturing_net_log_; int channel_id_; }; diff --git a/extensions/browser/api/cast_channel/cast_socket_unittest.cc b/extensions/browser/api/cast_channel/cast_socket_unittest.cc index 112a3b9..6c3dbf3 100644 --- a/extensions/browser/api/cast_channel/cast_socket_unittest.cc +++ b/extensions/browser/api/cast_channel/cast_socket_unittest.cc @@ -23,7 +23,7 @@ #include "net/base/address_list.h" #include "net/base/net_errors.h" #include "net/base/net_util.h" -#include "net/log/capturing_net_log.h" +#include "net/log/test_net_log.h" #include "net/socket/socket_test_util.h" #include "net/socket/ssl_client_socket.h" #include "net/socket/tcp_client_socket.h" @@ -310,7 +310,7 @@ class TestCastSocket : public CastSocketImpl { base::Timer* GetTimer() override { return mock_timer_.get(); } - net::CapturingNetLog capturing_net_log_; + net::TestNetLog capturing_net_log_; net::IPEndPoint ip_; // Simulated connect data scoped_ptr<net::MockConnect> tcp_connect_data_[2]; diff --git a/extensions/browser/api/cast_channel/cast_transport_unittest.cc b/extensions/browser/api/cast_channel/cast_transport_unittest.cc index 6b6b1bc..31ede2d 100644 --- a/extensions/browser/api/cast_channel/cast_transport_unittest.cc +++ b/extensions/browser/api/cast_channel/cast_transport_unittest.cc @@ -16,7 +16,7 @@ #include "extensions/common/api/cast_channel/cast_channel.pb.h" #include "net/base/completion_callback.h" #include "net/base/net_errors.h" -#include "net/log/capturing_net_log.h" +#include "net/log/test_net_log.h" #include "net/socket/socket.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/google_apis/gcm/tools/mcs_probe.cc b/google_apis/gcm/tools/mcs_probe.cc index 90225d4..69aac65 100644 --- a/google_apis/gcm/tools/mcs_probe.cc +++ b/google_apis/gcm/tools/mcs_probe.cc @@ -40,7 +40,7 @@ #include "net/http/http_network_session.h" #include "net/http/http_server_properties_impl.h" #include "net/http/transport_security_state.h" -#include "net/log/net_log_logger.h" +#include "net/log/write_to_file_net_log_observer.h" #include "net/socket/client_socket_factory.h" #include "net/socket/ssl_client_socket.h" #include "net/ssl/channel_id_service.h" @@ -222,7 +222,7 @@ class MCSProbe { // Network state. scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; net::NetLog net_log_; - scoped_ptr<net::NetLogLogger> logger_; + scoped_ptr<net::WriteToFileNetLogObserver> logger_; scoped_ptr<net::HostResolver> host_resolver_; scoped_ptr<net::CertVerifier> cert_verifier_; scoped_ptr<net::ChannelIDService> system_channel_id_service_; @@ -358,7 +358,7 @@ void MCSProbe::InitializeNetworkState() { #endif } if (log_file.get()) { - logger_.reset(new net::NetLogLogger()); + logger_.reset(new net::WriteToFileNetLogObserver()); logger_->set_log_level(net::NetLog::LOG_ALL_BUT_BYTES); logger_->StartObserving(&net_log_, log_file.Pass(), nullptr, nullptr); } diff --git a/net/BUILD.gn b/net/BUILD.gn index cb20fce..4a0e7d9 100644 --- a/net/BUILD.gn +++ b/net/BUILD.gn @@ -645,10 +645,10 @@ source_set("test_support") { "http/http_transaction_test_util.h", "log/captured_net_log_entry.cc", "log/captured_net_log_entry.h", - "log/capturing_net_log.cc", - "log/capturing_net_log.h", "log/capturing_net_log_observer.cc", "log/capturing_net_log_observer.h", + "log/test_net_log.cc", + "log/test_net_log.h", "proxy/mock_proxy_resolver.cc", "proxy/mock_proxy_resolver.h", "proxy/mock_proxy_script_fetcher.cc", diff --git a/net/base/file_stream_unittest.cc b/net/base/file_stream_unittest.cc index cf5ed41..1e6e6db 100644 --- a/net/base/file_stream_unittest.cc +++ b/net/base/file_stream_unittest.cc @@ -20,7 +20,7 @@ #include "net/base/io_buffer.h" #include "net/base/net_errors.h" #include "net/base/test_completion_callback.h" -#include "net/log/capturing_net_log.h" +#include "net/log/test_net_log.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" diff --git a/net/cert/multi_log_ct_verifier_unittest.cc b/net/cert/multi_log_ct_verifier_unittest.cc index 06c07a8..9e1ea4d 100644 --- a/net/cert/multi_log_ct_verifier_unittest.cc +++ b/net/cert/multi_log_ct_verifier_unittest.cc @@ -21,8 +21,8 @@ #include "net/cert/sct_status_flags.h" #include "net/cert/signed_certificate_timestamp.h" #include "net/cert/x509_certificate.h" -#include "net/log/capturing_net_log.h" #include "net/log/net_log.h" +#include "net/log/test_net_log.h" #include "net/test/cert_test_util.h" #include "net/test/ct_test_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -71,20 +71,20 @@ class MultiLogCTVerifierTest : public ::testing::Test { (result.verified_scts[0]->origin == origin); } - bool CheckForEmbeddedSCTInNetLog(CapturingNetLog& net_log) { - CapturingNetLog::CapturedEntryList entries; + bool CheckForEmbeddedSCTInNetLog(TestNetLog& net_log) { + TestNetLog::CapturedEntryList entries; net_log.GetEntries(&entries); if (entries.size() != 2) return false; - const CapturingNetLog::CapturedEntry& received = entries[0]; + const TestNetLog::CapturedEntry& received = entries[0]; std::string embedded_scts; if (!received.GetStringValue("embedded_scts", &embedded_scts)) return false; if (embedded_scts.empty()) return false; - const CapturingNetLog::CapturedEntry& parsed = entries[1]; + const TestNetLog::CapturedEntry& parsed = entries[1]; base::ListValue* verified_scts; if (!parsed.GetListValue("verified_scts", &verified_scts) || verified_scts->GetSize() != 1) { @@ -139,7 +139,7 @@ class MultiLogCTVerifierTest : public ::testing::Test { bool VerifySinglePrecertificateChain(scoped_refptr<X509Certificate> chain) { ct::CTVerifyResult result; - CapturingNetLog net_log; + TestNetLog net_log; BoundNetLog bound_net_log = BoundNetLog::Make(&net_log, NetLog::SOURCE_CONNECT_JOB); @@ -152,7 +152,7 @@ class MultiLogCTVerifierTest : public ::testing::Test { bool CheckPrecertificateVerification(scoped_refptr<X509Certificate> chain) { ct::CTVerifyResult result; - CapturingNetLog net_log; + TestNetLog net_log; BoundNetLog bound_net_log = BoundNetLog::Make(&net_log, NetLog::SOURCE_CONNECT_JOB); return (VerifySinglePrecertificateChain(chain, bound_net_log, &result) && diff --git a/net/http/http_auth_handler_unittest.cc b/net/http/http_auth_handler_unittest.cc index 9f4a0a8..335bec3a 100644 --- a/net/http/http_auth_handler_unittest.cc +++ b/net/http/http_auth_handler_unittest.cc @@ -11,8 +11,8 @@ #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/capturing_net_log.h" #include "net/log/net_log_unittest.h" +#include "net/log/test_net_log.h" #include "testing/gtest/include/gtest/gtest.h" namespace net { @@ -38,7 +38,7 @@ TEST(HttpAuthHandlerTest, NetLog) { HttpAuthChallengeTokenizer tokenizer( challenge.begin(), challenge.end()); HttpAuthHandlerMock mock_handler; - CapturingNetLog capturing_net_log; + TestNetLog capturing_net_log; BoundNetLog bound_net_log(BoundNetLog::Make(&capturing_net_log, net::NetLog::SOURCE_NONE)); @@ -50,7 +50,7 @@ TEST(HttpAuthHandlerTest, NetLog) { if (async) test_callback.WaitForResult(); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; capturing_net_log.GetEntries(&entries); EXPECT_EQ(2u, entries.size()); diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc index d629016..b64ebbf 100644 --- a/net/http/http_cache_unittest.cc +++ b/net/http/http_cache_unittest.cc @@ -534,7 +534,7 @@ class FakeWebSocketHandshakeStreamCreateHelper // 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 net::CapturingNetLog::CapturedEntry& entry) { +bool ShouldIgnoreLogEntry(const net::TestNetLog::CapturedEntry& entry) { switch (entry.type) { case net::NetLog::TYPE_HTTP_CACHE_GET_BACKEND: case net::NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY: @@ -550,15 +550,15 @@ bool ShouldIgnoreLogEntry(const net::CapturingNetLog::CapturedEntry& entry) { // Modifies |entries| to only include log entries created by the cache layer and // asserted on in these tests. -void FilterLogEntries(net::CapturingNetLog::CapturedEntryList* entries) { +void FilterLogEntries(net::TestNetLog::CapturedEntryList* entries) { entries->erase(std::remove_if(entries->begin(), entries->end(), &ShouldIgnoreLogEntry), entries->end()); } -bool LogContainsEventType(const net::CapturingBoundNetLog& log, +bool LogContainsEventType(const net::BoundTestNetLog& log, net::NetLog::EventType expected) { - net::CapturingNetLog::CapturedEntryList entries; + net::TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); for (size_t i = 0; i < entries.size(); i++) { if (entries[i].type == expected) @@ -593,7 +593,7 @@ TEST(HttpCache, GetBackend) { TEST(HttpCache, SimpleGET) { MockHttpCache cache; - net::CapturingBoundNetLog log; + net::BoundTestNetLog log; net::LoadTimingInfo load_timing_info; // Write to the cache. @@ -611,7 +611,7 @@ TEST(HttpCache, SimpleGETNoDiskCache) { cache.disk_cache()->set_fail_requests(); - net::CapturingBoundNetLog log; + net::BoundTestNetLog log; net::LoadTimingInfo load_timing_info; // Read from the network, and don't use the cache. @@ -620,7 +620,7 @@ TEST(HttpCache, SimpleGETNoDiskCache) { // Check that the NetLog was filled as expected. // (We attempted to both Open and Create entries, but both failed). - net::CapturingNetLog::CapturedEntryList entries; + net::TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); FilterLogEntries(&entries); @@ -777,7 +777,7 @@ TEST(HttpCache, SimpleGETWithDiskFailures3) { TEST(HttpCache, SimpleGET_LoadOnlyFromCache_Hit) { MockHttpCache cache; - net::CapturingBoundNetLog log; + net::BoundTestNetLog log; net::LoadTimingInfo load_timing_info; // Write to the cache. @@ -785,7 +785,7 @@ TEST(HttpCache, SimpleGET_LoadOnlyFromCache_Hit) { log.bound(), &load_timing_info); // Check that the NetLog was filled as expected. - net::CapturingNetLog::CapturedEntryList entries; + net::TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); FilterLogEntries(&entries); @@ -940,7 +940,7 @@ TEST(HttpCache, SimpleGET_LoadPreferringCache_VaryMismatch) { // the network again. transaction.load_flags |= net::LOAD_PREFERRING_CACHE; transaction.request_headers = "Foo: none\r\n"; - net::CapturingBoundNetLog log; + net::BoundTestNetLog log; net::LoadTimingInfo load_timing_info; RunTransactionTestAndGetTiming(cache.http_cache(), transaction, log.bound(), &load_timing_info); @@ -1135,7 +1135,7 @@ TEST(HttpCache, SimpleGET_LoadBypassCache) { MockTransaction transaction(kSimpleGET_Transaction); transaction.load_flags |= net::LOAD_BYPASS_CACHE; - net::CapturingBoundNetLog log; + net::BoundTestNetLog log; net::LoadTimingInfo load_timing_info; // Write to the cache. @@ -1143,7 +1143,7 @@ TEST(HttpCache, SimpleGET_LoadBypassCache) { &load_timing_info); // Check that the NetLog was filled as expected. - net::CapturingNetLog::CapturedEntryList entries; + net::TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); FilterLogEntries(&entries); @@ -1219,7 +1219,7 @@ TEST(HttpCache, SimpleGET_LoadValidateCache) { transaction.load_flags |= net::LOAD_VALIDATE_CACHE; net::HttpResponseInfo response_info; - net::CapturingBoundNetLog log; + net::BoundTestNetLog log; net::LoadTimingInfo load_timing_info; RunTransactionTestWithResponseInfoAndGetTiming( cache.http_cache(), transaction, &response_info, log.bound(), @@ -2012,7 +2012,7 @@ TEST(HttpCache, TypicalGET_ConditionalRequest) { // Get the same URL again, but this time we expect it to result // in a conditional request. - net::CapturingBoundNetLog log; + net::BoundTestNetLog log; net::LoadTimingInfo load_timing_info; RunTransactionTestAndGetTiming(cache.http_cache(), kTypicalGET_Transaction, log.bound(), &load_timing_info); @@ -2051,7 +2051,7 @@ TEST(HttpCache, ETagGET_ConditionalRequest_304) { // in a conditional request. transaction.load_flags = net::LOAD_VALIDATE_CACHE; transaction.handler = ETagGet_ConditionalRequest_Handler; - net::CapturingBoundNetLog log; + net::BoundTestNetLog log; net::LoadTimingInfo load_timing_info; RunTransactionTestAndGetTiming(cache.http_cache(), transaction, log.bound(), &load_timing_info); @@ -2126,7 +2126,7 @@ TEST(HttpCache, GET_ValidateCache_VaryMatch) { // Read from the cache. RevalidationServer server; transaction.handler = server.Handler; - net::CapturingBoundNetLog log; + net::BoundTestNetLog log; net::LoadTimingInfo load_timing_info; RunTransactionTestAndGetTiming(cache.http_cache(), transaction, log.bound(), &load_timing_info); @@ -2160,7 +2160,7 @@ TEST(HttpCache, GET_ValidateCache_VaryMismatch) { RevalidationServer server; transaction.handler = server.Handler; transaction.request_headers = "Foo: none\r\n"; - net::CapturingBoundNetLog log; + net::BoundTestNetLog log; net::LoadTimingInfo load_timing_info; RunTransactionTestAndGetTiming(cache.http_cache(), transaction, log.bound(), &load_timing_info); @@ -2193,7 +2193,7 @@ TEST(HttpCache, GET_DontValidateCache_VaryMismatch) { RevalidationServer server; transaction.handler = server.Handler; transaction.request_headers = "Foo: none\r\n"; - net::CapturingBoundNetLog log; + net::BoundTestNetLog log; net::LoadTimingInfo load_timing_info; RunTransactionTestAndGetTiming(cache.http_cache(), transaction, log.bound(), &load_timing_info); @@ -3811,7 +3811,7 @@ TEST(HttpCache, RangeGET_SkipsCache2) { TEST(HttpCache, SimpleGET_DoesntLogHeaders) { MockHttpCache cache; - net::CapturingBoundNetLog log; + net::BoundTestNetLog log; RunTransactionTestWithLog(cache.http_cache(), kSimpleGET_Transaction, log.bound()); @@ -3822,7 +3822,7 @@ TEST(HttpCache, SimpleGET_DoesntLogHeaders) { TEST(HttpCache, RangeGET_LogsHeaders) { MockHttpCache cache; - net::CapturingBoundNetLog log; + net::BoundTestNetLog log; RunTransactionTestWithLog(cache.http_cache(), kRangeGET_Transaction, log.bound()); @@ -3833,7 +3833,7 @@ TEST(HttpCache, RangeGET_LogsHeaders) { TEST(HttpCache, ExternalValidation_LogsHeaders) { MockHttpCache cache; - net::CapturingBoundNetLog log; + net::BoundTestNetLog log; MockTransaction transaction(kSimpleGET_Transaction); transaction.request_headers = "If-None-Match: foo\r\n" EXTRA_HEADER; RunTransactionTestWithLog(cache.http_cache(), transaction, log.bound()); @@ -3845,7 +3845,7 @@ TEST(HttpCache, ExternalValidation_LogsHeaders) { TEST(HttpCache, SpecialHeaders_LogsHeaders) { MockHttpCache cache; - net::CapturingBoundNetLog log; + net::BoundTestNetLog log; MockTransaction transaction(kSimpleGET_Transaction); transaction.request_headers = "cache-control: no-cache\r\n" EXTRA_HEADER; RunTransactionTestWithLog(cache.http_cache(), transaction, log.bound()); @@ -3962,7 +3962,7 @@ TEST(HttpCache, RangeGET_NoValidation_LogsRestart) { RunTransactionTest(cache.http_cache(), transaction); // Now verify that the cached data is not used. - net::CapturingBoundNetLog log; + net::BoundTestNetLog log; RunTransactionTestWithLog(cache.http_cache(), kRangeGET_TransactionOK, log.bound()); @@ -4124,7 +4124,7 @@ TEST(HttpCache, RangeGET_OK) { // Write and read from the cache (20-59). transaction.request_headers = "Range: bytes = 20-59\r\n" EXTRA_HEADER; transaction.data = "rg: 20-29 rg: 30-39 rg: 40-49 rg: 50-59 "; - net::CapturingBoundNetLog log; + net::BoundTestNetLog log; net::LoadTimingInfo load_timing_info; RunTransactionTestWithResponseAndGetTiming( cache.http_cache(), transaction, &headers, log.bound(), @@ -4184,7 +4184,7 @@ TEST(HttpCache, RangeGET_SyncOK) { // Write and read from the cache (20-59). transaction.request_headers = "Range: bytes = 20-59\r\n" EXTRA_HEADER; transaction.data = "rg: 20-29 rg: 30-39 rg: 40-49 rg: 50-59 "; - net::CapturingBoundNetLog log; + net::BoundTestNetLog log; net::LoadTimingInfo load_timing_info; RunTransactionTestWithResponseAndGetTiming( cache.http_cache(), transaction, &headers, log.bound(), @@ -4221,7 +4221,7 @@ TEST(HttpCache, RangeGET_Revalidate1) { EXPECT_EQ(1, cache.disk_cache()->create_count()); // Read from the cache (40-49). - net::CapturingBoundNetLog log; + net::BoundTestNetLog log; net::LoadTimingInfo load_timing_info; RunTransactionTestWithResponseAndGetTiming( cache.http_cache(), transaction, &headers, log.bound(), @@ -4720,7 +4720,7 @@ TEST(HttpCache, GET_Previous206) { MockHttpCache cache; AddMockTransaction(&kRangeGET_TransactionOK); std::string headers; - net::CapturingBoundNetLog log; + net::BoundTestNetLog log; net::LoadTimingInfo load_timing_info; // Write to the cache (40-49). @@ -4759,7 +4759,7 @@ TEST(HttpCache, GET_Previous206_NotModified) { MockTransaction transaction(kRangeGET_TransactionOK); AddMockTransaction(&transaction); std::string headers; - net::CapturingBoundNetLog log; + net::BoundTestNetLog log; net::LoadTimingInfo load_timing_info; // Write to the cache (0-9). @@ -4829,7 +4829,7 @@ TEST(HttpCache, GET_Previous206_NewContent) { transaction2.data = "Not a range"; RangeTransactionServer handler; handler.set_modified(true); - net::CapturingBoundNetLog log; + net::BoundTestNetLog log; net::LoadTimingInfo load_timing_info; RunTransactionTestWithResponseAndGetTiming( cache.http_cache(), transaction2, &headers, log.bound(), @@ -4877,7 +4877,7 @@ TEST(HttpCache, GET_Previous206_NotSparse) { // Now see that we don't use the stored entry. std::string headers; - net::CapturingBoundNetLog log; + net::BoundTestNetLog log; net::LoadTimingInfo load_timing_info; RunTransactionTestWithResponseAndGetTiming( cache.http_cache(), kSimpleGET_Transaction, &headers, log.bound(), @@ -5445,7 +5445,7 @@ TEST(HttpCache, RangeGET_FastFlakyServer) { RangeTransactionServer handler; handler.set_bad_200(true); transaction.data = "Not a range"; - net::CapturingBoundNetLog log; + net::BoundTestNetLog log; RunTransactionTestWithLog(cache.http_cache(), transaction, log.bound()); EXPECT_EQ(3, cache.network_layer()->transaction_count()); diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index 6c59954..eb81161 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc @@ -50,9 +50,9 @@ #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/capturing_net_log.h" #include "net/log/net_log.h" #include "net/log/net_log_unittest.h" +#include "net/log/test_net_log.h" #include "net/proxy/mock_proxy_resolver.h" #include "net/proxy/proxy_config_service_fixed.h" #include "net/proxy/proxy_info.h" @@ -317,7 +317,7 @@ class HttpNetworkTransactionTest request.url = GURL("http://www.google.com/"); request.load_flags = 0; - CapturingBoundNetLog log; + BoundTestNetLog log; session_deps_.net_log = log.bound().net_log(); scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); scoped_ptr<HttpTransaction> trans( @@ -358,7 +358,7 @@ class HttpNetworkTransactionTest rv = ReadTransaction(trans.get(), &out.response_data); EXPECT_EQ(OK, rv); - net::CapturingNetLog::CapturedEntryList entries; + net::TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); size_t pos = ExpectLogContainsSomewhere( entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST_HEADERS, @@ -1273,7 +1273,7 @@ void HttpNetworkTransactionTest::KeepAliveConnectionResendRequestTest( request.url = GURL("http://www.foo.com/"); request.load_flags = 0; - CapturingNetLog net_log; + TestNetLog net_log; session_deps_.net_log = &net_log; scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -1363,7 +1363,7 @@ void HttpNetworkTransactionTest::PreconnectErrorResendRequestTest( request.url = GURL("https://www.foo.com/"); request.load_flags = 0; - CapturingNetLog net_log; + TestNetLog net_log; session_deps_.net_log = &net_log; scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -1777,7 +1777,7 @@ TEST_P(HttpNetworkTransactionTest, KeepAliveAfterUnreadBody) { request.url = GURL("http://www.foo.com/"); request.load_flags = 0; - CapturingNetLog net_log; + TestNetLog net_log; session_deps_.net_log = &net_log; scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -1886,7 +1886,7 @@ TEST_P(HttpNetworkTransactionTest, BasicAuth) { request.url = GURL("http://www.google.com/"); request.load_flags = 0; - CapturingNetLog log; + TestNetLog log; session_deps_.net_log = &log; scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); scoped_ptr<HttpTransaction> trans( @@ -2033,7 +2033,7 @@ TEST_P(HttpNetworkTransactionTest, BasicAuthKeepAlive) { request.url = GURL("http://www.google.com/"); request.load_flags = 0; - CapturingNetLog log; + TestNetLog log; session_deps_.net_log = &log; scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -2383,7 +2383,7 @@ TEST_P(HttpNetworkTransactionTest, BasicAuthProxyNoKeepAliveHttp10) { // Configure against proxy server "myproxy:70". session_deps_.proxy_service.reset( ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); - CapturingBoundNetLog log; + BoundTestNetLog log; session_deps_.net_log = log.bound().net_log(); scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -2439,7 +2439,7 @@ TEST_P(HttpNetworkTransactionTest, BasicAuthProxyNoKeepAliveHttp10) { rv = callback1.WaitForResult(); EXPECT_EQ(OK, rv); - net::CapturingNetLog::CapturedEntryList entries; + net::TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); size_t pos = ExpectLogContainsSomewhere( entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, @@ -2501,7 +2501,7 @@ TEST_P(HttpNetworkTransactionTest, BasicAuthProxyNoKeepAliveHttp11) { // Configure against proxy server "myproxy:70". session_deps_.proxy_service.reset( ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); - CapturingBoundNetLog log; + BoundTestNetLog log; session_deps_.net_log = log.bound().net_log(); scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -2555,7 +2555,7 @@ TEST_P(HttpNetworkTransactionTest, BasicAuthProxyNoKeepAliveHttp11) { rv = callback1.WaitForResult(); EXPECT_EQ(OK, rv); - net::CapturingNetLog::CapturedEntryList entries; + net::TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); size_t pos = ExpectLogContainsSomewhere( entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, @@ -2618,7 +2618,7 @@ TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHttp10) { // Configure against proxy server "myproxy:70". session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); - CapturingBoundNetLog log; + BoundTestNetLog log; session_deps_.net_log = log.bound().net_log(); scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -2671,7 +2671,7 @@ TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHttp10) { rv = callback1.WaitForResult(); EXPECT_EQ(OK, rv); - net::CapturingNetLog::CapturedEntryList entries; + net::TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); size_t pos = ExpectLogContainsSomewhere( entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, @@ -2725,7 +2725,7 @@ TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHttp11) { // Configure against proxy server "myproxy:70". session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); - CapturingBoundNetLog log; + BoundTestNetLog log; session_deps_.net_log = log.bound().net_log(); scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -2774,7 +2774,7 @@ TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHttp11) { rv = callback1.WaitForResult(); EXPECT_EQ(OK, rv); - net::CapturingNetLog::CapturedEntryList entries; + net::TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); size_t pos = ExpectLogContainsSomewhere( entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, @@ -2993,7 +2993,7 @@ TEST_P(HttpNetworkTransactionTest, request.url = GURL("https://www.google.com/"); session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); - CapturingBoundNetLog log; + BoundTestNetLog log; session_deps_.net_log = log.bound().net_log(); scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -3033,7 +3033,7 @@ TEST_P(HttpNetworkTransactionTest, rv = callback1.WaitForResult(); EXPECT_EQ(ERR_UNEXPECTED_PROXY_AUTH, rv); - net::CapturingNetLog::CapturedEntryList entries; + net::TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); size_t pos = ExpectLogContainsSomewhere( entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, @@ -3057,7 +3057,7 @@ TEST_P(HttpNetworkTransactionTest, HttpProxyLoadTimingNoPacTwoRequests) { // Configure against proxy server "myproxy:70". session_deps_.proxy_service.reset( ProxyService::CreateFixed("PROXY myproxy:70")); - CapturingBoundNetLog log; + BoundTestNetLog log; session_deps_.net_log = log.bound().net_log(); scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -3155,7 +3155,7 @@ TEST_P(HttpNetworkTransactionTest, HttpProxyLoadTimingWithPacTwoRequests) { // Configure against proxy server "myproxy:70". session_deps_.proxy_service.reset( ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); - CapturingBoundNetLog log; + BoundTestNetLog log; session_deps_.net_log = log.bound().net_log(); scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -3250,7 +3250,7 @@ TEST_P(HttpNetworkTransactionTest, HttpsProxyGet) { // Configure against https proxy server "proxy:70". session_deps_.proxy_service.reset(ProxyService::CreateFixed( "https://proxy:70")); - CapturingBoundNetLog log; + BoundTestNetLog log; session_deps_.net_log = log.bound().net_log(); scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -3312,7 +3312,7 @@ TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGet) { // Configure against https proxy server "proxy:70". session_deps_.proxy_service.reset(ProxyService::CreateFixed( "https://proxy:70")); - CapturingBoundNetLog log; + BoundTestNetLog log; session_deps_.net_log = log.bound().net_log(); scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -3377,7 +3377,7 @@ TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGetWithSessionRace) { // Configure SPDY proxy server "proxy:70". session_deps_.proxy_service.reset( ProxyService::CreateFixed("https://proxy:70")); - CapturingBoundNetLog log; + BoundTestNetLog log; session_deps_.net_log = log.bound().net_log(); scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -3451,7 +3451,7 @@ TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGetWithProxyAuth) { // Configure against https proxy server "myproxy:70". session_deps_.proxy_service.reset( ProxyService::CreateFixed("https://myproxy:70")); - CapturingBoundNetLog log; + BoundTestNetLog log; session_deps_.net_log = log.bound().net_log(); scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -3554,7 +3554,7 @@ TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectHttps) { // Configure against https proxy server "proxy:70". session_deps_.proxy_service.reset(ProxyService::CreateFixed( "https://proxy:70")); - CapturingBoundNetLog log; + BoundTestNetLog log; session_deps_.net_log = log.bound().net_log(); scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -3641,7 +3641,7 @@ TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectSpdy) { // Configure against https proxy server "proxy:70". session_deps_.proxy_service.reset(ProxyService::CreateFixed( "https://proxy:70")); - CapturingBoundNetLog log; + BoundTestNetLog log; session_deps_.net_log = log.bound().net_log(); scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -3730,7 +3730,7 @@ TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectFailure) { // Configure against https proxy server "proxy:70". session_deps_.proxy_service.reset(ProxyService::CreateFixed( "https://proxy:70")); - CapturingBoundNetLog log; + BoundTestNetLog log; session_deps_.net_log = log.bound().net_log(); scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -3785,7 +3785,7 @@ TEST_P(HttpNetworkTransactionTest, // Configure against https proxy server "proxy:70". session_deps_.proxy_service.reset(ProxyService::CreateFixed( "https://proxy:70")); - CapturingBoundNetLog log; + BoundTestNetLog log; session_deps_.net_log = log.bound().net_log(); scoped_refptr<HttpNetworkSession> session( SpdySessionDependencies::SpdyCreateSessionDeterministic(&session_deps_)); @@ -3935,7 +3935,7 @@ TEST_P(HttpNetworkTransactionTest, // Configure against https proxy server "proxy:70". session_deps_.proxy_service.reset(ProxyService::CreateFixed( "https://proxy:70")); - CapturingBoundNetLog log; + BoundTestNetLog log; session_deps_.net_log = log.bound().net_log(); scoped_refptr<HttpNetworkSession> session( SpdySessionDependencies::SpdyCreateSessionDeterministic(&session_deps_)); @@ -4066,7 +4066,7 @@ TEST_P(HttpNetworkTransactionTest, // Configure against https proxy server "proxy:70". session_deps_.proxy_service.reset(ProxyService::CreateFixed( "https://proxy:70")); - CapturingBoundNetLog log; + BoundTestNetLog log; session_deps_.net_log = log.bound().net_log(); scoped_refptr<HttpNetworkSession> session( SpdySessionDependencies::SpdyCreateSessionDeterministic(&session_deps_)); @@ -4184,7 +4184,7 @@ TEST_P(HttpNetworkTransactionTest, HttpsProxyAuthRetry) { // Configure against https proxy server "myproxy:70". session_deps_.proxy_service.reset( ProxyService::CreateFixed("https://myproxy:70")); - CapturingBoundNetLog log; + BoundTestNetLog log; session_deps_.net_log = log.bound().net_log(); scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -6374,7 +6374,7 @@ TEST_P(HttpNetworkTransactionTest, HTTPSBadCertificateViaProxy) { TEST_P(HttpNetworkTransactionTest, HTTPSViaHttpsProxy) { session_deps_.proxy_service.reset( ProxyService::CreateFixedFromPacResult("HTTPS proxy:70")); - CapturingNetLog net_log; + TestNetLog net_log; session_deps_.net_log = &net_log; HttpRequestInfo request; @@ -6438,7 +6438,7 @@ TEST_P(HttpNetworkTransactionTest, HTTPSViaHttpsProxy) { TEST_P(HttpNetworkTransactionTest, RedirectOfHttpsConnectViaHttpsProxy) { session_deps_.proxy_service.reset( ProxyService::CreateFixedFromPacResult("HTTPS proxy:70")); - CapturingNetLog net_log; + TestNetLog net_log; session_deps_.net_log = &net_log; HttpRequestInfo request; @@ -6691,7 +6691,7 @@ TEST_P(HttpNetworkTransactionTest, BasicAuthSpdyProxy) { // Configure against https proxy server "myproxy:70". session_deps_.proxy_service.reset( ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70")); - CapturingBoundNetLog log; + BoundTestNetLog log; session_deps_.net_log = log.bound().net_log(); scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -6771,7 +6771,7 @@ TEST_P(HttpNetworkTransactionTest, BasicAuthSpdyProxy) { rv = callback1.WaitForResult(); EXPECT_EQ(OK, rv); - net::CapturingNetLog::CapturedEntryList entries; + net::TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); size_t pos = ExpectLogContainsSomewhere( entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, @@ -6832,7 +6832,7 @@ TEST_P(HttpNetworkTransactionTest, CrossOriginProxyPush) { // Configure against https proxy server "myproxy:70". session_deps_.proxy_service.reset( ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70")); - CapturingBoundNetLog log; + BoundTestNetLog log; session_deps_.net_log = log.bound().net_log(); // Enable cross-origin push. @@ -6947,7 +6947,7 @@ TEST_P(HttpNetworkTransactionTest, CrossOriginProxyPushCorrectness) { // Configure against https proxy server "myproxy:70". session_deps_.proxy_service.reset( ProxyService::CreateFixed("https://myproxy:70")); - CapturingBoundNetLog log; + BoundTestNetLog log; session_deps_.net_log = log.bound().net_log(); // Enable cross-origin push. @@ -7498,7 +7498,7 @@ TEST_P(HttpNetworkTransactionTest, SOCKS4_HTTP_GET) { session_deps_.proxy_service.reset( ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080")); - CapturingNetLog net_log; + TestNetLog net_log; session_deps_.net_log = &net_log; scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -7557,7 +7557,7 @@ TEST_P(HttpNetworkTransactionTest, SOCKS4_SSL_GET) { session_deps_.proxy_service.reset( ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080")); - CapturingNetLog net_log; + TestNetLog net_log; session_deps_.net_log = &net_log; scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -7621,7 +7621,7 @@ TEST_P(HttpNetworkTransactionTest, SOCKS4_HTTP_GET_no_PAC) { session_deps_.proxy_service.reset( ProxyService::CreateFixed("socks4://myproxy:1080")); - CapturingNetLog net_log; + TestNetLog net_log; session_deps_.net_log = &net_log; scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -7680,7 +7680,7 @@ TEST_P(HttpNetworkTransactionTest, SOCKS5_HTTP_GET) { session_deps_.proxy_service.reset( ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080")); - CapturingNetLog net_log; + TestNetLog net_log; session_deps_.net_log = &net_log; scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -7753,7 +7753,7 @@ TEST_P(HttpNetworkTransactionTest, SOCKS5_SSL_GET) { session_deps_.proxy_service.reset( ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080")); - CapturingNetLog net_log; + TestNetLog net_log; session_deps_.net_log = &net_log; scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -9524,7 +9524,7 @@ TEST_P(HttpNetworkTransactionTest, make_scoped_ptr( new ForwardingProxyResolverFactory(&capturing_proxy_resolver)), NULL)); - CapturingNetLog net_log; + TestNetLog net_log; session_deps_.net_log = &net_log; HttpRequestInfo request; @@ -10455,7 +10455,7 @@ TEST_P(HttpNetworkTransactionTest, SpdyAlternateProtocolThroughProxy) { session_deps_.proxy_service.reset( ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); - CapturingNetLog net_log; + TestNetLog net_log; session_deps_.net_log = &net_log; GURL request_url; { @@ -10639,7 +10639,7 @@ TEST_P(HttpNetworkTransactionTest, SimpleCancel) { TestCompletionCallback callback; - CapturingBoundNetLog log; + BoundTestNetLog log; int rv = trans->Start(&request, callback.callback(), log.bound()); EXPECT_EQ(ERR_IO_PENDING, rv); trans.reset(); // Cancel the transaction here. @@ -10701,7 +10701,7 @@ TEST_P(HttpNetworkTransactionTest, CancelAfterHeaders) { TEST_P(HttpNetworkTransactionTest, ProxyGet) { session_deps_.proxy_service.reset( ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); - CapturingBoundNetLog log; + BoundTestNetLog log; session_deps_.net_log = log.bound().net_log(); scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -10764,7 +10764,7 @@ TEST_P(HttpNetworkTransactionTest, ProxyGet) { TEST_P(HttpNetworkTransactionTest, ProxyTunnelGet) { session_deps_.proxy_service.reset( ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); - CapturingBoundNetLog log; + BoundTestNetLog log; session_deps_.net_log = log.bound().net_log(); scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -10808,7 +10808,7 @@ TEST_P(HttpNetworkTransactionTest, ProxyTunnelGet) { rv = callback1.WaitForResult(); EXPECT_EQ(OK, rv); - net::CapturingNetLog::CapturedEntryList entries; + net::TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); size_t pos = ExpectLogContainsSomewhere( entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, @@ -10839,7 +10839,7 @@ TEST_P(HttpNetworkTransactionTest, ProxyTunnelGet) { // while establishing the tunnel. TEST_P(HttpNetworkTransactionTest, ProxyTunnelGetHangup) { session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); - CapturingBoundNetLog log; + BoundTestNetLog log; session_deps_.net_log = log.bound().net_log(); scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); @@ -10880,7 +10880,7 @@ TEST_P(HttpNetworkTransactionTest, ProxyTunnelGetHangup) { rv = callback1.WaitForResult(); EXPECT_EQ(ERR_EMPTY_RESPONSE, rv); - net::CapturingNetLog::CapturedEntryList entries; + net::TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); size_t pos = ExpectLogContainsSomewhere( entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, @@ -11225,7 +11225,7 @@ TEST_P(HttpNetworkTransactionTest, TEST_P(HttpNetworkTransactionTest, ClientAuthCertCache_Proxy_Fail) { session_deps_.proxy_service.reset( ProxyService::CreateFixed("https://proxy:70")); - CapturingBoundNetLog log; + BoundTestNetLog log; session_deps_.net_log = log.bound().net_log(); scoped_refptr<SSLCertRequestInfo> cert_request(new SSLCertRequestInfo()); @@ -11819,7 +11819,7 @@ TEST_P(HttpNetworkTransactionTest, DoNotUseSpdySessionForHttpOverTunnel) { session_deps_.proxy_service.reset( ProxyService::CreateFixedFromPacResult("HTTPS proxy:70")); - CapturingNetLog log; + TestNetLog log; session_deps_.net_log = &log; SSLSocketDataProvider ssl1(ASYNC, OK); // to the proxy ssl1.SetNextProto(GetParam()); diff --git a/net/log/net_log_unittest.cc b/net/log/net_log_unittest.cc index 7c08334..73e4e30 100644 --- a/net/log/net_log_unittest.cc +++ b/net/log/net_log_unittest.cc @@ -25,8 +25,8 @@ base::Value* NetLogLevelCallback(NetLog::LogLevel log_level) { } TEST(NetLogTest, Basic) { - CapturingNetLog net_log; - CapturingNetLog::CapturedEntryList entries; + TestNetLog net_log; + TestNetLog::CapturedEntryList entries; net_log.GetEntries(&entries); EXPECT_EQ(0u, entries.size()); @@ -44,7 +44,7 @@ TEST(NetLogTest, Basic) { // Check that the correct LogLevel is sent to NetLog Value callbacks. TEST(NetLogTest, LogLevels) { - CapturingNetLog net_log; + TestNetLog net_log; for (int log_level = NetLog::LOG_ALL; log_level < NetLog::LOG_NONE; ++log_level) { net_log.SetLogLevel(static_cast<NetLog::LogLevel>(log_level)); @@ -53,7 +53,7 @@ TEST(NetLogTest, LogLevels) { net_log.AddGlobalEntry(NetLog::TYPE_SOCKET_ALIVE, base::Bind(NetLogLevelCallback)); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; net_log.GetEntries(&entries); ASSERT_EQ(1u, entries.size()); diff --git a/net/log/net_log_unittest.h b/net/log/net_log_unittest.h index 62cf0ce..1634e60 100644 --- a/net/log/net_log_unittest.h +++ b/net/log/net_log_unittest.h @@ -7,7 +7,7 @@ #include <cstddef> -#include "net/log/capturing_net_log.h" +#include "net/log/test_net_log.h" #include "testing/gtest/include/gtest/gtest.h" namespace net { @@ -20,7 +20,7 @@ inline base::TimeTicks MakeTime(int t) { } inline ::testing::AssertionResult LogContainsEventHelper( - const CapturingNetLog::CapturedEntryList& entries, + const TestNetLog::CapturedEntryList& entries, int i, // Negative indices are reverse indices. const base::TimeTicks& expected_time, bool check_time, @@ -31,7 +31,7 @@ inline ::testing::AssertionResult LogContainsEventHelper( : static_cast<size_t>(i); if (j >= entries.size()) return ::testing::AssertionFailure() << j << " is out of bounds."; - const CapturingNetLog::CapturedEntry& entry = entries[j]; + const TestNetLog::CapturedEntry& entry = entries[j]; if (expected_event != entry.type) { return ::testing::AssertionFailure() << "Actual event: " << NetLog::EventTypeToString(entry.type) @@ -54,7 +54,7 @@ inline ::testing::AssertionResult LogContainsEventHelper( } inline ::testing::AssertionResult LogContainsEventAtTime( - const CapturingNetLog::CapturedEntryList& log, + const TestNetLog::CapturedEntryList& log, int i, // Negative indices are reverse indices. const base::TimeTicks& expected_time, NetLog::EventType expected_event, @@ -65,7 +65,7 @@ inline ::testing::AssertionResult LogContainsEventAtTime( // Version without timestamp. inline ::testing::AssertionResult LogContainsEvent( - const CapturingNetLog::CapturedEntryList& log, + const TestNetLog::CapturedEntryList& log, int i, // Negative indices are reverse indices. NetLog::EventType expected_event, NetLog::EventPhase expected_phase) { @@ -75,7 +75,7 @@ inline ::testing::AssertionResult LogContainsEvent( // Version for PHASE_BEGIN (and no timestamp). inline ::testing::AssertionResult LogContainsBeginEvent( - const CapturingNetLog::CapturedEntryList& log, + const TestNetLog::CapturedEntryList& log, int i, // Negative indices are reverse indices. NetLog::EventType expected_event) { return LogContainsEvent(log, i, expected_event, NetLog::PHASE_BEGIN); @@ -83,14 +83,14 @@ inline ::testing::AssertionResult LogContainsBeginEvent( // Version for PHASE_END (and no timestamp). inline ::testing::AssertionResult LogContainsEndEvent( - const CapturingNetLog::CapturedEntryList& log, + const TestNetLog::CapturedEntryList& 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 CapturingNetLog::CapturedEntryList& entries, + const TestNetLog::CapturedEntryList& entries, int i, // Negative indices are reverse indices. NetLog::EventType type) { // Negative indices are reverse indices. @@ -98,7 +98,7 @@ inline ::testing::AssertionResult LogContainsEntryWithType( : static_cast<size_t>(i); if (j >= entries.size()) return ::testing::AssertionFailure() << j << " is out of bounds."; - const CapturingNetLog::CapturedEntry& entry = entries[j]; + const TestNetLog::CapturedEntry& entry = entries[j]; if (entry.type != type) return ::testing::AssertionFailure() << "Type does not match."; return ::testing::AssertionSuccess(); @@ -107,7 +107,7 @@ inline ::testing::AssertionResult LogContainsEntryWithType( // Check if the log contains any entry of the given type at |min_index| or // after. inline ::testing::AssertionResult LogContainsEntryWithTypeAfter( - const CapturingNetLog::CapturedEntryList& entries, + const TestNetLog::CapturedEntryList& entries, int min_index, // Negative indices are reverse indices. NetLog::EventType type) { // Negative indices are reverse indices. @@ -116,7 +116,7 @@ inline ::testing::AssertionResult LogContainsEntryWithTypeAfter( ? 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 CapturingNetLog::CapturedEntry& entry = entries[i]; + const TestNetLog::CapturedEntry& entry = entries[i]; if (entry.type == type) return ::testing::AssertionSuccess(); } @@ -127,13 +127,13 @@ inline ::testing::AssertionResult LogContainsEntryWithTypeAfter( // 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 CapturingNetLog::CapturedEntryList& entries, + const TestNetLog::CapturedEntryList& entries, size_t min_index, NetLog::EventType expected_event, NetLog::EventPhase expected_phase) { size_t i = 0; for (; i < entries.size(); ++i) { - const CapturingNetLog::CapturedEntry& entry = entries[i]; + const TestNetLog::CapturedEntry& entry = entries[i]; if (entry.type == expected_event && entry.phase == expected_phase) break; } @@ -146,13 +146,13 @@ inline size_t ExpectLogContainsSomewhere( // 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 CapturingNetLog::CapturedEntryList& entries, + const TestNetLog::CapturedEntryList& entries, size_t min_index, NetLog::EventType expected_event, NetLog::EventPhase expected_phase) { size_t i = min_index; for (; i < entries.size(); ++i) { - const CapturingNetLog::CapturedEntry& entry = entries[i]; + const TestNetLog::CapturedEntry& entry = entries[i]; if (entry.type == expected_event && entry.phase == expected_phase) break; } diff --git a/net/log/capturing_net_log.cc b/net/log/test_net_log.cc index 99e7296..695eacc 100644 --- a/net/log/capturing_net_log.cc +++ b/net/log/test_net_log.cc @@ -2,68 +2,67 @@ // 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.h" +#include "net/log/test_net_log.h" namespace net { -CapturingNetLog::CapturingNetLog() { +TestNetLog::TestNetLog() { DeprecatedAddObserver(&capturing_net_log_observer_, LOG_ALL_BUT_BYTES); } -CapturingNetLog::~CapturingNetLog() { +TestNetLog::~TestNetLog() { DeprecatedRemoveObserver(&capturing_net_log_observer_); } -void CapturingNetLog::SetLogLevel(NetLog::LogLevel log_level) { +void TestNetLog::SetLogLevel(NetLog::LogLevel log_level) { SetObserverLogLevel(&capturing_net_log_observer_, log_level); } -void CapturingNetLog::GetEntries( - CapturingNetLog::CapturedEntryList* entry_list) const { +void TestNetLog::GetEntries(TestNetLog::CapturedEntryList* entry_list) const { capturing_net_log_observer_.GetEntries(entry_list); } -void CapturingNetLog::GetEntriesForSource(NetLog::Source source, - CapturedEntryList* entry_list) const { +void TestNetLog::GetEntriesForSource(NetLog::Source source, + CapturedEntryList* entry_list) const { capturing_net_log_observer_.GetEntriesForSource(source, entry_list); } -size_t CapturingNetLog::GetSize() const { +size_t TestNetLog::GetSize() const { return capturing_net_log_observer_.GetSize(); } -void CapturingNetLog::Clear() { +void TestNetLog::Clear() { capturing_net_log_observer_.Clear(); } -CapturingBoundNetLog::CapturingBoundNetLog() +BoundTestNetLog::BoundTestNetLog() : net_log_( BoundNetLog::Make(&capturing_net_log_, net::NetLog::SOURCE_NONE)) { } -CapturingBoundNetLog::~CapturingBoundNetLog() { +BoundTestNetLog::~BoundTestNetLog() { } -void CapturingBoundNetLog::GetEntries( - CapturingNetLog::CapturedEntryList* entry_list) const { +void BoundTestNetLog::GetEntries( + TestNetLog::CapturedEntryList* entry_list) const { capturing_net_log_.GetEntries(entry_list); } -void CapturingBoundNetLog::GetEntriesForSource( +void BoundTestNetLog::GetEntriesForSource( NetLog::Source source, - CapturingNetLog::CapturedEntryList* entry_list) const { + TestNetLog::CapturedEntryList* entry_list) const { capturing_net_log_.GetEntriesForSource(source, entry_list); } -size_t CapturingBoundNetLog::GetSize() const { +size_t BoundTestNetLog::GetSize() const { return capturing_net_log_.GetSize(); } -void CapturingBoundNetLog::Clear() { +void BoundTestNetLog::Clear() { capturing_net_log_.Clear(); } -void CapturingBoundNetLog::SetLogLevel(NetLog::LogLevel log_level) { +void BoundTestNetLog::SetLogLevel(NetLog::LogLevel log_level) { capturing_net_log_.SetLogLevel(log_level); } diff --git a/net/log/capturing_net_log.h b/net/log/test_net_log.h index f2cc03f..174f715 100644 --- a/net/log/capturing_net_log.h +++ b/net/log/test_net_log.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_H_ -#define NET_LOG_CAPTURING_NET_LOG_H_ +#ifndef NET_LOG_TEST_NET_LOG_H_ +#define NET_LOG_TEST_NET_LOG_H_ #include <string> #include <vector> @@ -16,17 +16,17 @@ namespace net { -// CapturingNetLog is convenience class which combines a NetLog and a +// TestNetLog is convenience class which combines a NetLog and a // CapturingNetLogObserver. It is intended for testing only, and is part of the // net_test_support project. -class CapturingNetLog : public NetLog { +class TestNetLog : public NetLog { public: // TODO(mmenke): Get rid of these. typedef CapturedNetLogEntry CapturedEntry; typedef CapturedNetLogEntry::List CapturedEntryList; - CapturingNetLog(); - ~CapturingNetLog() override; + TestNetLog(); + ~TestNetLog() override; void SetLogLevel(LogLevel log_level); @@ -39,45 +39,44 @@ class CapturingNetLog : public NetLog { private: CapturingNetLogObserver capturing_net_log_observer_; - DISALLOW_COPY_AND_ASSIGN(CapturingNetLog); + DISALLOW_COPY_AND_ASSIGN(TestNetLog); }; // Helper class that exposes a similar API as BoundNetLog, but uses a -// CapturingNetLog rather than the more generic NetLog. +// TestNetLog rather than the more generic NetLog. // -// A CapturingBoundNetLog can easily be converted to a BoundNetLog using the +// A BoundTestNetLog can easily be converted to a BoundNetLog using the // bound() method. -class CapturingBoundNetLog { +class BoundTestNetLog { public: - CapturingBoundNetLog(); - ~CapturingBoundNetLog(); + BoundTestNetLog(); + ~BoundTestNetLog(); // The returned BoundNetLog is only valid while |this| is alive. BoundNetLog bound() const { return net_log_; } // Fills |entry_list| with all entries in the log. - void GetEntries(CapturingNetLog::CapturedEntryList* entry_list) const; + void GetEntries(TestNetLog::CapturedEntryList* entry_list) const; // Fills |entry_list| with all entries in the log from the specified Source. - void GetEntriesForSource( - NetLog::Source source, - CapturingNetLog::CapturedEntryList* entry_list) const; + void GetEntriesForSource(NetLog::Source source, + TestNetLog::CapturedEntryList* entry_list) const; // Returns number of entries in the log. size_t GetSize() const; void Clear(); - // Sets the log level of the underlying CapturingNetLog. + // Sets the log level of the underlying TestNetLog. void SetLogLevel(NetLog::LogLevel log_level); private: - CapturingNetLog capturing_net_log_; + TestNetLog capturing_net_log_; const BoundNetLog net_log_; - DISALLOW_COPY_AND_ASSIGN(CapturingBoundNetLog); + DISALLOW_COPY_AND_ASSIGN(BoundTestNetLog); }; } // namespace net -#endif // NET_LOG_CAPTURING_NET_LOG_H_ +#endif // NET_LOG_TEST_NET_LOG_H_ diff --git a/net/log/trace_net_log_observer_unittest.cc b/net/log/trace_net_log_observer_unittest.cc index 0314378..2c2bb48 100644 --- a/net/log/trace_net_log_observer_unittest.cc +++ b/net/log/trace_net_log_observer_unittest.cc @@ -17,8 +17,8 @@ #include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event_impl.h" #include "base/values.h" -#include "net/log/capturing_net_log.h" #include "net/log/net_log.h" +#include "net/log/test_net_log.h" #include "testing/gtest/include/gtest/gtest.h" using base::trace_event::TraceLog; @@ -131,7 +131,7 @@ class TraceNetLogObserverTest : public testing::Test { base::ListValue* trace_events() const { return trace_events_.get(); } - CapturingNetLog* net_log() { return &net_log_; } + TestNetLog* net_log() { return &net_log_; } TraceNetLogObserver* trace_net_log_observer() const { return trace_net_log_observer_.get(); @@ -141,7 +141,7 @@ class TraceNetLogObserverTest : public testing::Test { scoped_ptr<base::ListValue> trace_events_; base::trace_event::TraceResultBuffer trace_buffer_; base::trace_event::TraceResultBuffer::SimpleOutput json_output_; - CapturingNetLog net_log_; + TestNetLog net_log_; scoped_ptr<TraceNetLogObserver> trace_net_log_observer_; }; @@ -156,7 +156,7 @@ TEST_F(TraceNetLogObserverTest, TracingNotEnabled) { } TEST_F(TraceNetLogObserverTest, TraceEventCaptured) { - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; net_log()->GetEntries(&entries); EXPECT_TRUE(entries.empty()); @@ -223,7 +223,7 @@ TEST_F(TraceNetLogObserverTest, EnableAndDisableTracing) { EndTraceAndFlush(); trace_net_log_observer()->StopWatchForTraceStart(); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; net_log()->GetEntries(&entries); EXPECT_EQ(3u, entries.size()); EXPECT_EQ(2u, trace_events()->GetSize()); @@ -263,7 +263,7 @@ TEST_F(TraceNetLogObserverTest, DestroyObserverWhileTracing) { EndTraceAndFlush(); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; net_log()->GetEntries(&entries); EXPECT_EQ(2u, entries.size()); EXPECT_EQ(1u, trace_events()->GetSize()); @@ -292,7 +292,7 @@ TEST_F(TraceNetLogObserverTest, DestroyObserverWhileNotTracing) { EndTraceAndFlush(); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; net_log()->GetEntries(&entries); EXPECT_EQ(3u, entries.size()); EXPECT_EQ(0u, trace_events()->GetSize()); @@ -310,7 +310,7 @@ TEST_F(TraceNetLogObserverTest, CreateObserverAfterTracingStarts) { EndTraceAndFlush(); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; net_log()->GetEntries(&entries); EXPECT_EQ(3u, entries.size()); EXPECT_EQ(0u, trace_events()->GetSize()); @@ -329,7 +329,7 @@ TEST_F(TraceNetLogObserverTest, EventsWithAndWithoutParameters) { EndTraceAndFlush(); trace_net_log_observer()->StopWatchForTraceStart(); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; net_log()->GetEntries(&entries); EXPECT_EQ(2u, entries.size()); EXPECT_EQ(2u, trace_events()->GetSize()); diff --git a/net/log/net_log_logger.cc b/net/log/write_to_file_net_log_observer.cc index 4a2b475..668b866 100644 --- a/net/log/net_log_logger.cc +++ b/net/log/write_to_file_net_log_observer.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_logger.h" +#include "net/log/write_to_file_net_log_observer.h" #include <stdio.h> @@ -17,22 +17,23 @@ namespace net { -NetLogLogger::NetLogLogger() +WriteToFileNetLogObserver::WriteToFileNetLogObserver() : log_level_(NetLog::LOG_STRIP_PRIVATE_DATA), added_events_(false) { } -NetLogLogger::~NetLogLogger() { +WriteToFileNetLogObserver::~WriteToFileNetLogObserver() { } -void NetLogLogger::set_log_level(net::NetLog::LogLevel log_level) { +void WriteToFileNetLogObserver::set_log_level(net::NetLog::LogLevel log_level) { DCHECK(!net_log()); log_level_ = log_level; } -void NetLogLogger::StartObserving(net::NetLog* net_log, - base::ScopedFILE file, - base::Value* constants, - net::URLRequestContext* url_request_context) { +void WriteToFileNetLogObserver::StartObserving( + net::NetLog* net_log, + base::ScopedFILE file, + base::Value* constants, + net::URLRequestContext* url_request_context) { DCHECK(file.get()); file_ = file.Pass(); added_events_ = false; @@ -64,7 +65,8 @@ void NetLogLogger::StartObserving(net::NetLog* net_log, net_log->DeprecatedAddObserver(this, log_level_); } -void NetLogLogger::StopObserving(net::URLRequestContext* url_request_context) { +void WriteToFileNetLogObserver::StopObserving( + net::URLRequestContext* url_request_context) { net_log()->DeprecatedRemoveObserver(this); // End events array. @@ -85,7 +87,7 @@ void NetLogLogger::StopObserving(net::URLRequestContext* url_request_context) { file_.reset(); } -void NetLogLogger::OnAddEntry(const net::NetLog::Entry& entry) { +void WriteToFileNetLogObserver::OnAddEntry(const net::NetLog::Entry& entry) { // Add a comma and newline for every event but the first. Newlines are needed // so can load partial log files by just ignoring the last line. For this to // work, lines cannot be pretty printed. diff --git a/net/log/net_log_logger.h b/net/log/write_to_file_net_log_observer.h index 111d8dd..bd147e3 100644 --- a/net/log/net_log_logger.h +++ b/net/log/write_to_file_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_NET_LOG_LOGGER_H_ -#define NET_LOG_NET_LOG_LOGGER_H_ +#ifndef WRITE_TO_FILE_NET_LOG_OBSERVER_H_ +#define WRITE_TO_FILE_NET_LOG_OBSERVER_H_ #include <stdio.h> @@ -22,14 +22,14 @@ namespace net { class URLRequestContext; -// NetLogLogger watches the NetLog event stream, and sends all entries to -// a file specified on creation. +// WriteToFileNetLogObserver watches the NetLog event stream, and sends all +// entries to a file specified on creation. // // The text file will contain a single JSON object. -class NET_EXPORT NetLogLogger : public NetLog::ThreadSafeObserver { +class NET_EXPORT WriteToFileNetLogObserver : public NetLog::ThreadSafeObserver { public: - NetLogLogger(); - ~NetLogLogger() override; + WriteToFileNetLogObserver(); + ~WriteToFileNetLogObserver() override; // Sets the log level to log at. Must be called before StartObserving. void set_log_level(NetLog::LogLevel log_level); @@ -52,7 +52,7 @@ class NET_EXPORT NetLogLogger : public NetLog::ThreadSafeObserver { net::URLRequestContext* url_request_context); // Stops observing net_log(). Must already be watching. Must be called - // before destruction of the NetLogLogger and the NetLog. + // before destruction of the WriteToFileNetLogObserver and the NetLog. // // |url_request_context| is an optional argument used to added additional // network stack state to the log. If the context is non-NULL, this must be @@ -71,9 +71,9 @@ class NET_EXPORT NetLogLogger : public NetLog::ThreadSafeObserver { // True if OnAddEntry() has been called at least once. bool added_events_; - DISALLOW_COPY_AND_ASSIGN(NetLogLogger); + DISALLOW_COPY_AND_ASSIGN(WriteToFileNetLogObserver); }; } // namespace net -#endif // NET_LOG_NET_LOG_LOGGER_H_ +#endif // WRITE_TO_FILE_NET_LOG_OBSERVER_H_ diff --git a/net/log/net_log_logger_unittest.cc b/net/log/write_to_file_net_log_observer_unittest.cc index 8a0d64a..4c12cf3d 100644 --- a/net/log/net_log_logger_unittest.cc +++ b/net/log/write_to_file_net_log_observer_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_logger.h" +#include "net/log/write_to_file_net_log_observer.h" #include "base/files/file_path.h" #include "base/files/file_util.h" @@ -22,7 +22,7 @@ namespace net { namespace { -class NetLogLoggerTest : public testing::Test { +class WriteToFileNetLogObserverTest : public testing::Test { public: void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); @@ -35,11 +35,11 @@ class NetLogLoggerTest : public testing::Test { NetLog net_log_; }; -TEST_F(NetLogLoggerTest, GeneratesValidJSONForNoEvents) { +TEST_F(WriteToFileNetLogObserverTest, GeneratesValidJSONForNoEvents) { // Create and destroy a logger. base::ScopedFILE file(base::OpenFile(log_path_, "w")); ASSERT_TRUE(file); - scoped_ptr<NetLogLogger> logger(new NetLogLogger()); + scoped_ptr<WriteToFileNetLogObserver> logger(new WriteToFileNetLogObserver()); logger->StartObserving(&net_log_, file.Pass(), nullptr, nullptr); logger->StopObserving(nullptr); logger.reset(); @@ -61,10 +61,10 @@ TEST_F(NetLogLoggerTest, GeneratesValidJSONForNoEvents) { ASSERT_TRUE(dict->GetDictionary("constants", &constants)); } -TEST_F(NetLogLoggerTest, LogLevel) { +TEST_F(WriteToFileNetLogObserverTest, LogLevel) { base::ScopedFILE file(base::OpenFile(log_path_, "w")); ASSERT_TRUE(file); - NetLogLogger logger; + WriteToFileNetLogObserver logger; logger.StartObserving(&net_log_, file.Pass(), nullptr, nullptr); EXPECT_EQ(NetLog::LOG_STRIP_PRIVATE_DATA, logger.log_level()); EXPECT_EQ(NetLog::LOG_STRIP_PRIVATE_DATA, net_log_.GetLogLevel()); @@ -79,10 +79,10 @@ TEST_F(NetLogLoggerTest, LogLevel) { logger.StopObserving(nullptr); } -TEST_F(NetLogLoggerTest, GeneratesValidJSONWithOneEvent) { +TEST_F(WriteToFileNetLogObserverTest, GeneratesValidJSONWithOneEvent) { base::ScopedFILE file(base::OpenFile(log_path_, "w")); ASSERT_TRUE(file); - scoped_ptr<NetLogLogger> logger(new NetLogLogger()); + scoped_ptr<WriteToFileNetLogObserver> logger(new WriteToFileNetLogObserver()); logger->StartObserving(&net_log_, file.Pass(), nullptr, nullptr); const int kDummyId = 1; @@ -109,10 +109,10 @@ TEST_F(NetLogLoggerTest, GeneratesValidJSONWithOneEvent) { ASSERT_EQ(1u, events->GetSize()); } -TEST_F(NetLogLoggerTest, GeneratesValidJSONWithMultipleEvents) { +TEST_F(WriteToFileNetLogObserverTest, GeneratesValidJSONWithMultipleEvents) { base::ScopedFILE file(base::OpenFile(log_path_, "w")); ASSERT_TRUE(file); - scoped_ptr<NetLogLogger> logger(new NetLogLogger()); + scoped_ptr<WriteToFileNetLogObserver> logger(new WriteToFileNetLogObserver()); logger->StartObserving(&net_log_, file.Pass(), nullptr, nullptr); const int kDummyId = 1; @@ -142,12 +142,12 @@ TEST_F(NetLogLoggerTest, GeneratesValidJSONWithMultipleEvents) { ASSERT_EQ(2u, events->GetSize()); } -TEST_F(NetLogLoggerTest, CustomConstants) { +TEST_F(WriteToFileNetLogObserverTest, CustomConstants) { const char kConstantString[] = "awesome constant"; scoped_ptr<base::Value> constants(new base::StringValue(kConstantString)); base::ScopedFILE file(base::OpenFile(log_path_, "w")); ASSERT_TRUE(file); - scoped_ptr<NetLogLogger> logger(new NetLogLogger()); + scoped_ptr<WriteToFileNetLogObserver> logger(new WriteToFileNetLogObserver()); logger->StartObserving(&net_log_, file.Pass(), constants.get(), nullptr); logger->StopObserving(nullptr); logger.reset(); @@ -166,7 +166,7 @@ TEST_F(NetLogLoggerTest, CustomConstants) { ASSERT_EQ(kConstantString, constants_string); } -TEST_F(NetLogLoggerTest, GeneratesValidJSONWithContext) { +TEST_F(WriteToFileNetLogObserverTest, GeneratesValidJSONWithContext) { // Create context, start a request. TestURLRequestContext context(true); context.set_net_log(&net_log_); @@ -175,7 +175,7 @@ TEST_F(NetLogLoggerTest, GeneratesValidJSONWithContext) { // Create and destroy a logger. base::ScopedFILE file(base::OpenFile(log_path_, "w")); ASSERT_TRUE(file); - scoped_ptr<NetLogLogger> logger(new NetLogLogger()); + scoped_ptr<WriteToFileNetLogObserver> logger(new WriteToFileNetLogObserver()); logger->StartObserving(&net_log_, file.Pass(), nullptr, &context); logger->StopObserving(&context); logger.reset(); @@ -198,7 +198,8 @@ TEST_F(NetLogLoggerTest, GeneratesValidJSONWithContext) { ASSERT_TRUE(dict->GetDictionary("tabInfo", &tab_info)); } -TEST_F(NetLogLoggerTest, GeneratesValidJSONWithContextWithActiveRequest) { +TEST_F(WriteToFileNetLogObserverTest, + GeneratesValidJSONWithContextWithActiveRequest) { // Create context, start a request. TestURLRequestContext context(true); context.set_net_log(&net_log_); @@ -213,7 +214,7 @@ TEST_F(NetLogLoggerTest, GeneratesValidJSONWithContextWithActiveRequest) { // Create and destroy a logger. base::ScopedFILE file(base::OpenFile(log_path_, "w")); ASSERT_TRUE(file); - scoped_ptr<NetLogLogger> logger(new NetLogLogger()); + scoped_ptr<WriteToFileNetLogObserver> logger(new WriteToFileNetLogObserver()); logger->StartObserving(&net_log_, file.Pass(), nullptr, &context); logger->StopObserving(&context); logger.reset(); diff --git a/net/net.gyp b/net/net.gyp index aac3855..5e4ae19 100644 --- a/net/net.gyp +++ b/net/net.gyp @@ -540,8 +540,8 @@ 'http/http_transaction_test_util.h', 'log/captured_net_log_entry.cc', 'log/captured_net_log_entry.h', - 'log/capturing_net_log.cc', - 'log/capturing_net_log.h', + 'log/test_net_log.cc', + 'log/test_net_log.h', 'log/capturing_net_log_observer.cc', 'log/capturing_net_log_observer.h', 'proxy/mock_proxy_resolver.cc', diff --git a/net/net.gypi b/net/net.gypi index cbdc7e4..8faf632 100644 --- a/net/net.gypi +++ b/net/net.gypi @@ -479,8 +479,8 @@ 'disk_cache/simple/simple_entry_impl.h', 'disk_cache/simple/simple_entry_operation.cc', 'disk_cache/simple/simple_entry_operation.h', - 'log/net_log_logger.cc', - 'log/net_log_logger.h', + 'log/write_to_file_net_log_observer.cc', + 'log/write_to_file_net_log_observer.h', 'log/net_log_util.cc', 'log/net_log_util.h', 'log/trace_net_log_observer.cc', @@ -1434,7 +1434,7 @@ 'http/transport_security_persister_unittest.cc', 'http/transport_security_state_unittest.cc', 'http/url_security_manager_unittest.cc', - 'log/net_log_logger_unittest.cc', + 'log/write_to_file_net_log_observer_unittest.cc', 'log/net_log_unittest.cc', 'log/net_log_unittest.h', 'log/net_log_util_unittest.cc', diff --git a/net/proxy/multi_threaded_proxy_resolver_unittest.cc b/net/proxy/multi_threaded_proxy_resolver_unittest.cc index 9d8d728..eb70c1df 100644 --- a/net/proxy/multi_threaded_proxy_resolver_unittest.cc +++ b/net/proxy/multi_threaded_proxy_resolver_unittest.cc @@ -194,7 +194,7 @@ TEST(MultiThreadedProxyResolverTest, SingleThread_Basic) { // Start request 0. TestCompletionCallback callback0; - CapturingBoundNetLog log0; + BoundTestNetLog log0; ProxyInfo results0; rv = resolver.GetProxyForURL(GURL("http://request0"), &results0, callback0.callback(), NULL, log0.bound()); @@ -209,7 +209,7 @@ TEST(MultiThreadedProxyResolverTest, SingleThread_Basic) { // on completion, this should have been copied into |log0|. // We also have 1 log entry that was emitted by the // MultiThreadedProxyResolver. - CapturingNetLog::CapturedEntryList entries0; + TestNetLog::CapturedEntryList entries0; log0.GetEntries(&entries0); ASSERT_EQ(2u, entries0.size()); @@ -275,7 +275,7 @@ TEST(MultiThreadedProxyResolverTest, ProxyResolver::RequestHandle request0; TestCompletionCallback callback0; ProxyInfo results0; - CapturingBoundNetLog log0; + BoundTestNetLog log0; rv = resolver.GetProxyForURL(GURL("http://request0"), &results0, callback0.callback(), &request0, log0.bound()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -284,7 +284,7 @@ TEST(MultiThreadedProxyResolverTest, TestCompletionCallback callback1; ProxyInfo results1; - CapturingBoundNetLog log1; + BoundTestNetLog log1; rv = resolver.GetProxyForURL(GURL("http://request1"), &results1, callback1.callback(), NULL, log1.bound()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -292,7 +292,7 @@ TEST(MultiThreadedProxyResolverTest, ProxyResolver::RequestHandle request2; TestCompletionCallback callback2; ProxyInfo results2; - CapturingBoundNetLog log2; + BoundTestNetLog log2; rv = resolver.GetProxyForURL(GURL("http://request2"), &results2, callback2.callback(), &request2, log2.bound()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -307,7 +307,7 @@ TEST(MultiThreadedProxyResolverTest, EXPECT_EQ(0, callback0.WaitForResult()); EXPECT_EQ("PROXY request0:80", results0.ToPacString()); - CapturingNetLog::CapturedEntryList entries0; + TestNetLog::CapturedEntryList entries0; log0.GetEntries(&entries0); ASSERT_EQ(2u, entries0.size()); @@ -318,7 +318,7 @@ TEST(MultiThreadedProxyResolverTest, EXPECT_EQ(1, callback1.WaitForResult()); EXPECT_EQ("PROXY request1:80", results1.ToPacString()); - CapturingNetLog::CapturedEntryList entries1; + TestNetLog::CapturedEntryList entries1; log1.GetEntries(&entries1); ASSERT_EQ(4u, entries1.size()); @@ -333,7 +333,7 @@ TEST(MultiThreadedProxyResolverTest, EXPECT_EQ(2, callback2.WaitForResult()); EXPECT_EQ("PROXY request2:80", results2.ToPacString()); - CapturingNetLog::CapturedEntryList entries2; + TestNetLog::CapturedEntryList 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 9c25508..13dfe62 100644 --- a/net/proxy/proxy_resolver_v8_tracing_unittest.cc +++ b/net/proxy/proxy_resolver_v8_tracing_unittest.cc @@ -96,8 +96,8 @@ class MockErrorObserver : public ProxyResolverErrorObserver { }; TEST_F(ProxyResolverV8TracingTest, Simple) { - CapturingNetLog log; - CapturingBoundNetLog request_log; + TestNetLog log; + BoundTestNetLog request_log; MockCachingHostResolver host_resolver; MockErrorObserver* error_observer = new MockErrorObserver; ProxyResolverV8Tracing resolver(&host_resolver, error_observer, &log); @@ -127,8 +127,8 @@ TEST_F(ProxyResolverV8TracingTest, Simple) { } TEST_F(ProxyResolverV8TracingTest, JavascriptError) { - CapturingNetLog log; - CapturingBoundNetLog request_log; + TestNetLog log; + BoundTestNetLog request_log; MockCachingHostResolver host_resolver; MockErrorObserver* error_observer = new MockErrorObserver; ProxyResolverV8Tracing resolver(&host_resolver, error_observer, &log); @@ -152,12 +152,12 @@ TEST_F(ProxyResolverV8TracingTest, JavascriptError) { // Check the NetLogs -- there was 1 alert and 1 javascript error, and they // were output to both the global log, and per-request log. - CapturingNetLog::CapturedEntryList entries_list[2]; + TestNetLog::CapturedEntryList 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 CapturingNetLog::CapturedEntryList& entries = entries_list[list_i]; + const TestNetLog::CapturedEntryList& entries = entries_list[list_i]; EXPECT_EQ(2u, entries.size()); EXPECT_TRUE( LogContainsEvent(entries, 0, NetLog::TYPE_PAC_JAVASCRIPT_ALERT, @@ -173,8 +173,8 @@ TEST_F(ProxyResolverV8TracingTest, JavascriptError) { } TEST_F(ProxyResolverV8TracingTest, TooManyAlerts) { - CapturingNetLog log; - CapturingBoundNetLog request_log; + TestNetLog log; + BoundTestNetLog request_log; MockCachingHostResolver host_resolver; MockErrorObserver* error_observer = new MockErrorObserver; ProxyResolverV8Tracing resolver(&host_resolver, error_observer, &log); @@ -206,12 +206,12 @@ TEST_F(ProxyResolverV8TracingTest, TooManyAlerts) { // Check the NetLogs -- the script generated 50 alerts, which were mirrored // to both the global and per-request logs. - CapturingNetLog::CapturedEntryList entries_list[2]; + TestNetLog::CapturedEntryList 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 CapturingNetLog::CapturedEntryList& entries = entries_list[list_i]; + const TestNetLog::CapturedEntryList& entries = entries_list[list_i]; EXPECT_EQ(50u, entries.size()); for (size_t i = 0; i < entries.size(); ++i) { ASSERT_TRUE( @@ -224,8 +224,8 @@ TEST_F(ProxyResolverV8TracingTest, TooManyAlerts) { // Verify that buffered alerts cannot grow unboundedly, even when the message is // empty string. TEST_F(ProxyResolverV8TracingTest, TooManyEmptyAlerts) { - CapturingNetLog log; - CapturingBoundNetLog request_log; + TestNetLog log; + BoundTestNetLog request_log; MockCachingHostResolver host_resolver; MockErrorObserver* error_observer = new MockErrorObserver; ProxyResolverV8Tracing resolver(&host_resolver, error_observer, &log); @@ -254,12 +254,12 @@ TEST_F(ProxyResolverV8TracingTest, TooManyEmptyAlerts) { // Check the NetLogs -- the script generated 50 alerts, which were mirrored // to both the global and per-request logs. - CapturingNetLog::CapturedEntryList entries_list[2]; + TestNetLog::CapturedEntryList 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 CapturingNetLog::CapturedEntryList& entries = entries_list[list_i]; + const TestNetLog::CapturedEntryList& entries = entries_list[list_i]; EXPECT_EQ(1000u, entries.size()); for (size_t i = 0; i < entries.size(); ++i) { ASSERT_TRUE( @@ -273,8 +273,8 @@ TEST_F(ProxyResolverV8TracingTest, TooManyEmptyAlerts) { // verifies the final result, and that the underlying DNS resolver received // the correct set of queries. TEST_F(ProxyResolverV8TracingTest, Dns) { - CapturingNetLog log; - CapturingBoundNetLog request_log; + TestNetLog log; + BoundTestNetLog request_log; MockCachingHostResolver host_resolver; MockErrorObserver* error_observer = new MockErrorObserver; ProxyResolverV8Tracing resolver(&host_resolver, error_observer, &log); @@ -332,12 +332,12 @@ TEST_F(ProxyResolverV8TracingTest, Dns) { // Check the NetLogs -- the script generated 1 alert, mirrored to both // the per-request and global logs. - CapturingNetLog::CapturedEntryList entries_list[2]; + TestNetLog::CapturedEntryList 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 CapturingNetLog::CapturedEntryList& entries = entries_list[list_i]; + const TestNetLog::CapturedEntryList& entries = entries_list[list_i]; EXPECT_EQ(1u, entries.size()); EXPECT_TRUE( LogContainsEvent(entries, 0, NetLog::TYPE_PAC_JAVASCRIPT_ALERT, @@ -350,8 +350,8 @@ TEST_F(ProxyResolverV8TracingTest, Dns) { // "dnsResolve()". This requires 2 restarts. However once the HostResolver's // cache is warmed, subsequent calls should take 0 restarts. TEST_F(ProxyResolverV8TracingTest, DnsChecksCache) { - CapturingNetLog log; - CapturingBoundNetLog request_log; + TestNetLog log; + BoundTestNetLog request_log; MockCachingHostResolver host_resolver; MockErrorObserver* error_observer = new MockErrorObserver; ProxyResolverV8Tracing resolver(&host_resolver, error_observer, &log); @@ -407,8 +407,8 @@ TEST_F(ProxyResolverV8TracingTest, DnsChecksCache) { // optimization. The proxy resolver should detect the inconsistency and // fall-back to synchronous mode execution. TEST_F(ProxyResolverV8TracingTest, FallBackToSynchronous1) { - CapturingNetLog log; - CapturingBoundNetLog request_log; + TestNetLog log; + BoundTestNetLog request_log; MockCachingHostResolver host_resolver; MockErrorObserver* error_observer = new MockErrorObserver; ProxyResolverV8Tracing resolver(&host_resolver, error_observer, &log); @@ -441,12 +441,12 @@ TEST_F(ProxyResolverV8TracingTest, FallBackToSynchronous1) { // Check the NetLogs -- the script generated 1 alert, mirrored to both // the per-request and global logs. - CapturingNetLog::CapturedEntryList entries_list[2]; + TestNetLog::CapturedEntryList 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 CapturingNetLog::CapturedEntryList& entries = entries_list[list_i]; + const TestNetLog::CapturedEntryList& entries = entries_list[list_i]; EXPECT_EQ(1u, entries.size()); EXPECT_TRUE( LogContainsEvent(entries, 0, NetLog::TYPE_PAC_JAVASCRIPT_ALERT, @@ -459,8 +459,8 @@ TEST_F(ProxyResolverV8TracingTest, FallBackToSynchronous1) { // optimization. The proxy resolver should detect the inconsistency and // fall-back to synchronous mode execution. TEST_F(ProxyResolverV8TracingTest, FallBackToSynchronous2) { - CapturingNetLog log; - CapturingBoundNetLog request_log; + TestNetLog log; + BoundTestNetLog request_log; MockCachingHostResolver host_resolver; MockErrorObserver* error_observer = new MockErrorObserver; ProxyResolverV8Tracing resolver(&host_resolver, error_observer, &log); @@ -499,8 +499,8 @@ TEST_F(ProxyResolverV8TracingTest, FallBackToSynchronous2) { // DNS resolves per request limit (20) after which every DNS resolve will // fail. TEST_F(ProxyResolverV8TracingTest, InfiniteDNSSequence) { - CapturingNetLog log; - CapturingBoundNetLog request_log; + TestNetLog log; + BoundTestNetLog request_log; MockCachingHostResolver host_resolver; MockErrorObserver* error_observer = new MockErrorObserver; ProxyResolverV8Tracing resolver(&host_resolver, error_observer, &log); @@ -542,8 +542,8 @@ TEST_F(ProxyResolverV8TracingTest, InfiniteDNSSequence) { // DNS resolves per request limit (20) after which every DNS resolve will // fail. TEST_F(ProxyResolverV8TracingTest, InfiniteDNSSequence2) { - CapturingNetLog log; - CapturingBoundNetLog request_log; + TestNetLog log; + BoundTestNetLog request_log; MockCachingHostResolver host_resolver; MockErrorObserver* error_observer = new MockErrorObserver; ProxyResolverV8Tracing resolver(&host_resolver, error_observer, &log); @@ -575,8 +575,8 @@ TEST_F(ProxyResolverV8TracingTest, InfiniteDNSSequence2) { } void DnsDuringInitHelper(bool synchronous_host_resolver) { - CapturingNetLog log; - CapturingBoundNetLog request_log; + TestNetLog log; + BoundTestNetLog request_log; MockCachingHostResolver host_resolver; host_resolver.set_synchronous_mode(synchronous_host_resolver); MockErrorObserver* error_observer = new MockErrorObserver; @@ -614,7 +614,7 @@ void DnsDuringInitHelper(bool synchronous_host_resolver) { // Check the NetLogs -- the script generated 2 alerts during initialization. EXPECT_EQ(0u, request_log.GetSize()); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); ASSERT_EQ(2u, entries.size()); @@ -949,8 +949,8 @@ TEST_F(ProxyResolverV8TracingTest, CancelSetPacWhileOutstandingBlockingDns) { // This tests that the execution of a PAC script is terminated when the DNS // dependencies are missing. If the test fails, then it will hang. TEST_F(ProxyResolverV8TracingTest, Terminate) { - CapturingNetLog log; - CapturingBoundNetLog request_log; + TestNetLog log; + BoundTestNetLog request_log; MockCachingHostResolver host_resolver; MockErrorObserver* error_observer = new MockErrorObserver; ProxyResolverV8Tracing resolver(&host_resolver, error_observer, &log); diff --git a/net/proxy/proxy_resolver_v8_unittest.cc b/net/proxy/proxy_resolver_v8_unittest.cc index ae582dc..1f33e18 100644 --- a/net/proxy/proxy_resolver_v8_unittest.cc +++ b/net/proxy/proxy_resolver_v8_unittest.cc @@ -145,7 +145,7 @@ TEST(ProxyResolverV8Test, Direct) { EXPECT_EQ(OK, result); ProxyInfo proxy_info; - CapturingBoundNetLog log; + BoundTestNetLog log; result = resolver.GetProxyForURL( kQueryUrl, &proxy_info, CompletionCallback(), NULL, log.bound()); @@ -155,7 +155,7 @@ TEST(ProxyResolverV8Test, Direct) { EXPECT_EQ(0U, resolver.mock_js_bindings()->alerts.size()); EXPECT_EQ(0U, resolver.mock_js_bindings()->errors.size()); - net::CapturingNetLog::CapturedEntryList entries; + net::TestNetLog::CapturedEntryList 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 b30243d..383c159 100644 --- a/net/proxy/proxy_script_decider_unittest.cc +++ b/net/proxy/proxy_script_decider_unittest.cc @@ -188,14 +188,14 @@ TEST(ProxyScriptDeciderTest, CustomPacSucceeds) { Rules::Rule rule = rules.AddSuccessRule("http://custom/proxy.pac"); TestCompletionCallback callback; - CapturingNetLog log; + TestNetLog log; ProxyScriptDecider decider(&fetcher, &dhcp_fetcher, &log); EXPECT_EQ(OK, decider.Start( config, base::TimeDelta(), true, callback.callback())); EXPECT_EQ(rule.text(), decider.script_data()->utf16()); // Check the NetLog was filled correctly. - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_EQ(4u, entries.size()); @@ -224,7 +224,7 @@ TEST(ProxyScriptDeciderTest, CustomPacFails1) { rules.AddFailDownloadRule("http://custom/proxy.pac"); TestCompletionCallback callback; - CapturingNetLog log; + TestNetLog log; ProxyScriptDecider decider(&fetcher, &dhcp_fetcher, &log); EXPECT_EQ(kFailedDownloading, decider.Start(config, base::TimeDelta(), true, @@ -232,7 +232,7 @@ TEST(ProxyScriptDeciderTest, CustomPacFails1) { EXPECT_EQ(NULL, decider.script_data()); // Check the NetLog was filled correctly. - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_EQ(4u, entries.size()); @@ -477,7 +477,7 @@ TEST(ProxyScriptDeciderTest, AutodetectFailCustomSuccess2) { Rules::Rule rule = rules.AddSuccessRule("http://custom/proxy.pac"); TestCompletionCallback callback; - CapturingNetLog log; + TestNetLog log; ProxyScriptDecider decider(&fetcher, &dhcp_fetcher, &log); EXPECT_EQ(OK, decider.Start(config, base::TimeDelta(), @@ -492,7 +492,7 @@ TEST(ProxyScriptDeciderTest, AutodetectFailCustomSuccess2) { // Check the NetLog was filled correctly. // (Note that various states are repeated since both WPAD and custom // PAC scripts are tried). - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_EQ(10u, entries.size()); @@ -582,7 +582,7 @@ TEST(ProxyScriptDeciderTest, CustomPacFails1_WithPositiveDelay) { rules.AddFailDownloadRule("http://custom/proxy.pac"); TestCompletionCallback callback; - CapturingNetLog log; + TestNetLog log; ProxyScriptDecider decider(&fetcher, &dhcp_fetcher, &log); EXPECT_EQ(ERR_IO_PENDING, decider.Start(config, base::TimeDelta::FromMilliseconds(1), @@ -592,7 +592,7 @@ TEST(ProxyScriptDeciderTest, CustomPacFails1_WithPositiveDelay) { EXPECT_EQ(NULL, decider.script_data()); // Check the NetLog was filled correctly. - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_EQ(6u, entries.size()); @@ -624,7 +624,7 @@ TEST(ProxyScriptDeciderTest, CustomPacFails1_WithNegativeDelay) { rules.AddFailDownloadRule("http://custom/proxy.pac"); TestCompletionCallback callback; - CapturingNetLog log; + TestNetLog log; ProxyScriptDecider decider(&fetcher, &dhcp_fetcher, &log); EXPECT_EQ(kFailedDownloading, decider.Start(config, base::TimeDelta::FromSeconds(-5), @@ -632,7 +632,7 @@ TEST(ProxyScriptDeciderTest, CustomPacFails1_WithNegativeDelay) { EXPECT_EQ(NULL, decider.script_data()); // Check the NetLog was filled correctly. - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList 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 a37f31f5..db4151d 100644 --- a/net/proxy/proxy_service_unittest.cc +++ b/net/proxy/proxy_service_unittest.cc @@ -249,7 +249,7 @@ TEST_F(ProxyServiceTest, Direct) { ProxyInfo info; TestCompletionCallback callback; - CapturingBoundNetLog log; + BoundTestNetLog log; int rv = service.ResolveProxy( url, net::LOAD_NORMAL, &info, callback.callback(), NULL, NULL, log.bound()); @@ -261,7 +261,7 @@ TEST_F(ProxyServiceTest, Direct) { EXPECT_TRUE(info.proxy_resolve_end_time().is_null()); // Check the NetLog was filled correctly. - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_EQ(3u, entries.size()); @@ -287,7 +287,7 @@ TEST_F(ProxyServiceTest, OnResolveProxyCallbackAddProxy) { ProxyInfo info; TestCompletionCallback callback; - CapturingBoundNetLog log; + BoundTestNetLog log; // First, warm up the ProxyService. int rv = service.ResolveProxy( @@ -346,7 +346,7 @@ TEST_F(ProxyServiceTest, OnResolveProxyCallbackRemoveProxy) { ProxyInfo info; TestCompletionCallback callback; - CapturingBoundNetLog log; + BoundTestNetLog log; // First, warm up the ProxyService. int rv = service.ResolveProxy( @@ -393,7 +393,7 @@ TEST_F(ProxyServiceTest, PAC) { ProxyInfo info; TestCompletionCallback callback; ProxyService::PacRequest* request; - CapturingBoundNetLog log; + BoundTestNetLog log; int rv = service.ResolveProxy( url, net::LOAD_NORMAL, &info, callback.callback(), &request, NULL, @@ -423,7 +423,7 @@ TEST_F(ProxyServiceTest, PAC) { EXPECT_LE(info.proxy_resolve_start_time(), info.proxy_resolve_end_time()); // Check the NetLog was filled correctly. - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_EQ(5u, entries.size()); @@ -1913,7 +1913,7 @@ TEST_F(ProxyServiceTest, CancelWhilePACFetching) { ProxyInfo info1; TestCompletionCallback callback1; ProxyService::PacRequest* request1; - CapturingBoundNetLog log1; + BoundTestNetLog log1; int rv = service.ResolveProxy(GURL("http://request1"), net::LOAD_NORMAL, &info1, callback1.callback(), &request1, NULL, log1.bound()); @@ -1970,7 +1970,7 @@ TEST_F(ProxyServiceTest, CancelWhilePACFetching) { EXPECT_FALSE(callback1.have_result()); // Cancelled. EXPECT_FALSE(callback2.have_result()); // Cancelled. - CapturingNetLog::CapturedEntryList entries1; + TestNetLog::CapturedEntryList entries1; log1.GetEntries(&entries1); // Check the NetLog for request 1 (which was cancelled) got filled properly. @@ -2423,7 +2423,7 @@ TEST_F(ProxyServiceTest, NetworkChangeTriggersPacRefetch) { MockAsyncProxyResolverExpectsBytes resolver; - CapturingNetLog log; + TestNetLog log; ProxyService service( config_service, @@ -2520,7 +2520,7 @@ TEST_F(ProxyServiceTest, NetworkChangeTriggersPacRefetch) { // 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. - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_TRUE(LogContainsEntryWithType(entries, 0, @@ -3131,7 +3131,7 @@ TEST_F(ProxyServiceTest, SynchronousWithPAC) { ProxyInfo info; info.UseDirect(); - CapturingBoundNetLog log; + BoundTestNetLog log; bool synchronous_success = service.TryResolveProxySynchronously( url, net::LOAD_NORMAL, &info, NULL, log.bound()); @@ -3160,7 +3160,7 @@ TEST_F(ProxyServiceTest, SynchronousWithFixedConfiguration) { GURL url("http://www.google.com/"); ProxyInfo info; - CapturingBoundNetLog log; + BoundTestNetLog log; bool synchronous_success = service.TryResolveProxySynchronously( url, net::LOAD_NORMAL, &info, NULL, log.bound()); diff --git a/net/quic/quic_client_session_test.cc b/net/quic/quic_client_session_test.cc index c164ac8..b6457ec 100644 --- a/net/quic/quic_client_session_test.cc +++ b/net/quic/quic_client_session_test.cc @@ -13,7 +13,7 @@ #include "net/base/test_data_directory.h" #include "net/cert/cert_verify_result.h" #include "net/http/transport_security_state.h" -#include "net/log/capturing_net_log.h" +#include "net/log/test_net_log.h" #include "net/quic/crypto/aes_128_gcm_12_encrypter.h" #include "net/quic/crypto/crypto_protocol.h" #include "net/quic/crypto/proof_verifier_chromium.h" @@ -81,7 +81,7 @@ class QuicClientSessionTest : public ::testing::TestWithParam<QuicVersion> { } PacketSavingConnection* connection_; - CapturingNetLog net_log_; + TestNetLog net_log_; MockClientSocketFactory socket_factory_; StaticSocketDataProvider socket_data_; TransportSecurityState transport_security_state_; diff --git a/net/quic/quic_network_transaction_unittest.cc b/net/quic/quic_network_transaction_unittest.cc index 5445abd..0fcb77b 100644 --- a/net/quic/quic_network_transaction_unittest.cc +++ b/net/quic/quic_network_transaction_unittest.cc @@ -19,8 +19,8 @@ #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/capturing_net_log.h" #include "net/log/net_log_unittest.h" +#include "net/log/test_net_log.h" #include "net/proxy/proxy_config_service_fixed.h" #include "net/proxy/proxy_resolver.h" #include "net/proxy/proxy_service.h" @@ -353,7 +353,7 @@ class QuicNetworkTransactionTest HttpServerPropertiesImpl http_server_properties; HttpNetworkSession::Params params_; HttpRequestInfo request_; - CapturingBoundNetLog net_log_; + BoundTestNetLog net_log_; StaticSocketDataProvider hanging_data_; private: @@ -405,7 +405,7 @@ TEST_P(QuicNetworkTransactionTest, ForceQuic) { SendRequestAndExpectQuicResponse("hello!"); // Check that the NetLog was filled reasonably. - net::CapturingNetLog::CapturedEntryList entries; + net::TestNetLog::CapturedEntryList 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 391fb61..e54259d 100644 --- a/net/socket/client_socket_pool_base_unittest.cc +++ b/net/socket/client_socket_pool_base_unittest.cc @@ -721,7 +721,7 @@ class ClientSocketPoolBaseTest : public testing::Test { ScopedVector<TestSocketRequest>* requests() { return test_base_.requests(); } size_t completion_count() const { return test_base_.completion_count(); } - CapturingNetLog net_log_; + TestNetLog net_log_; bool connect_backup_jobs_enabled_; bool cleanup_timer_enabled_; MockClientSocketFactory client_socket_factory_; @@ -754,7 +754,7 @@ TEST_F(ClientSocketPoolBaseTest, ConnectJob_NoTimeoutOnSynchronousCompletion) { TEST_F(ClientSocketPoolBaseTest, ConnectJob_TimedOut) { TestConnectJobDelegate delegate; ClientSocketHandle ignored; - CapturingNetLog log; + TestNetLog log; TestClientSocketPoolBase::Request request( &ignored, CompletionCallback(), DEFAULT_PRIORITY, @@ -773,7 +773,7 @@ TEST_F(ClientSocketPoolBaseTest, ConnectJob_TimedOut) { base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(1)); EXPECT_EQ(ERR_TIMED_OUT, delegate.WaitForResult()); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_EQ(6u, entries.size()); @@ -798,7 +798,7 @@ TEST_F(ClientSocketPoolBaseTest, BasicSynchronous) { TestCompletionCallback callback; ClientSocketHandle handle; - CapturingBoundNetLog log; + BoundTestNetLog log; TestLoadTimingInfoNotConnected(handle); EXPECT_EQ(OK, @@ -815,7 +815,7 @@ TEST_F(ClientSocketPoolBaseTest, BasicSynchronous) { handle.Reset(); TestLoadTimingInfoNotConnected(handle); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_EQ(4u, entries.size()); @@ -835,7 +835,7 @@ TEST_F(ClientSocketPoolBaseTest, InitConnectionFailure) { CreatePool(kDefaultMaxSockets, kDefaultMaxSocketsPerGroup); connect_job_factory_->set_job_type(TestConnectJob::kMockFailingJob); - CapturingBoundNetLog log; + BoundTestNetLog log; ClientSocketHandle handle; TestCompletionCallback callback; @@ -856,7 +856,7 @@ TEST_F(ClientSocketPoolBaseTest, InitConnectionFailure) { EXPECT_TRUE(handle.ssl_error_response_info().headers.get() == NULL); TestLoadTimingInfoNotConnected(handle); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_EQ(3u, entries.size()); @@ -1672,7 +1672,7 @@ TEST_F(ClientSocketPoolBaseTest, BasicAsynchronous) { connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); ClientSocketHandle handle; TestCompletionCallback callback; - CapturingBoundNetLog log; + BoundTestNetLog log; int rv = handle.Init("a", params_, LOWEST, @@ -1691,7 +1691,7 @@ TEST_F(ClientSocketPoolBaseTest, BasicAsynchronous) { handle.Reset(); TestLoadTimingInfoNotConnected(handle); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_EQ(4u, entries.size()); @@ -1714,7 +1714,7 @@ TEST_F(ClientSocketPoolBaseTest, connect_job_factory_->set_job_type(TestConnectJob::kMockPendingFailingJob); ClientSocketHandle handle; TestCompletionCallback callback; - CapturingBoundNetLog log; + BoundTestNetLog log; // Set the additional error state members to ensure that they get cleared. handle.set_is_ssl_error(true); HttpResponseInfo info; @@ -1731,7 +1731,7 @@ TEST_F(ClientSocketPoolBaseTest, EXPECT_FALSE(handle.is_ssl_error()); EXPECT_TRUE(handle.ssl_error_response_info().headers.get() == NULL); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_EQ(3u, entries.size()); @@ -1778,7 +1778,7 @@ TEST_F(ClientSocketPoolBaseTest, TwoRequestsCancelOne) { callback.callback(), pool_.get(), BoundNetLog())); - CapturingBoundNetLog log2; + BoundTestNetLog log2; EXPECT_EQ(ERR_IO_PENDING, handle2.Init("a", params_, @@ -2215,7 +2215,7 @@ TEST_F(ClientSocketPoolBaseTest, DisableCleanupTimerReuse) { // Request a new socket. This should reuse the old socket and complete // synchronously. - CapturingBoundNetLog log; + BoundTestNetLog log; rv = handle.Init("a", params_, LOWEST, @@ -2230,7 +2230,7 @@ TEST_F(ClientSocketPoolBaseTest, DisableCleanupTimerReuse) { EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); EXPECT_EQ(1, pool_->NumActiveSocketsInGroup("a")); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_TRUE(LogContainsEntryWithType( entries, 1, NetLog::TYPE_SOCKET_POOL_REUSED_AN_EXISTING_SOCKET)); @@ -2295,7 +2295,7 @@ TEST_F(ClientSocketPoolBaseTest, DisableCleanupTimerNoReuse) { // Request a new socket. This should cleanup the unused and timed out ones. // A new socket will be created rather than reusing the idle one. - CapturingBoundNetLog log; + BoundTestNetLog log; TestCompletionCallback callback3; rv = handle.Init("a", params_, @@ -2312,7 +2312,7 @@ TEST_F(ClientSocketPoolBaseTest, DisableCleanupTimerNoReuse) { EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); EXPECT_EQ(1, pool_->NumActiveSocketsInGroup("a")); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_FALSE(LogContainsEntryWithType( entries, 1, NetLog::TYPE_SOCKET_POOL_REUSED_AN_EXISTING_SOCKET)); @@ -2374,7 +2374,7 @@ TEST_F(ClientSocketPoolBaseTest, CleanupTimedOutIdleSockets) { // used socket. Request it to make sure that it's used. pool_->CleanupTimedOutIdleSockets(); - CapturingBoundNetLog log; + BoundTestNetLog log; rv = handle.Init("a", params_, LOWEST, @@ -2384,7 +2384,7 @@ TEST_F(ClientSocketPoolBaseTest, CleanupTimedOutIdleSockets) { EXPECT_EQ(OK, rv); EXPECT_TRUE(handle.is_reused()); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList 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 6181e4be7..4ee9681 100644 --- a/net/socket/socks5_client_socket_unittest.cc +++ b/net/socket/socks5_client_socket_unittest.cc @@ -44,7 +44,7 @@ class SOCKS5ClientSocketTest : public PlatformTest { protected: const uint16 kNwPort; - CapturingNetLog net_log_; + TestNetLog net_log_; scoped_ptr<SOCKS5ClientSocket> user_sock_; AddressList address_list_; // Filled in by BuildMockSocket() and owned by its return value @@ -146,7 +146,7 @@ TEST_F(SOCKS5ClientSocketTest, CompleteHandshake) { EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_FALSE(user_sock_->IsConnected()); - CapturingNetLog::CapturedEntryList net_log_entries; + TestNetLog::CapturedEntryList net_log_entries; net_log_.GetEntries(&net_log_entries); EXPECT_TRUE(LogContainsBeginEvent(net_log_entries, 0, NetLog::TYPE_SOCKS5_CONNECT)); @@ -270,7 +270,7 @@ TEST_F(SOCKS5ClientSocketTest, PartialReadWrites) { int rv = user_sock_->Connect(callback_.callback()); EXPECT_EQ(ERR_IO_PENDING, rv); - CapturingNetLog::CapturedEntryList net_log_entries; + TestNetLog::CapturedEntryList net_log_entries; net_log_.GetEntries(&net_log_entries); EXPECT_TRUE(LogContainsBeginEvent(net_log_entries, 0, NetLog::TYPE_SOCKS5_CONNECT)); @@ -301,7 +301,7 @@ TEST_F(SOCKS5ClientSocketTest, PartialReadWrites) { int rv = user_sock_->Connect(callback_.callback()); EXPECT_EQ(ERR_IO_PENDING, rv); - CapturingNetLog::CapturedEntryList net_log_entries; + TestNetLog::CapturedEntryList net_log_entries; net_log_.GetEntries(&net_log_entries); EXPECT_TRUE(LogContainsBeginEvent(net_log_entries, 0, NetLog::TYPE_SOCKS5_CONNECT)); @@ -330,7 +330,7 @@ TEST_F(SOCKS5ClientSocketTest, PartialReadWrites) { hostname, 80, &net_log_); int rv = user_sock_->Connect(callback_.callback()); EXPECT_EQ(ERR_IO_PENDING, rv); - CapturingNetLog::CapturedEntryList net_log_entries; + TestNetLog::CapturedEntryList net_log_entries; net_log_.GetEntries(&net_log_entries); EXPECT_TRUE(LogContainsBeginEvent(net_log_entries, 0, NetLog::TYPE_SOCKS5_CONNECT)); @@ -361,7 +361,7 @@ TEST_F(SOCKS5ClientSocketTest, PartialReadWrites) { hostname, 80, &net_log_); int rv = user_sock_->Connect(callback_.callback()); EXPECT_EQ(ERR_IO_PENDING, rv); - CapturingNetLog::CapturedEntryList net_log_entries; + TestNetLog::CapturedEntryList 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 920a1ef..ea7f82e 100644 --- a/net/socket/socks_client_socket_unittest.cc +++ b/net/socket/socks_client_socket_unittest.cc @@ -144,7 +144,7 @@ TEST_F(SOCKSClientSocketTest, CompleteHandshake) { MockRead data_reads[] = { MockRead(ASYNC, kSOCKSOkReply, arraysize(kSOCKSOkReply)), MockRead(ASYNC, payload_read.data(), payload_read.size()) }; - CapturingNetLog log; + TestNetLog log; user_sock_ = BuildMockSocket(data_reads, arraysize(data_reads), data_writes, arraysize(data_writes), @@ -159,7 +159,7 @@ TEST_F(SOCKSClientSocketTest, CompleteHandshake) { int rv = user_sock_->Connect(callback_.callback()); EXPECT_EQ(ERR_IO_PENDING, rv); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_TRUE( LogContainsBeginEvent(entries, 0, NetLog::TYPE_SOCKS_CONNECT)); @@ -220,7 +220,7 @@ TEST_F(SOCKSClientSocketTest, HandshakeFailures) { MockRead data_reads[] = { MockRead(SYNCHRONOUS, tests[i].fail_reply, arraysize(tests[i].fail_reply)) }; - CapturingNetLog log; + TestNetLog log; user_sock_ = BuildMockSocket(data_reads, arraysize(data_reads), data_writes, arraysize(data_writes), @@ -231,7 +231,7 @@ TEST_F(SOCKSClientSocketTest, HandshakeFailures) { int rv = user_sock_->Connect(callback_.callback()); EXPECT_EQ(ERR_IO_PENDING, rv); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_TRUE(LogContainsBeginEvent( entries, 0, NetLog::TYPE_SOCKS_CONNECT)); @@ -257,7 +257,7 @@ TEST_F(SOCKSClientSocketTest, PartialServerReads) { MockRead data_reads[] = { MockRead(ASYNC, kSOCKSPartialReply1, arraysize(kSOCKSPartialReply1)), MockRead(ASYNC, kSOCKSPartialReply2, arraysize(kSOCKSPartialReply2)) }; - CapturingNetLog log; + TestNetLog log; user_sock_ = BuildMockSocket(data_reads, arraysize(data_reads), data_writes, arraysize(data_writes), @@ -267,7 +267,7 @@ TEST_F(SOCKSClientSocketTest, PartialServerReads) { int rv = user_sock_->Connect(callback_.callback()); EXPECT_EQ(ERR_IO_PENDING, rv); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_TRUE(LogContainsBeginEvent( entries, 0, NetLog::TYPE_SOCKS_CONNECT)); @@ -295,7 +295,7 @@ TEST_F(SOCKSClientSocketTest, PartialClientWrites) { }; MockRead data_reads[] = { MockRead(ASYNC, kSOCKSOkReply, arraysize(kSOCKSOkReply)) }; - CapturingNetLog log; + TestNetLog log; user_sock_ = BuildMockSocket(data_reads, arraysize(data_reads), data_writes, arraysize(data_writes), @@ -305,7 +305,7 @@ TEST_F(SOCKSClientSocketTest, PartialClientWrites) { int rv = user_sock_->Connect(callback_.callback()); EXPECT_EQ(ERR_IO_PENDING, rv); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_TRUE(LogContainsBeginEvent( entries, 0, NetLog::TYPE_SOCKS_CONNECT)); @@ -327,7 +327,7 @@ TEST_F(SOCKSClientSocketTest, FailedSocketRead) { MockRead(ASYNC, kSOCKSOkReply, arraysize(kSOCKSOkReply) - 2), // close connection unexpectedly MockRead(SYNCHRONOUS, 0) }; - CapturingNetLog log; + TestNetLog log; user_sock_ = BuildMockSocket(data_reads, arraysize(data_reads), data_writes, arraysize(data_writes), @@ -337,7 +337,7 @@ TEST_F(SOCKSClientSocketTest, FailedSocketRead) { int rv = user_sock_->Connect(callback_.callback()); EXPECT_EQ(ERR_IO_PENDING, rv); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_TRUE(LogContainsBeginEvent( entries, 0, NetLog::TYPE_SOCKS_CONNECT)); @@ -357,7 +357,7 @@ TEST_F(SOCKSClientSocketTest, FailedDNS) { host_resolver_->rules()->AddSimulatedFailure(hostname); - CapturingNetLog log; + TestNetLog log; user_sock_ = BuildMockSocket(NULL, 0, NULL, 0, @@ -367,7 +367,7 @@ TEST_F(SOCKSClientSocketTest, FailedDNS) { int rv = user_sock_->Connect(callback_.callback()); EXPECT_EQ(ERR_IO_PENDING, rv); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList 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 20d78914..7f3c2b1 100644 --- a/net/socket/ssl_client_socket_openssl_unittest.cc +++ b/net/socket/ssl_client_socket_openssl_unittest.cc @@ -184,7 +184,7 @@ class SSLClientSocketOpenSSLClientAuthTest : public PlatformTest { scoped_ptr<SpawnedTestServer> test_server_; AddressList addr_; TestCompletionCallback callback_; - CapturingNetLog log_; + TestNetLog 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 e9f7924..a41903e 100644 --- a/net/socket/ssl_client_socket_unittest.cc +++ b/net/socket/ssl_client_socket_unittest.cc @@ -773,7 +773,7 @@ class SSLClientSocketTest : public PlatformTest { scoped_ptr<TransportSecurityState> transport_security_state_; SSLClientSocketContext context_; scoped_ptr<SSLClientSocket> sock_; - CapturingNetLog log_; + TestNetLog log_; private: scoped_ptr<StreamSocket> transport_; @@ -799,7 +799,7 @@ class SSLClientSocketCertRequestInfoTest : public SSLClientSocketTest { return NULL; TestCompletionCallback callback; - CapturingNetLog log; + TestNetLog log; scoped_ptr<StreamSocket> transport( new TCPClientSocket(addr, &log, NetLog::Source())); int rv = transport->Connect(callback.callback()); @@ -970,7 +970,7 @@ class SSLClientSocketChannelIDTest : public SSLClientSocketTest { // timeout. This means that an SSL connect end event may appear as a socket // write. static bool LogContainsSSLConnectEndEvent( - const CapturingNetLog::CapturedEntryList& log, + const TestNetLog::CapturedEntryList& log, int i) { return LogContainsEndEvent(log, i, NetLog::TYPE_SSL_CONNECT) || LogContainsEvent( @@ -999,7 +999,7 @@ TEST_F(SSLClientSocketTest, Connect) { ASSERT_TRUE(test_server.GetAddressList(&addr)); TestCompletionCallback callback; - CapturingNetLog log; + TestNetLog log; scoped_ptr<StreamSocket> transport( new TCPClientSocket(addr, &log, NetLog::Source())); int rv = transport->Connect(callback.callback()); @@ -1014,7 +1014,7 @@ TEST_F(SSLClientSocketTest, Connect) { rv = sock->Connect(callback.callback()); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_TRUE(LogContainsBeginEvent(entries, 5, NetLog::TYPE_SSL_CONNECT)); if (rv == ERR_IO_PENDING) @@ -1041,7 +1041,7 @@ TEST_F(SSLClientSocketTest, ConnectExpired) { ASSERT_TRUE(test_server.GetAddressList(&addr)); TestCompletionCallback callback; - CapturingNetLog log; + TestNetLog log; scoped_ptr<StreamSocket> transport( new TCPClientSocket(addr, &log, NetLog::Source())); int rv = transport->Connect(callback.callback()); @@ -1056,7 +1056,7 @@ TEST_F(SSLClientSocketTest, ConnectExpired) { rv = sock->Connect(callback.callback()); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_TRUE(LogContainsBeginEvent(entries, 5, NetLog::TYPE_SSL_CONNECT)); if (rv == ERR_IO_PENDING) @@ -1085,7 +1085,7 @@ TEST_F(SSLClientSocketTest, ConnectMismatched) { ASSERT_TRUE(test_server.GetAddressList(&addr)); TestCompletionCallback callback; - CapturingNetLog log; + TestNetLog log; scoped_ptr<StreamSocket> transport( new TCPClientSocket(addr, &log, NetLog::Source())); int rv = transport->Connect(callback.callback()); @@ -1100,7 +1100,7 @@ TEST_F(SSLClientSocketTest, ConnectMismatched) { rv = sock->Connect(callback.callback()); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_TRUE(LogContainsBeginEvent(entries, 5, NetLog::TYPE_SSL_CONNECT)); if (rv == ERR_IO_PENDING) @@ -1129,7 +1129,7 @@ TEST_F(SSLClientSocketTest, ConnectClientAuthCertRequested) { ASSERT_TRUE(test_server.GetAddressList(&addr)); TestCompletionCallback callback; - CapturingNetLog log; + TestNetLog log; scoped_ptr<StreamSocket> transport( new TCPClientSocket(addr, &log, NetLog::Source())); int rv = transport->Connect(callback.callback()); @@ -1144,7 +1144,7 @@ TEST_F(SSLClientSocketTest, ConnectClientAuthCertRequested) { rv = sock->Connect(callback.callback()); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_TRUE(LogContainsBeginEvent(entries, 5, NetLog::TYPE_SSL_CONNECT)); if (rv == ERR_IO_PENDING) @@ -1188,7 +1188,7 @@ TEST_F(SSLClientSocketTest, ConnectClientAuthSendNullCert) { ASSERT_TRUE(test_server.GetAddressList(&addr)); TestCompletionCallback callback; - CapturingNetLog log; + TestNetLog log; scoped_ptr<StreamSocket> transport( new TCPClientSocket(addr, &log, NetLog::Source())); int rv = transport->Connect(callback.callback()); @@ -1209,7 +1209,7 @@ TEST_F(SSLClientSocketTest, ConnectClientAuthSendNullCert) { // TODO(davidben): Add a test which requires them and verify the error. rv = sock->Connect(callback.callback()); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_TRUE(LogContainsBeginEvent(entries, 5, NetLog::TYPE_SSL_CONNECT)); if (rv == ERR_IO_PENDING) @@ -2105,7 +2105,7 @@ TEST_F(SSLClientSocketTest, Read_FullLogging) { ASSERT_TRUE(test_server.GetAddressList(&addr)); TestCompletionCallback callback; - CapturingNetLog log; + TestNetLog log; log.SetLogLevel(NetLog::LOG_ALL); scoped_ptr<StreamSocket> transport( new TCPClientSocket(addr, &log, NetLog::Source())); @@ -2136,7 +2136,7 @@ TEST_F(SSLClientSocketTest, Read_FullLogging) { rv = callback.WaitForResult(); EXPECT_EQ(static_cast<int>(arraysize(request_text) - 1), rv); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); size_t last_index = ExpectLogContainsSomewhereAfter( entries, 5, NetLog::TYPE_SSL_SOCKET_BYTES_SENT, NetLog::PHASE_NONE); @@ -2230,7 +2230,7 @@ TEST_F(SSLClientSocketTest, CipherSuiteDisables) { ASSERT_TRUE(test_server.GetAddressList(&addr)); TestCompletionCallback callback; - CapturingNetLog log; + TestNetLog log; scoped_ptr<StreamSocket> transport( new TCPClientSocket(addr, &log, NetLog::Source())); int rv = transport->Connect(callback.callback()); @@ -2248,7 +2248,7 @@ TEST_F(SSLClientSocketTest, CipherSuiteDisables) { EXPECT_FALSE(sock->IsConnected()); rv = sock->Connect(callback.callback()); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_TRUE(LogContainsBeginEvent(entries, 5, NetLog::TYPE_SSL_CONNECT)); @@ -2529,7 +2529,7 @@ TEST_F(SSLClientSocketTest, VerifyReturnChainProperlyOrdered) { ASSERT_TRUE(test_server.GetAddressList(&addr)); TestCompletionCallback callback; - CapturingNetLog log; + TestNetLog log; scoped_ptr<StreamSocket> transport( new TCPClientSocket(addr, &log, NetLog::Source())); int rv = transport->Connect(callback.callback()); @@ -2542,7 +2542,7 @@ TEST_F(SSLClientSocketTest, VerifyReturnChainProperlyOrdered) { EXPECT_FALSE(sock->IsConnected()); rv = sock->Connect(callback.callback()); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList 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_pool_unittest.cc b/net/socket/transport_client_socket_pool_unittest.cc index 938941b..a14e4ef 100644 --- a/net/socket/transport_client_socket_pool_unittest.cc +++ b/net/socket/transport_client_socket_pool_unittest.cc @@ -16,7 +16,7 @@ #include "net/base/net_util.h" #include "net/base/test_completion_callback.h" #include "net/dns/mock_host_resolver.h" -#include "net/log/capturing_net_log.h" +#include "net/log/test_net_log.h" #include "net/socket/client_socket_handle.h" #include "net/socket/socket_test_util.h" #include "net/socket/stream_socket.h" @@ -90,7 +90,7 @@ class TransportClientSocketPoolTest : public testing::Test { size_t completion_count() const { return test_base_.completion_count(); } bool connect_backup_jobs_enabled_; - CapturingNetLog net_log_; + TestNetLog net_log_; scoped_refptr<TransportSocketParams> params_; scoped_ptr<MockHostResolver> host_resolver_; MockTransportClientSocketFactory client_socket_factory_; diff --git a/net/socket/transport_client_socket_unittest.cc b/net/socket/transport_client_socket_unittest.cc index 0e2f11d..e481b4f 100644 --- a/net/socket/transport_client_socket_unittest.cc +++ b/net/socket/transport_client_socket_unittest.cc @@ -90,7 +90,7 @@ class TransportClientSocketTest protected: uint16 listen_port_; - CapturingNetLog net_log_; + TestNetLog net_log_; ClientSocketFactory* const socket_factory_; scoped_ptr<StreamSocket> sock_; @@ -185,7 +185,7 @@ TEST_P(TransportClientSocketTest, Connect) { int rv = sock_->Connect(callback.callback()); - net::CapturingNetLog::CapturedEntryList net_log_entries; + net::TestNetLog::CapturedEntryList net_log_entries; net_log_.GetEntries(&net_log_entries); EXPECT_TRUE(net::LogContainsBeginEvent( net_log_entries, 0, net::NetLog::TYPE_SOCKET_ALIVE)); diff --git a/net/socket/websocket_transport_client_socket_pool_unittest.cc b/net/socket/websocket_transport_client_socket_pool_unittest.cc index 31e8c94..2df6606 100644 --- a/net/socket/websocket_transport_client_socket_pool_unittest.cc +++ b/net/socket/websocket_transport_client_socket_pool_unittest.cc @@ -22,7 +22,7 @@ #include "net/base/net_util.h" #include "net/base/test_completion_callback.h" #include "net/dns/mock_host_resolver.h" -#include "net/log/capturing_net_log.h" +#include "net/log/test_net_log.h" #include "net/socket/client_socket_handle.h" #include "net/socket/socket_test_util.h" #include "net/socket/stream_socket.h" @@ -103,7 +103,7 @@ class WebSocketTransportClientSocketPoolTest : public ::testing::Test { ScopedVector<TestSocketRequest>* requests() { return test_base_.requests(); } size_t completion_count() const { return test_base_.completion_count(); } - CapturingNetLog net_log_; + TestNetLog net_log_; scoped_refptr<TransportSocketParams> params_; scoped_ptr<MockHostResolver> host_resolver_; MockTransportClientSocketFactory client_socket_factory_; diff --git a/net/spdy/spdy_http_stream_unittest.cc b/net/spdy/spdy_http_stream_unittest.cc index e76aa6e..55f5b36 100644 --- a/net/spdy/spdy_http_stream_unittest.cc +++ b/net/spdy/spdy_http_stream_unittest.cc @@ -21,7 +21,7 @@ #include "net/http/http_request_info.h" #include "net/http/http_response_headers.h" #include "net/http/http_response_info.h" -#include "net/log/capturing_net_log.h" +#include "net/log/test_net_log.h" #include "net/socket/next_proto.h" #include "net/socket/socket_test_util.h" #include "net/spdy/spdy_http_utils.h" @@ -103,7 +103,7 @@ class SpdyHttpStreamTest : public testing::Test, const std::string& proof); SpdyTestUtil spdy_util_; - CapturingNetLog net_log_; + TestNetLog net_log_; SpdySessionDependencies session_deps_; scoped_ptr<DeterministicSocketData> deterministic_data_; scoped_refptr<HttpNetworkSession> http_session_; diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc index d38bfed..e8d8e0b 100644 --- a/net/spdy/spdy_network_transaction_unittest.cc +++ b/net/spdy/spdy_network_transaction_unittest.cc @@ -3653,7 +3653,7 @@ TEST_P(SpdyNetworkTransactionTest, NetLog) { MockRead(ASYNC, 0, 0) // EOF }; - CapturingBoundNetLog log; + BoundTestNetLog log; DelayedSocketData data(1, reads, arraysize(reads), writes, arraysize(writes)); @@ -3670,7 +3670,7 @@ TEST_P(SpdyNetworkTransactionTest, NetLog) { // 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. - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList 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 c870f18..14d98dc 100644 --- a/net/spdy/spdy_proxy_client_socket_unittest.cc +++ b/net/spdy/spdy_proxy_client_socket_unittest.cc @@ -13,9 +13,9 @@ #include "net/dns/mock_host_resolver.h" #include "net/http/http_response_headers.h" #include "net/http/http_response_info.h" -#include "net/log/capturing_net_log.h" #include "net/log/net_log.h" #include "net/log/net_log_unittest.h" +#include "net/log/test_net_log.h" #include "net/socket/client_socket_factory.h" #include "net/socket/next_proto.h" #include "net/socket/socket_test_util.h" @@ -119,7 +119,7 @@ class SpdyProxyClientSocketTest TestCompletionCallback read_callback_; TestCompletionCallback write_callback_; scoped_ptr<DeterministicSocketData> data_; - CapturingBoundNetLog net_log_; + BoundTestNetLog net_log_; private: scoped_refptr<HttpNetworkSession> session_; @@ -1274,7 +1274,7 @@ TEST_P(SpdyProxyClientSocketTest, NetLog) { NetLog::Source sock_source = sock_->NetLog().source(); sock_.reset(); - CapturingNetLog::CapturedEntryList entry_list; + TestNetLog::CapturedEntryList 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 f4b5dec..af8ba39 100644 --- a/net/spdy/spdy_session_unittest.cc +++ b/net/spdy/spdy_session_unittest.cc @@ -1610,7 +1610,7 @@ TEST_P(SpdySessionTest, ClearSettingsStorageOnIPAddressChanged) { } TEST_P(SpdySessionTest, Initialize) { - CapturingBoundNetLog log; + BoundTestNetLog log; session_deps_.net_log = log.bound().net_log(); session_deps_.host_resolver->set_synchronous_mode(true); @@ -1632,7 +1632,7 @@ TEST_P(SpdySessionTest, Initialize) { // Flush the read completion task. base::MessageLoop::current()->RunUntilIdle(); - net::CapturingNetLog::CapturedEntryList entries; + net::TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_LT(0u, entries.size()); @@ -1642,7 +1642,7 @@ TEST_P(SpdySessionTest, Initialize) { net::NetLog::PHASE_NONE); EXPECT_LT(0, pos); - CapturingNetLog::CapturedEntry entry = entries[pos]; + TestNetLog::CapturedEntry entry = entries[pos]; NetLog::Source socket_source; EXPECT_TRUE(NetLog::Source::FromEventParameters(entry.params.get(), &socket_source)); @@ -1666,7 +1666,7 @@ TEST_P(SpdySessionTest, NetLogOnSessionGoaway) { CreateNetworkSession(); - CapturingBoundNetLog log; + BoundTestNetLog log; base::WeakPtr<SpdySession> session = CreateInsecureSpdySession(http_session_, key_, log.bound()); EXPECT_TRUE(HasSpdySession(spdy_session_pool_, key_)); @@ -1678,7 +1678,7 @@ TEST_P(SpdySessionTest, NetLogOnSessionGoaway) { EXPECT_TRUE(session == NULL); // Check that the NetLog was filled reasonably. - net::CapturingNetLog::CapturedEntryList entries; + net::TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_LT(0u, entries.size()); @@ -1688,7 +1688,7 @@ TEST_P(SpdySessionTest, NetLogOnSessionGoaway) { net::NetLog::PHASE_NONE); if (pos < static_cast<int>(entries.size())) { - CapturingNetLog::CapturedEntry entry = entries[pos]; + TestNetLog::CapturedEntry entry = entries[pos]; int error_code = 0; ASSERT_TRUE(entry.GetNetErrorCode(&error_code)); EXPECT_EQ(OK, error_code); @@ -1711,7 +1711,7 @@ TEST_P(SpdySessionTest, NetLogOnSessionEOF) { CreateNetworkSession(); - CapturingBoundNetLog log; + BoundTestNetLog log; base::WeakPtr<SpdySession> session = CreateInsecureSpdySession(http_session_, key_, log.bound()); EXPECT_TRUE(HasSpdySession(spdy_session_pool_, key_)); @@ -1723,7 +1723,7 @@ TEST_P(SpdySessionTest, NetLogOnSessionEOF) { EXPECT_TRUE(session == NULL); // Check that the NetLog was filled reasonably. - net::CapturingNetLog::CapturedEntryList entries; + net::TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_LT(0u, entries.size()); @@ -1733,7 +1733,7 @@ TEST_P(SpdySessionTest, NetLogOnSessionEOF) { net::NetLog::PHASE_NONE); if (pos < static_cast<int>(entries.size())) { - CapturingNetLog::CapturedEntry entry = entries[pos]; + TestNetLog::CapturedEntry 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 22029d0..fc8d35f 100644 --- a/net/spdy/spdy_stream_unittest.cc +++ b/net/spdy/spdy_stream_unittest.cc @@ -254,7 +254,7 @@ TEST_P(SpdyStreamTest, StreamError) { AddReadEOF(); - CapturingBoundNetLog log; + BoundTestNetLog log; DeterministicSocketData data(GetReads(), GetNumReads(), GetWrites(), GetNumWrites()); @@ -294,7 +294,7 @@ TEST_P(SpdyStreamTest, StreamError) { EXPECT_TRUE(data.at_write_eof()); // Check that the NetLog was filled reasonably. - net::CapturingNetLog::CapturedEntryList entries; + net::TestNetLog::CapturedEntryList entries; log.GetEntries(&entries); EXPECT_LT(0u, entries.size()); @@ -738,7 +738,7 @@ TEST_P(SpdyStreamTest, IncreaseSendWindowSizeOverflow) { AddReadEOF(); - CapturingBoundNetLog log; + BoundTestNetLog log; DeterministicSocketData data(GetReads(), GetNumReads(), GetWrites(), GetNumWrites()); diff --git a/net/udp/udp_socket_perftest.cc b/net/udp/udp_socket_perftest.cc index 5a85dcb..df36c46 100644 --- a/net/udp/udp_socket_perftest.cc +++ b/net/udp/udp_socket_perftest.cc @@ -91,7 +91,7 @@ void UDPSocketPerfTest::WriteBenchmark(bool use_nonblocking_io) { // Setup the server to listen. net::IPEndPoint bind_address; CreateUDPAddress("127.0.0.1", kPort, &bind_address); - net::CapturingNetLog server_log; + net::TestNetLog server_log; scoped_ptr<net::UDPServerSocket> server( new net::UDPServerSocket(&server_log, net::NetLog::Source())); #if defined(OS_WIN) @@ -104,7 +104,7 @@ void UDPSocketPerfTest::WriteBenchmark(bool use_nonblocking_io) { // Setup the client. net::IPEndPoint server_address; CreateUDPAddress("127.0.0.1", kPort, &server_address); - net::CapturingNetLog client_log; + net::TestNetLog client_log; scoped_ptr<net::UDPClientSocket> client(new net::UDPClientSocket( net::DatagramSocket::DEFAULT_BIND, net::RandIntCallback(), &client_log, net::NetLog::Source())); diff --git a/net/udp/udp_socket_unittest.cc b/net/udp/udp_socket_unittest.cc index f1bff68..d422e4a 100644 --- a/net/udp/udp_socket_unittest.cc +++ b/net/udp/udp_socket_unittest.cc @@ -149,7 +149,7 @@ void UDPSocketTest::ConnectTest(bool use_nonblocking_io) { // Setup the server to listen. IPEndPoint bind_address; CreateUDPAddress("127.0.0.1", kPort, &bind_address); - CapturingNetLog server_log; + TestNetLog server_log; scoped_ptr<UDPServerSocket> server( new UDPServerSocket(&server_log, NetLog::Source())); #if defined(OS_WIN) @@ -163,7 +163,7 @@ void UDPSocketTest::ConnectTest(bool use_nonblocking_io) { // Setup the client. IPEndPoint server_address; CreateUDPAddress("127.0.0.1", kPort, &server_address); - CapturingNetLog client_log; + TestNetLog client_log; scoped_ptr<UDPClientSocket> client( new UDPClientSocket(DatagramSocket::DEFAULT_BIND, RandIntCallback(), &client_log, NetLog::Source())); @@ -213,7 +213,7 @@ void UDPSocketTest::ConnectTest(bool use_nonblocking_io) { client.reset(); // Check the server's log. - CapturingNetLog::CapturedEntryList server_entries; + TestNetLog::CapturedEntryList server_entries; server_log.GetEntries(&server_entries); EXPECT_EQ(5u, server_entries.size()); EXPECT_TRUE( @@ -228,7 +228,7 @@ void UDPSocketTest::ConnectTest(bool use_nonblocking_io) { LogContainsEndEvent(server_entries, 4, NetLog::TYPE_SOCKET_ALIVE)); // Check the client's log. - CapturingNetLog::CapturedEntryList client_entries; + TestNetLog::CapturedEntryList client_entries; client_log.GetEntries(&client_entries); EXPECT_EQ(7u, client_entries.size()); EXPECT_TRUE( @@ -277,7 +277,7 @@ TEST_F(UDPSocketTest, Broadcast) { IPEndPoint listen_address; CreateUDPAddress("0.0.0.0", kPort, &listen_address); - CapturingNetLog server1_log, server2_log; + TestNetLog server1_log, server2_log; scoped_ptr<UDPServerSocket> server1( new UDPServerSocket(&server1_log, NetLog::Source())); scoped_ptr<UDPServerSocket> server2( diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index 5996500..9b0d312 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc @@ -58,9 +58,9 @@ #include "net/http/http_request_headers.h" #include "net/http/http_response_headers.h" #include "net/http/http_util.h" -#include "net/log/capturing_net_log.h" #include "net/log/net_log.h" #include "net/log/net_log_unittest.h" +#include "net/log/test_net_log.h" #include "net/proxy/proxy_service.h" #include "net/socket/ssl_client_socket.h" #include "net/ssl/ssl_cipher_suite_names.h" @@ -655,7 +655,7 @@ class URLRequestTest : public PlatformTest { } protected: - CapturingNetLog net_log_; + TestNetLog net_log_; TestNetworkDelegate default_network_delegate_; // Must outlive URLRequest. URLRequestJobFactoryImpl* job_factory_impl_; scoped_ptr<URLRequestJobFactory> job_factory_; @@ -4163,8 +4163,8 @@ class AsyncDelegateLogger : public base::RefCounted<AsyncDelegateLogger> { // 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 CapturingNetLog::CapturedEntryList& entries, size_t log_position) { + static size_t CheckDelegateInfo(const TestNetLog::CapturedEntryList& entries, + size_t log_position) { // There should be 4 DELEGATE_INFO events: Two begins and two ends. if (log_position + 3 >= entries.size()) { ADD_FAILURE() << "Not enough log entries"; @@ -4198,7 +4198,7 @@ class AsyncDelegateLogger : public base::RefCounted<AsyncDelegateLogger> { // Find delegate request begin and end messages for OnBeforeNetworkStart. // Returns the position of the end message. static size_t ExpectBeforeNetworkEvents( - const CapturingNetLog::CapturedEntryList& entries, + const TestNetLog::CapturedEntryList& entries, size_t log_position) { log_position = ExpectLogContainsSomewhereAfter(entries, @@ -4465,7 +4465,7 @@ TEST_F(URLRequestTestHTTP, DelegateInfoBeforeStart) { EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status()); } - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; net_log_.GetEntries(&entries); size_t log_position = ExpectLogContainsSomewhereAfter( entries, @@ -4510,7 +4510,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateInfo) { EXPECT_EQ(1, network_delegate.destroyed_requests()); size_t log_position = 0; - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; net_log_.GetEntries(&entries); for (size_t i = 0; i < 3; ++i) { log_position = ExpectLogContainsSomewhereAfter( @@ -4567,7 +4567,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateInfoRedirect) { EXPECT_EQ(1, network_delegate.destroyed_requests()); size_t log_position = 0; - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; net_log_.GetEntries(&entries); // The NetworkDelegate logged information in OnBeforeURLRequest, // OnBeforeSendHeaders, and OnHeadersReceived. @@ -4649,7 +4649,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateInfoAuth) { EXPECT_EQ(1, network_delegate.destroyed_requests()); size_t log_position = 0; - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; net_log_.GetEntries(&entries); // The NetworkDelegate should have logged information in OnBeforeURLRequest, // OnBeforeSendHeaders, OnHeadersReceived, OnAuthRequired, and then again in @@ -4706,7 +4706,7 @@ TEST_F(URLRequestTestHTTP, URLRequestDelegateInfo) { EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status()); } - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; net_log_.GetEntries(&entries); size_t log_position = 0; @@ -4759,7 +4759,7 @@ TEST_F(URLRequestTestHTTP, URLRequestDelegateInfoOnRedirect) { EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status()); } - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; net_log_.GetEntries(&entries); // Delegate info should only have been logged in OnReceivedRedirect and @@ -4806,7 +4806,7 @@ TEST_F(URLRequestTestHTTP, URLRequestDelegateOnRedirectCancelled) { ++test_case) { AsyncLoggingUrlRequestDelegate request_delegate(kCancelStages[test_case]); TestURLRequestContext context(true); - CapturingNetLog net_log; + TestNetLog net_log; context.set_network_delegate(NULL); context.set_net_log(&net_log); context.Init(); @@ -4821,7 +4821,7 @@ TEST_F(URLRequestTestHTTP, URLRequestDelegateOnRedirectCancelled) { EXPECT_EQ(URLRequestStatus::CANCELED, r->status().status()); } - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; net_log.GetEntries(&entries); // Delegate info is always logged in both OnReceivedRedirect and @@ -7265,7 +7265,7 @@ TEST_F(HTTPSRequestTest, HTTPSExpiredTest) { // Tests that servers which require a deprecated cipher suite still work. TEST_F(HTTPSRequestTest, CipherFallbackTest) { - CapturingNetLog net_log; + TestNetLog net_log; default_context_.set_net_log(&net_log); SpawnedTestServer::SSLOptions ssl_options; @@ -7301,7 +7301,7 @@ TEST_F(HTTPSRequestTest, CipherFallbackTest) { EXPECT_EQ(expected_version, SSLConnectionStatusToVersion(r->ssl_info().connection_status)); - CapturingNetLog::CapturedEntryList entries; + TestNetLog::CapturedEntryList entries; net_log.GetEntries(&entries); ExpectLogContainsSomewhere(entries, 0, NetLog::TYPE_SSL_CIPHER_FALLBACK, NetLog::PHASE_NONE); diff --git a/net/websockets/websocket_basic_stream_test.cc b/net/websockets/websocket_basic_stream_test.cc index aca04b0..69aab3c 100644 --- a/net/websockets/websocket_basic_stream_test.cc +++ b/net/websockets/websocket_basic_stream_test.cc @@ -16,7 +16,7 @@ #include "base/big_endian.h" #include "base/port.h" #include "net/base/test_completion_callback.h" -#include "net/log/capturing_net_log.h" +#include "net/log/test_net_log.h" #include "net/socket/socket_test_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -75,7 +75,7 @@ WebSocketMaskingKey GenerateNonNulMaskingKey() { return kNonNulMaskingKey; } class WebSocketBasicStreamTest : public ::testing::Test { protected: scoped_ptr<WebSocketBasicStream> stream_; - CapturingNetLog net_log_; + TestNetLog net_log_; }; // A subclass of StaticSocketDataProvider modified to require that all data @@ -164,7 +164,7 @@ class WebSocketBasicStreamSocketTest : public WebSocketBasicStreamTest { scoped_ptr<SocketDataProvider> socket_data_; MockClientSocketFactory factory_; MockTransportClientSocketPool pool_; - CapturingBoundNetLog(bound_net_log_); + BoundTestNetLog(bound_net_log_); ScopedVector<WebSocketFrame> frames_; TestCompletionCallback cb_; scoped_refptr<GrowableIOBuffer> http_read_buffer_; |