diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-03 21:48:34 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-03 21:48:34 +0000 |
commit | 9e1bdd3f9785ed8a84a137c98b781ddaec41b080 (patch) | |
tree | 36d3550cc6d9db08bf3a18fbb42668d440a94b56 /chrome_frame | |
parent | 966c57777b2c18313cddd8e36d109665f5377521 (diff) | |
download | chromium_src-9e1bdd3f9785ed8a84a137c98b781ddaec41b080.zip chromium_src-9e1bdd3f9785ed8a84a137c98b781ddaec41b080.tar.gz chromium_src-9e1bdd3f9785ed8a84a137c98b781ddaec41b080.tar.bz2 |
Refactor HttpNetworkSession construction.
Introduce HttpNetworkSession::Params. This should make it easy to add new optionally NULL parameters. I also took this opportunity to eliminate some copy/pastes of TestURLRequestContext and make them use the original. I was also able to remove the need for ClientSocketFactory::GetDefaultFactory() calls and new SpdySessionPool() calls in most places.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6349028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73669 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r-- | chrome_frame/metrics_service.cc | 23 | ||||
-rw-r--r-- | chrome_frame/test/test_server_test.cc | 42 |
2 files changed, 9 insertions, 56 deletions
diff --git a/chrome_frame/metrics_service.cc b/chrome_frame/metrics_service.cc index deb5f20..706b591 100644 --- a/chrome_frame/metrics_service.cc +++ b/chrome_frame/metrics_service.cc @@ -80,8 +80,6 @@ #include "net/http/http_auth_handler_factory.h" #include "net/http/http_cache.h" #include "net/http/http_network_session.h" -#include "net/socket/client_socket_factory.h" -#include "net/spdy/spdy_session_pool.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_status.h" @@ -180,20 +178,15 @@ class ChromeFrameUploadRequestContext : public net::URLRequestContext { supported_schemes, url_security_manager_.get(), host_resolver_, std::string(), false, false); + net::HttpNetworkSession::Params session_params; + session_params.host_resolver = host_resolver_; + session_params.cert_verifier = cert_verifier_; + session_params.proxy_service = proxy_service_; + session_params.http_auth_handler_factory = + http_auth_handler_factory_; + session_params.ssl_config_service = ssl_config_service_; scoped_refptr<net::HttpNetworkSession> network_session = - new net::HttpNetworkSession( - host_resolver_, - cert_verifier_, - NULL /* dnsrr_resolver */, - NULL /* dns_cert_checker*/, - NULL /* ssl_host_info_factory */, - proxy_service_, - net::ClientSocketFactory::GetDefaultFactory(), - ssl_config_service_, - new net::SpdySessionPool(ssl_config_service_), - http_auth_handler_factory_, - network_delegate_, - NULL); + new net::HttpNetworkSession(session_params); http_transaction_factory_ = new net::HttpCache( network_session, diff --git a/chrome_frame/test/test_server_test.cc b/chrome_frame/test/test_server_test.cc index d45222d..e358e99 100644 --- a/chrome_frame/test/test_server_test.cc +++ b/chrome_frame/test/test_server_test.cc @@ -16,8 +16,6 @@ #include "net/http/http_cache.h" #include "net/http/http_network_session.h" #include "net/proxy/proxy_service.h" -#include "net/socket/client_socket_factory.h" -#include "net/spdy/spdy_session_pool.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_test_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -61,49 +59,11 @@ class ScopedInternet { HINTERNET h_; }; -class URLRequestTestContext : public net::URLRequestContext { - public: - URLRequestTestContext() { - host_resolver_ = - net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, - NULL, NULL); - cert_verifier_ = new net::CertVerifier; - proxy_service_ = net::ProxyService::CreateDirect(); - ssl_config_service_ = new net::SSLConfigServiceDefaults; - http_auth_handler_factory_ = net::HttpAuthHandlerFactory::CreateDefault( - host_resolver_); - http_transaction_factory_ = new net::HttpCache( - new net::HttpNetworkSession( - host_resolver_, - cert_verifier_, - NULL /* dnsrr_resolver */, - NULL /* dns_cert_checker */, - NULL /* ssl_host_info_factory */, - proxy_service_, - net::ClientSocketFactory::GetDefaultFactory(), - ssl_config_service_, - new net::SpdySessionPool(ssl_config_service_), - http_auth_handler_factory_, - NULL /* network_delegate */, - NULL /* net_log */), - net::HttpCache::DefaultBackend::InMemory(0)); - // In-memory cookie store. - cookie_store_ = new net::CookieMonster(NULL, NULL); - } - - virtual ~URLRequestTestContext() { - delete http_transaction_factory_; - delete http_auth_handler_factory_; - delete cert_verifier_; - delete host_resolver_; - } -}; - class TestURLRequest : public net::URLRequest { public: TestURLRequest(const GURL& url, Delegate* delegate) : net::URLRequest(url, delegate) { - set_context(new URLRequestTestContext()); + set_context(new TestURLRequestContext()); } }; |