summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/io_thread.cc28
-rw-r--r--chrome/browser/io_thread.h2
-rw-r--r--chrome/browser/net/chrome_url_request_context.cc6
-rw-r--r--chrome/browser/net/connection_tester.cc24
-rw-r--r--chrome/browser/net/connection_tester_unittest.cc25
-rw-r--r--chrome/service/net/service_url_request_context.cc22
-rw-r--r--chrome/test/plugin/plugin_test.cpp73
-rw-r--r--chrome_frame/metrics_service.cc23
-rw-r--r--chrome_frame/test/test_server_test.cc42
-rw-r--r--net/http/disk_cache_based_ssl_host_info.cc4
-rw-r--r--net/http/disk_cache_based_ssl_host_info.h1
-rw-r--r--net/http/http_cache.cc56
-rw-r--r--net/http/http_cache.h4
-rw-r--r--net/http/http_network_layer.cc2
-rw-r--r--net/http/http_network_layer_unittest.cc101
-rw-r--r--net/http/http_network_session.cc60
-rw-r--r--net/http/http_network_session.h80
-rw-r--r--net/http/http_network_transaction.cc17
-rw-r--r--net/http/http_network_transaction.h2
-rw-r--r--net/http/http_network_transaction_unittest.cc67
-rw-r--r--net/http/http_proxy_client_socket_pool_unittest.cc45
-rw-r--r--net/http/http_response_body_drainer_unittest.cc27
-rw-r--r--net/http/http_stream_factory_unittest.cc71
-rw-r--r--net/proxy/proxy_script_fetcher_impl_unittest.cc21
-rw-r--r--net/socket/ssl_client_socket_pool_unittest.cc43
-rw-r--r--net/spdy/spdy_http_utils.cc14
-rw-r--r--net/spdy/spdy_http_utils.h3
-rw-r--r--net/spdy/spdy_network_transaction_unittest.cc3
-rw-r--r--net/spdy/spdy_proxy_client_socket_unittest.cc1
-rw-r--r--net/spdy/spdy_session.cc2
-rw-r--r--net/spdy/spdy_session_pool.cc6
-rw-r--r--net/spdy/spdy_session_pool.h2
-rw-r--r--net/spdy/spdy_session_unittest.cc1
-rw-r--r--net/spdy/spdy_stream_unittest.cc1
-rw-r--r--net/spdy/spdy_test_util.cc69
-rw-r--r--net/spdy/spdy_test_util.h1
-rw-r--r--net/tools/fetch/fetch_client.cc24
-rw-r--r--net/url_request/url_request_test_util.cc24
38 files changed, 407 insertions, 590 deletions
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index 127f53e..700ff2c 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -43,8 +43,6 @@
#include "net/ocsp/nss_ocsp.h"
#endif // defined(USE_NSS)
#include "net/proxy/proxy_script_fetcher_impl.h"
-#include "net/socket/client_socket_factory.h"
-#include "net/spdy/spdy_session_pool.h"
namespace {
@@ -321,8 +319,6 @@ void IOThread::Init() {
network_change_observer_.reset(
new LoggingNetworkChangeObserver(net_log_));
- globals_->client_socket_factory =
- net::ClientSocketFactory::GetDefaultFactory();
globals_->host_resolver.reset(
CreateGlobalHostResolver(net_log_));
globals_->cert_verifier.reset(new net::CertVerifier);
@@ -335,20 +331,18 @@ void IOThread::Init() {
// For the ProxyScriptFetcher, we use a direct ProxyService.
globals_->proxy_script_fetcher_proxy_service =
net::ProxyService::CreateDirectWithNetLog(net_log_);
+ net::HttpNetworkSession::Params session_params;
+ session_params.host_resolver = globals_->host_resolver.get();
+ session_params.cert_verifier = globals_->cert_verifier.get();
+ session_params.proxy_service =
+ globals_->proxy_script_fetcher_proxy_service.get();
+ session_params.http_auth_handler_factory =
+ globals_->http_auth_handler_factory.get();
+ session_params.network_delegate = &globals_->network_delegate;
+ session_params.net_log = net_log_;
+ session_params.ssl_config_service = globals_->ssl_config_service;
scoped_refptr<net::HttpNetworkSession> network_session(
- new net::HttpNetworkSession(
- globals_->host_resolver.get(),
- globals_->cert_verifier.get(),
- globals_->dnsrr_resolver.get(),
- NULL /* dns_cert_checker */,
- NULL /* ssl_host_info_factory */,
- globals_->proxy_script_fetcher_proxy_service.get(),
- globals_->client_socket_factory,
- globals_->ssl_config_service.get(),
- new net::SpdySessionPool(globals_->ssl_config_service.get()),
- globals_->http_auth_handler_factory.get(),
- &globals_->network_delegate,
- net_log_));
+ new net::HttpNetworkSession(session_params));
globals_->proxy_script_fetcher_http_transaction_factory.reset(
new net::HttpNetworkLayer(network_session));
diff --git a/chrome/browser/io_thread.h b/chrome/browser/io_thread.h
index 5730bb9..06a3f67 100644
--- a/chrome/browser/io_thread.h
+++ b/chrome/browser/io_thread.h
@@ -28,7 +28,6 @@ class Predictor;
namespace net {
class CertVerifier;
-class ClientSocketFactory;
class DnsRRResolver;
class HostResolver;
class HttpAuthHandlerFactory;
@@ -46,7 +45,6 @@ class IOThread : public BrowserProcessSubThread {
Globals();
~Globals();
- net::ClientSocketFactory* client_socket_factory;
scoped_ptr<net::HostResolver> host_resolver;
scoped_ptr<net::CertVerifier> cert_verifier;
scoped_ptr<net::DnsRRResolver> dnsrr_resolver;
diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc
index 6eda235..e42ae2d 100644
--- a/chrome/browser/net/chrome_url_request_context.cc
+++ b/chrome/browser/net/chrome_url_request_context.cc
@@ -422,13 +422,13 @@ scoped_refptr<ChromeURLRequestContext> FactoryForOffTheRecord::Create() {
net::HttpCache::DefaultBackend::InMemory(0);
net::HttpCache* cache =
- new net::HttpCache(context->host_resolver(),
- context->cert_verifier(),
+ new net::HttpCache(io_thread_globals->host_resolver.get(),
+ io_thread_globals->cert_verifier.get(),
context->dnsrr_resolver(),
NULL /* dns_cert_checker */,
context->proxy_service(),
context->ssl_config_service(),
- context->http_auth_handler_factory(),
+ io_thread_globals->http_auth_handler_factory.get(),
&io_thread_globals->network_delegate,
io_thread()->net_log(),
backend);
diff --git a/chrome/browser/net/connection_tester.cc b/chrome/browser/net/connection_tester.cc
index 67aea97..d0a7c95 100644
--- a/chrome/browser/net/connection_tester.cc
+++ b/chrome/browser/net/connection_tester.cc
@@ -29,8 +29,6 @@
#include "net/http/http_network_session.h"
#include "net/proxy/proxy_config_service_fixed.h"
#include "net/proxy/proxy_script_fetcher_impl.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_context.h"
@@ -70,20 +68,16 @@ class ExperimentURLRequestContext : public net::URLRequestContext {
ssl_config_service_ = new net::SSLConfigServiceDefaults;
http_auth_handler_factory_ = net::HttpAuthHandlerFactory::CreateDefault(
host_resolver_);
+
+ net::HttpNetworkSession::Params session_params;
+ session_params.host_resolver = host_resolver_;
+ session_params.dnsrr_resolver = dnsrr_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_,
- dnsrr_resolver_,
- NULL /* dns_cert_checker */,
- NULL /* ssl_host_info_factory */,
- proxy_service_,
- net::ClientSocketFactory::GetDefaultFactory(),
- ssl_config_service_,
- new net::SpdySessionPool(NULL),
- http_auth_handler_factory_,
- NULL /* network_delegate */,
- NULL /* net_log */));
+ new net::HttpNetworkSession(session_params));
http_transaction_factory_ = new net::HttpCache(
network_session,
net::HttpCache::DefaultBackend::InMemory(0));
diff --git a/chrome/browser/net/connection_tester_unittest.cc b/chrome/browser/net/connection_tester_unittest.cc
index f08daf4..0bb5f50 100644
--- a/chrome/browser/net/connection_tester_unittest.cc
+++ b/chrome/browser/net/connection_tester_unittest.cc
@@ -16,8 +16,6 @@
#include "net/http/http_network_layer.h"
#include "net/http/http_network_session.h"
#include "net/proxy/proxy_config_service_fixed.h"
-#include "net/socket/client_socket_factory.h"
-#include "net/spdy/spdy_session_pool.h"
#include "net/test/test_server.h"
#include "net/url_request/url_request_context.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -88,7 +86,6 @@ class ConnectionTesterTest : public PlatformTest {
ConnectionTesterTest()
: test_server_(net::TestServer::TYPE_HTTP,
FilePath(FILE_PATH_LITERAL("net/data/url_request_unittest"))),
- client_socket_factory_(net::ClientSocketFactory::GetDefaultFactory()),
proxy_script_fetcher_context_(new net::URLRequestContext),
message_loop_(MessageLoop::TYPE_IO),
io_thread_(BrowserThread::IO, &message_loop_) {
@@ -98,7 +95,6 @@ class ConnectionTesterTest : public PlatformTest {
protected:
net::TestServer test_server_;
ConnectionTesterDelegate test_delegate_;
- net::ClientSocketFactory* const client_socket_factory_;
net::MockHostResolver host_resolver_;
net::CertVerifier cert_verifier_;
net::DnsRRResolver dnsrr_resolver_;
@@ -118,20 +114,15 @@ class ConnectionTesterTest : public PlatformTest {
proxy_service_ = net::ProxyService::CreateDirect();
proxy_script_fetcher_context_->set_proxy_service(proxy_service_);
ssl_config_service_ = net::SSLConfigService::CreateSystemSSLConfigService();
+ net::HttpNetworkSession::Params session_params;
+ session_params.host_resolver = &host_resolver_;
+ session_params.cert_verifier = &cert_verifier_;
+ session_params.dnsrr_resolver = &dnsrr_resolver_;
+ session_params.http_auth_handler_factory = &http_auth_handler_factory_;
+ session_params.ssl_config_service = ssl_config_service_;
+ session_params.proxy_service = proxy_service_;
scoped_refptr<net::HttpNetworkSession> network_session(
- new net::HttpNetworkSession(
- &host_resolver_,
- &cert_verifier_,
- &dnsrr_resolver_,
- NULL /* dns_cert_checker */,
- NULL /* ssl_host_info_factory */,
- proxy_service_.get(),
- client_socket_factory_,
- ssl_config_service_,
- new net::SpdySessionPool(ssl_config_service_),
- &http_auth_handler_factory_,
- NULL /* network_delegate */,
- NULL /* net_log */));
+ new net::HttpNetworkSession(session_params));
http_transaction_factory_.reset(
new net::HttpNetworkLayer(network_session));
proxy_script_fetcher_context_->set_http_transaction_factory(
diff --git a/chrome/service/net/service_url_request_context.cc b/chrome/service/net/service_url_request_context.cc
index 41a9f35..e5d75cc 100644
--- a/chrome/service/net/service_url_request_context.cc
+++ b/chrome/service/net/service_url_request_context.cc
@@ -23,8 +23,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/proxy/proxy_service.h"
namespace {
@@ -126,20 +124,14 @@ ServiceURLRequestContext::ServiceURLRequestContext(
ssl_config_service_ = new net::SSLConfigServiceDefaults;
http_auth_handler_factory_ = net::HttpAuthHandlerFactory::CreateDefault(
host_resolver_);
+ net::HttpNetworkSession::Params session_params;
+ session_params.host_resolver = host_resolver_;
+ session_params.cert_verifier = cert_verifier_;
+ session_params.dnsrr_resolver = dnsrr_resolver_;
+ session_params.proxy_service = proxy_service_;
+ session_params.ssl_config_service = ssl_config_service_;
scoped_refptr<net::HttpNetworkSession> network_session(
- new net::HttpNetworkSession(
- host_resolver_,
- cert_verifier_,
- dnsrr_resolver_,
- NULL /* dns_cert_checker */,
- NULL /* ssl_host_info_factory */,
- proxy_service_,
- net::ClientSocketFactory::GetDefaultFactory(),
- ssl_config_service_,
- new net::SpdySessionPool(NULL),
- http_auth_handler_factory_,
- NULL /* network_delegate */,
- NULL /* net_log */));
+ new net::HttpNetworkSession(session_params));
http_transaction_factory_ = new net::HttpCache(
network_session,
net::HttpCache::DefaultBackend::InMemory(0));
diff --git a/chrome/test/plugin/plugin_test.cpp b/chrome/test/plugin/plugin_test.cpp
index 34a9de3a..bbeb862 100644
--- a/chrome/test/plugin/plugin_test.cpp
+++ b/chrome/test/plugin/plugin_test.cpp
@@ -38,18 +38,7 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/test/automation/tab_proxy.h"
#include "chrome/test/ui/ui_test.h"
-#include "net/base/capturing_net_log.h"
-#include "net/base/cert_verifier.h"
-#include "net/base/host_resolver.h"
-#include "net/base/net_util.h"
-#include "net/base/ssl_config_service_defaults.h"
-#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"
+#include "net/url_request/url_request_test_util.h"
#include "third_party/npapi/bindings/npapi.h"
#include "webkit/plugins/npapi/plugin_constants_win.h"
#include "webkit/plugins/npapi/plugin_list.h"
@@ -252,64 +241,6 @@ class PluginInstallerDownloadTest
: public PluginDownloadUrlHelper::DownloadDelegate,
public testing::Test {
public:
- // This class provides HTTP request context information for the downloads.
- class UploadRequestContext : public net::URLRequestContext {
- public:
- UploadRequestContext() {
- Initialize();
- }
-
- ~UploadRequestContext() {
- DVLOG(1) << __FUNCTION__;
- delete http_transaction_factory_;
- delete http_auth_handler_factory_;
- delete cert_verifier_;
- delete host_resolver_;
- }
-
- void Initialize() {
- host_resolver_ =
- net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism,
- NULL, NULL);
- cert_verifier_ = new net::CertVerifier;
- net::ProxyConfigService* proxy_config_service =
- net::ProxyService::CreateSystemProxyConfigService(NULL, NULL);
- DCHECK(proxy_config_service);
-
- const size_t kNetLogBound = 50u;
- net_log_.reset(new net::CapturingNetLog(kNetLogBound));
-
- proxy_service_ = net::ProxyService::CreateUsingSystemProxyResolver(
- proxy_config_service, 0, net_log_.get());
- DCHECK(proxy_service_);
-
- ssl_config_service_ = new net::SSLConfigServiceDefaults;
- http_auth_handler_factory_ = net::HttpAuthHandlerFactory::CreateDefault(
- host_resolver_);
- 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(NULL),
- http_auth_handler_factory_,
- network_delegate_,
- NULL /* net_log */));
- http_transaction_factory_ = new net::HttpCache(
- network_session,
- net::HttpCache::DefaultBackend::InMemory(0));
- }
-
- private:
- scoped_ptr<net::NetLog> net_log_;
- scoped_ptr<net::URLSecurityManager> url_security_manager_;
- };
-
PluginInstallerDownloadTest()
: success_(false),
download_helper_(NULL) {}
@@ -320,7 +251,7 @@ class PluginInstallerDownloadTest
download_helper_ = new PluginDownloadUrlHelper(
initial_download_path_.spec(), base::GetCurrentProcId(), NULL,
static_cast<PluginDownloadUrlHelper::DownloadDelegate*>(this));
- download_helper_->InitiateDownload(new UploadRequestContext);
+ download_helper_->InitiateDownload(new TestURLRequestContext);
MessageLoop::current()->PostDelayedTask(
FROM_HERE, new MessageLoop::QuitTask,
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());
}
};
diff --git a/net/http/disk_cache_based_ssl_host_info.cc b/net/http/disk_cache_based_ssl_host_info.cc
index 1a875cb..15a77be 100644
--- a/net/http/disk_cache_based_ssl_host_info.cc
+++ b/net/http/disk_cache_based_ssl_host_info.cc
@@ -34,9 +34,9 @@ void DiskCacheBasedSSLHostInfo::CallbackImpl::RunWithParams(
DiskCacheBasedSSLHostInfo::DiskCacheBasedSSLHostInfo(
const std::string& hostname,
const SSLConfig& ssl_config,
+ CertVerifier* cert_verifier,
HttpCache* http_cache)
- : SSLHostInfo(hostname, ssl_config,
- http_cache->network_layer()->GetSession()->cert_verifier()),
+ : SSLHostInfo(hostname, ssl_config, cert_verifier),
weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
callback_(new CallbackImpl(weak_ptr_factory_.GetWeakPtr(),
&DiskCacheBasedSSLHostInfo::DoLoop)),
diff --git a/net/http/disk_cache_based_ssl_host_info.h b/net/http/disk_cache_based_ssl_host_info.h
index 9d04ba0..359397df 100644
--- a/net/http/disk_cache_based_ssl_host_info.h
+++ b/net/http/disk_cache_based_ssl_host_info.h
@@ -28,6 +28,7 @@ class DiskCacheBasedSSLHostInfo : public SSLHostInfo,
public:
DiskCacheBasedSSLHostInfo(const std::string& hostname,
const SSLConfig& ssl_config,
+ CertVerifier* cert_verifier,
HttpCache* http_cache);
// Implementation of SSLHostInfo
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc
index 1690e55..7c35f69 100644
--- a/net/http/http_cache.cc
+++ b/net/http/http_cache.cc
@@ -33,12 +33,39 @@
#include "net/http/http_response_headers.h"
#include "net/http/http_response_info.h"
#include "net/http/http_util.h"
-#include "net/socket/client_socket_factory.h"
#include "net/socket/ssl_host_info.h"
-#include "net/spdy/spdy_session_pool.h"
namespace net {
+namespace {
+
+HttpNetworkSession* CreateNetworkSession(
+ HostResolver* host_resolver,
+ CertVerifier* cert_verifier,
+ DnsRRResolver* dnsrr_resolver,
+ DnsCertProvenanceChecker* dns_cert_checker,
+ ProxyService* proxy_service,
+ SSLHostInfoFactory* ssl_host_info_factory,
+ SSLConfigService* ssl_config_service,
+ HttpAuthHandlerFactory* http_auth_handler_factory,
+ HttpNetworkDelegate* network_delegate,
+ NetLog* net_log) {
+ HttpNetworkSession::Params params;
+ params.host_resolver = host_resolver;
+ params.cert_verifier = cert_verifier;
+ params.dnsrr_resolver = dnsrr_resolver;
+ params.dns_cert_checker = dns_cert_checker;
+ params.proxy_service = proxy_service;
+ params.ssl_host_info_factory = ssl_host_info_factory;
+ params.ssl_config_service = ssl_config_service;
+ params.http_auth_handler_factory = http_auth_handler_factory;
+ params.network_delegate = network_delegate;
+ params.net_log = net_log;
+ return new HttpNetworkSession(params);
+}
+
+} // namespace
+
HttpCache::DefaultBackend::DefaultBackend(CacheType type,
const FilePath& path,
int max_bytes,
@@ -265,16 +292,19 @@ void HttpCache::MetadataWriter::OnIOComplete(int result) {
class HttpCache::SSLHostInfoFactoryAdaptor : public SSLHostInfoFactory {
public:
- explicit SSLHostInfoFactoryAdaptor(HttpCache* http_cache)
- : http_cache_(http_cache) {
+ SSLHostInfoFactoryAdaptor(CertVerifier* cert_verifier, HttpCache* http_cache)
+ : cert_verifier_(cert_verifier),
+ http_cache_(http_cache) {
}
- SSLHostInfo* GetForHost(const std::string& hostname,
- const SSLConfig& ssl_config) {
- return new DiskCacheBasedSSLHostInfo(hostname, ssl_config, http_cache_);
+ virtual SSLHostInfo* GetForHost(const std::string& hostname,
+ const SSLConfig& ssl_config) {
+ return new DiskCacheBasedSSLHostInfo(
+ hostname, ssl_config, cert_verifier_, http_cache_);
}
private:
+ CertVerifier* const cert_verifier_;
HttpCache* const http_cache_;
};
@@ -294,19 +324,18 @@ HttpCache::HttpCache(HostResolver* host_resolver,
building_backend_(false),
mode_(NORMAL),
ssl_host_info_factory_(new SSLHostInfoFactoryAdaptor(
- ALLOW_THIS_IN_INITIALIZER_LIST(this))),
+ cert_verifier,
+ ALLOW_THIS_IN_INITIALIZER_LIST(this))),
network_layer_(
new HttpNetworkLayer(
- new HttpNetworkSession(
+ CreateNetworkSession(
host_resolver,
cert_verifier,
dnsrr_resolver,
dns_cert_checker_,
- ssl_host_info_factory_.get(),
proxy_service,
- ClientSocketFactory::GetDefaultFactory(),
+ ssl_host_info_factory_.get(),
ssl_config_service,
- new SpdySessionPool(ssl_config_service),
http_auth_handler_factory,
network_delegate,
net_log))),
@@ -321,7 +350,8 @@ HttpCache::HttpCache(HttpNetworkSession* session,
building_backend_(false),
mode_(NORMAL),
ssl_host_info_factory_(new SSLHostInfoFactoryAdaptor(
- ALLOW_THIS_IN_INITIALIZER_LIST(this))),
+ session->cert_verifier(),
+ ALLOW_THIS_IN_INITIALIZER_LIST(this))),
network_layer_(new HttpNetworkLayer(session)),
ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) {
}
diff --git a/net/http/http_cache.h b/net/http/http_cache.h
index 563ed17..cdbddfe 100644
--- a/net/http/http_cache.h
+++ b/net/http/http_cache.h
@@ -356,9 +356,9 @@ class HttpCache : public HttpTransactionFactory,
Mode mode_;
- scoped_ptr<SSLHostInfoFactoryAdaptor> ssl_host_info_factory_;
+ const scoped_ptr<SSLHostInfoFactoryAdaptor> ssl_host_info_factory_;
- scoped_ptr<HttpTransactionFactory> network_layer_;
+ const scoped_ptr<HttpTransactionFactory> network_layer_;
scoped_ptr<disk_cache::Backend> disk_cache_;
// The set of active entries indexed by cache key.
diff --git a/net/http/http_network_layer.cc b/net/http/http_network_layer.cc
index 293f8ec..73e6f8d 100644
--- a/net/http/http_network_layer.cc
+++ b/net/http/http_network_layer.cc
@@ -10,10 +10,8 @@
#include "base/string_util.h"
#include "net/http/http_network_session.h"
#include "net/http/http_network_transaction.h"
-#include "net/socket/client_socket_factory.h"
#include "net/spdy/spdy_framer.h"
#include "net/spdy/spdy_session.h"
-#include "net/spdy/spdy_session_pool.h"
namespace net {
diff --git a/net/http/http_network_layer_unittest.cc b/net/http/http_network_layer_unittest.cc
index f76ffbb..5120fac 100644
--- a/net/http/http_network_layer_unittest.cc
+++ b/net/http/http_network_layer_unittest.cc
@@ -20,76 +20,57 @@ namespace net {
namespace {
class HttpNetworkLayerTest : public PlatformTest {
+ protected:
+ HttpNetworkLayerTest()
+ : proxy_service_(ProxyService::CreateDirect()),
+ ssl_config_service_(new SSLConfigServiceDefaults) {
+ HttpNetworkSession::Params session_params;
+ session_params.client_socket_factory = &mock_socket_factory_;
+ session_params.host_resolver = &host_resolver_;
+ session_params.cert_verifier = &cert_verifier_;
+ session_params.proxy_service = proxy_service_;
+ session_params.ssl_config_service = ssl_config_service_;
+ network_session_ = new HttpNetworkSession(session_params);
+ factory_.reset(new HttpNetworkLayer(network_session_));
+ }
+
+ MockClientSocketFactory mock_socket_factory_;
+ MockHostResolver host_resolver_;
+ CertVerifier cert_verifier_;
+ const scoped_refptr<ProxyService> proxy_service_;
+ const scoped_refptr<SSLConfigService> ssl_config_service_;
+ scoped_refptr<HttpNetworkSession> network_session_;
+ scoped_ptr<HttpNetworkLayer> factory_;
};
TEST_F(HttpNetworkLayerTest, CreateAndDestroy) {
- MockClientSocketFactory mock_socket_factory;
- MockHostResolver host_resolver;
- CertVerifier cert_verifier;
- scoped_refptr<HttpNetworkSession> network_session(
- new HttpNetworkSession(
- &host_resolver,
- &cert_verifier,
- NULL /* dnsrr_resolver */,
- NULL /* dns_cert_checker */,
- NULL /* ssl_host_info_factory */,
- ProxyService::CreateDirect(),
- &mock_socket_factory,
- new SSLConfigServiceDefaults,
- new SpdySessionPool(NULL),
- NULL,
- NULL,
- NULL));
-
- HttpNetworkLayer factory(network_session);
-
scoped_ptr<HttpTransaction> trans;
- int rv = factory.CreateTransaction(&trans);
+ int rv = factory_->CreateTransaction(&trans);
EXPECT_EQ(OK, rv);
EXPECT_TRUE(trans.get() != NULL);
}
TEST_F(HttpNetworkLayerTest, Suspend) {
- MockClientSocketFactory mock_socket_factory;
- MockHostResolver host_resolver;
- CertVerifier cert_verifier;
- scoped_refptr<HttpNetworkSession> network_session(
- new HttpNetworkSession(
- &host_resolver,
- &cert_verifier,
- NULL /* dnsrr_resolver */,
- NULL /* dns_cert_checker */,
- NULL /* ssl_host_info_factory */,
- ProxyService::CreateDirect(),
- &mock_socket_factory,
- new SSLConfigServiceDefaults,
- new SpdySessionPool(NULL),
- NULL,
- NULL,
- NULL));
- HttpNetworkLayer factory(network_session);
-
scoped_ptr<HttpTransaction> trans;
- int rv = factory.CreateTransaction(&trans);
+ int rv = factory_->CreateTransaction(&trans);
EXPECT_EQ(OK, rv);
trans.reset();
- factory.Suspend(true);
+ factory_->Suspend(true);
- rv = factory.CreateTransaction(&trans);
+ rv = factory_->CreateTransaction(&trans);
EXPECT_EQ(ERR_NETWORK_IO_SUSPENDED, rv);
ASSERT_TRUE(trans == NULL);
- factory.Suspend(false);
+ factory_->Suspend(false);
- rv = factory.CreateTransaction(&trans);
+ rv = factory_->CreateTransaction(&trans);
EXPECT_EQ(OK, rv);
}
TEST_F(HttpNetworkLayerTest, GET) {
- MockClientSocketFactory mock_socket_factory;
MockRead data_reads[] = {
MockRead("HTTP/1.0 200 OK\r\n\r\n"),
MockRead("hello world"),
@@ -103,32 +84,10 @@ TEST_F(HttpNetworkLayerTest, GET) {
};
StaticSocketDataProvider data(data_reads, arraysize(data_reads),
data_writes, arraysize(data_writes));
- mock_socket_factory.AddSocketDataProvider(&data);
-
- MockHostResolver host_resolver;
- CertVerifier cert_verifier;
- scoped_refptr<HttpNetworkSession> network_session(
- new HttpNetworkSession(
- &host_resolver,
- &cert_verifier,
- NULL /* dnsrr_resolver */,
- NULL /* dns_cert_checker */,
- NULL /* ssl_host_info_factory */,
- ProxyService::CreateDirect(),
- &mock_socket_factory,
- new SSLConfigServiceDefaults,
- new SpdySessionPool(NULL),
- NULL,
- NULL,
- NULL));
- HttpNetworkLayer factory(network_session);
+ mock_socket_factory_.AddSocketDataProvider(&data);
TestCompletionCallback callback;
- scoped_ptr<HttpTransaction> trans;
- int rv = factory.CreateTransaction(&trans);
- EXPECT_EQ(OK, rv);
-
HttpRequestInfo request_info;
request_info.url = GURL("http://www.google.com/");
request_info.method = "GET";
@@ -136,6 +95,10 @@ TEST_F(HttpNetworkLayerTest, GET) {
"Foo/1.0");
request_info.load_flags = LOAD_NORMAL;
+ scoped_ptr<HttpTransaction> trans;
+ int rv = factory_->CreateTransaction(&trans);
+ EXPECT_EQ(OK, rv);
+
rv = trans->Start(&request_info, &callback, BoundNetLog());
if (rv == ERR_IO_PENDING)
rv = callback.WaitForResult();
diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc
index e3de475..a1b3c61 100644
--- a/net/http/http_network_session.cc
+++ b/net/http/http_network_session.cc
@@ -13,51 +13,37 @@
#include "net/http/http_auth_handler_factory.h"
#include "net/http/http_response_body_drainer.h"
#include "net/http/url_security_manager.h"
+#include "net/socket/client_socket_factory.h"
#include "net/spdy/spdy_session_pool.h"
namespace net {
// TODO(mbelshe): Move the socket factories into HttpStreamFactory.
-HttpNetworkSession::HttpNetworkSession(
- HostResolver* host_resolver,
- CertVerifier* cert_verifier,
- DnsRRResolver* dnsrr_resolver,
- DnsCertProvenanceChecker* dns_cert_checker,
- SSLHostInfoFactory* ssl_host_info_factory,
- ProxyService* proxy_service,
- ClientSocketFactory* client_socket_factory,
- SSLConfigService* ssl_config_service,
- SpdySessionPool* spdy_session_pool,
- HttpAuthHandlerFactory* http_auth_handler_factory,
- HttpNetworkDelegate* network_delegate,
- NetLog* net_log)
- : socket_factory_(client_socket_factory),
- host_resolver_(host_resolver),
- cert_verifier_(cert_verifier),
- dnsrr_resolver_(dnsrr_resolver),
- dns_cert_checker_(dns_cert_checker),
- proxy_service_(proxy_service),
- ssl_config_service_(ssl_config_service),
- socket_pool_manager_(net_log,
- client_socket_factory,
- host_resolver,
- cert_verifier,
- dnsrr_resolver,
- dns_cert_checker,
- ssl_host_info_factory,
- proxy_service,
- ssl_config_service),
- spdy_session_pool_(spdy_session_pool),
- http_auth_handler_factory_(http_auth_handler_factory),
- network_delegate_(network_delegate),
- net_log_(net_log) {
- DCHECK(proxy_service);
- DCHECK(ssl_config_service);
+HttpNetworkSession::HttpNetworkSession(const Params& params)
+ : proxy_service_(params.proxy_service),
+ ssl_config_service_(params.ssl_config_service),
+ socket_pool_manager_(params.net_log,
+ params.client_socket_factory ?
+ params.client_socket_factory :
+ ClientSocketFactory::GetDefaultFactory(),
+ params.host_resolver,
+ params.cert_verifier,
+ params.dnsrr_resolver,
+ params.dns_cert_checker,
+ params.ssl_host_info_factory,
+ params.proxy_service,
+ params.ssl_config_service),
+ spdy_session_pool_(params.ssl_config_service),
+ http_auth_handler_factory_(params.http_auth_handler_factory),
+ network_delegate_(params.network_delegate),
+ net_log_(params.net_log) {
+ DCHECK(params.proxy_service);
+ DCHECK(params.ssl_config_service);
}
HttpNetworkSession::~HttpNetworkSession() {
STLDeleteElements(&response_drainers_);
- spdy_session_pool_->CloseAllSessions();
+ spdy_session_pool_.CloseAllSessions();
}
void HttpNetworkSession::AddResponseDrainer(HttpResponseBodyDrainer* drainer) {
@@ -72,7 +58,7 @@ void HttpNetworkSession::RemoveResponseDrainer(
}
Value* HttpNetworkSession::SpdySessionPoolInfoToValue() const {
- return spdy_session_pool_->SpdySessionPoolInfoToValue();
+ return spdy_session_pool_.SpdySessionPoolInfoToValue();
}
} // namespace net
diff --git a/net/http/http_network_session.h b/net/http/http_network_session.h
index b36d7f7..36cb652 100644
--- a/net/http/http_network_session.h
+++ b/net/http/http_network_session.h
@@ -6,22 +6,17 @@
#define NET_HTTP_HTTP_NETWORK_SESSION_H_
#pragma once
-#include <map>
#include <set>
#include "base/ref_counted.h"
-#include "base/scoped_ptr.h"
#include "base/threading/non_thread_safe.h"
#include "net/base/host_port_pair.h"
#include "net/base/host_resolver.h"
#include "net/base/ssl_client_auth_cache.h"
-#include "net/base/ssl_config_service.h"
#include "net/http/http_alternate_protocols.h"
#include "net/http/http_auth_cache.h"
-#include "net/http/http_network_delegate.h"
-#include "net/http/http_network_transaction.h"
#include "net/http/http_stream_factory.h"
-#include "net/proxy/proxy_service.h"
#include "net/socket/client_socket_pool_manager.h"
+#include "net/spdy/spdy_session_pool.h"
#include "net/spdy/spdy_settings_storage.h"
class Value;
@@ -32,34 +27,49 @@ class CertVerifier;
class ClientSocketFactory;
class DnsCertProvenanceChecker;
class DnsRRResolver;
+class HostResolver;
class HttpAuthHandlerFactory;
class HttpNetworkDelegate;
class HttpNetworkSessionPeer;
class HttpProxyClientSocketPool;
class HttpResponseBodyDrainer;
-class SpdySessionPool;
-class SOCKSClientSocketPool;
-class SSLClientSocketPool;
+class NetLog;
+class ProxyService;
+class SSLConfigService;
class SSLHostInfoFactory;
-class TCPClientSocketPool;
// This class holds session objects used by HttpNetworkTransaction objects.
class HttpNetworkSession : public base::RefCounted<HttpNetworkSession>,
public base::NonThreadSafe {
public:
- HttpNetworkSession(
- HostResolver* host_resolver,
- CertVerifier* cert_verifier,
- DnsRRResolver* dnsrr_resolver,
- DnsCertProvenanceChecker* dns_cert_checker,
- SSLHostInfoFactory* ssl_host_info_factory,
- ProxyService* proxy_service,
- ClientSocketFactory* client_socket_factory,
- SSLConfigService* ssl_config_service,
- SpdySessionPool* spdy_session_pool,
- HttpAuthHandlerFactory* http_auth_handler_factory,
- HttpNetworkDelegate* network_delegate,
- NetLog* net_log);
+ struct Params {
+ Params()
+ : client_socket_factory(NULL),
+ host_resolver(NULL),
+ cert_verifier(NULL),
+ dnsrr_resolver(NULL),
+ dns_cert_checker(NULL),
+ proxy_service(NULL),
+ ssl_host_info_factory(NULL),
+ ssl_config_service(NULL),
+ http_auth_handler_factory(NULL),
+ network_delegate(NULL),
+ net_log(NULL) {}
+
+ ClientSocketFactory* client_socket_factory;
+ HostResolver* host_resolver;
+ CertVerifier* cert_verifier;
+ DnsRRResolver* dnsrr_resolver;
+ DnsCertProvenanceChecker* dns_cert_checker;
+ ProxyService* proxy_service;
+ SSLHostInfoFactory* ssl_host_info_factory;
+ SSLConfigService* ssl_config_service;
+ HttpAuthHandlerFactory* http_auth_handler_factory;
+ HttpNetworkDelegate* network_delegate;
+ NetLog* net_log;
+ };
+
+ explicit HttpNetworkSession(const Params& params);
HttpAuthCache* auth_cache() { return &auth_cache_; }
SSLClientAuthCache* ssl_client_auth_cache() {
@@ -108,17 +118,10 @@ class HttpNetworkSession : public base::RefCounted<HttpNetworkSession>,
return socket_pool_manager_.GetSocketPoolForSSLWithProxy(proxy_server);
}
- // SSL sockets come from the socket_factory().
- ClientSocketFactory* socket_factory() { return socket_factory_; }
- HostResolver* host_resolver() { return host_resolver_; }
CertVerifier* cert_verifier() { return cert_verifier_; }
- DnsRRResolver* dnsrr_resolver() { return dnsrr_resolver_; }
- DnsCertProvenanceChecker* dns_cert_checker() {
- return dns_cert_checker_;
- }
ProxyService* proxy_service() { return proxy_service_; }
SSLConfigService* ssl_config_service() { return ssl_config_service_; }
- SpdySessionPool* spdy_session_pool() { return spdy_session_pool_.get(); }
+ SpdySessionPool* spdy_session_pool() { return &spdy_session_pool_; }
HttpAuthHandlerFactory* http_auth_handler_factory() {
return http_auth_handler_factory_;
}
@@ -154,24 +157,19 @@ class HttpNetworkSession : public base::RefCounted<HttpNetworkSession>,
~HttpNetworkSession();
- ClientSocketFactory* const socket_factory_;
HttpAuthCache auth_cache_;
SSLClientAuthCache ssl_client_auth_cache_;
HttpAlternateProtocols alternate_protocols_;
- HostResolver* const host_resolver_;
CertVerifier* cert_verifier_;
- DnsRRResolver* dnsrr_resolver_;
- DnsCertProvenanceChecker* dns_cert_checker_;
+ // Not const since it's modified by HttpNetworkSessionPeer for testing.
scoped_refptr<ProxyService> proxy_service_;
- scoped_refptr<SSLConfigService> ssl_config_service_;
+ const scoped_refptr<SSLConfigService> ssl_config_service_;
ClientSocketPoolManager socket_pool_manager_;
- // TODO(willchan): Move this out to IOThread so it can be shared across
- // URLRequestContexts.
- scoped_ptr<SpdySessionPool> spdy_session_pool_;
+ SpdySessionPool spdy_session_pool_;
HttpStreamFactory http_stream_factory_;
- HttpAuthHandlerFactory* http_auth_handler_factory_;
+ HttpAuthHandlerFactory* const http_auth_handler_factory_;
HttpNetworkDelegate* const network_delegate_;
- NetLog* net_log_;
+ NetLog* const net_log_;
SpdySettingsStorage spdy_settings_;
std::set<HttpResponseBodyDrainer*> response_drainers_;
};
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index 14c889a..a31fb17 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -33,6 +33,7 @@
#include "net/http/http_basic_stream.h"
#include "net/http/http_chunked_decoder.h"
#include "net/http/http_net_log_params.h"
+#include "net/http/http_network_delegate.h"
#include "net/http/http_network_session.h"
#include "net/http/http_proxy_client_socket.h"
#include "net/http/http_proxy_client_socket_pool.h"
@@ -1219,22 +1220,6 @@ std::string HttpNetworkTransaction::DescribeState(State state) {
return description;
}
-// TODO(gavinp): re-adjust this once SPDY v3 has three priority bits,
-// eliminating the need for this folding.
-int ConvertRequestPriorityToSpdyPriority(const RequestPriority priority) {
- DCHECK(HIGHEST <= priority && priority < NUM_PRIORITIES);
- switch (priority) {
- case LOWEST:
- return SPDY_PRIORITY_LOWEST-1;
- case IDLE:
- return SPDY_PRIORITY_LOWEST;
- default:
- return priority;
- }
-}
-
-
-
#undef STATE_CASE
} // namespace net
diff --git a/net/http/http_network_transaction.h b/net/http/http_network_transaction.h
index bac1451..66b6b29 100644
--- a/net/http/http_network_transaction.h
+++ b/net/http/http_network_transaction.h
@@ -254,8 +254,6 @@ class HttpNetworkTransaction : public HttpTransaction,
DISALLOW_COPY_AND_ASSIGN(HttpNetworkTransaction);
};
-int ConvertRequestPriorityToSpdyPriority(RequestPriority priority);
-
} // namespace net
#endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc
index 333bc51..66ab6d4 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -102,18 +102,16 @@ struct SessionDependencies {
};
HttpNetworkSession* CreateSession(SessionDependencies* session_deps) {
- return new HttpNetworkSession(session_deps->host_resolver.get(),
- session_deps->cert_verifier.get(),
- NULL /* dnsrr_resolver */,
- NULL /* dns_cert_checker */,
- NULL /* ssl_host_info_factory */,
- session_deps->proxy_service,
- &session_deps->socket_factory,
- session_deps->ssl_config_service,
- new SpdySessionPool(NULL),
- session_deps->http_auth_handler_factory.get(),
- NULL,
- session_deps->net_log);
+ net::HttpNetworkSession::Params params;
+ params.client_socket_factory = &session_deps->socket_factory;
+ params.host_resolver = session_deps->host_resolver.get();
+ params.cert_verifier = session_deps->cert_verifier.get();
+ params.proxy_service = session_deps->proxy_service;
+ params.ssl_config_service = session_deps->ssl_config_service;
+ params.http_auth_handler_factory =
+ session_deps->http_auth_handler_factory.get();
+ params.net_log = session_deps->net_log;
+ return new HttpNetworkSession(params);
}
class HttpNetworkTransactionTest : public PlatformTest {
@@ -254,7 +252,8 @@ std::string MockGetHostName() {
template<typename ParentPool>
class CaptureGroupNameSocketPool : public ParentPool {
public:
- explicit CaptureGroupNameSocketPool(HttpNetworkSession* session);
+ CaptureGroupNameSocketPool(HostResolver* host_resolver,
+ CertVerifier* cert_verifier);
const std::string last_group_name_received() const {
return last_group_name_;
@@ -303,20 +302,21 @@ CaptureGroupNameSSLSocketPool;
template<typename ParentPool>
CaptureGroupNameSocketPool<ParentPool>::CaptureGroupNameSocketPool(
- HttpNetworkSession* session)
- : ParentPool(0, 0, NULL, session->host_resolver(), NULL, NULL) {}
+ HostResolver* host_resolver,
+ CertVerifier* /* cert_verifier */)
+ : ParentPool(0, 0, NULL, host_resolver, NULL, NULL) {}
template<>
CaptureGroupNameHttpProxySocketPool::CaptureGroupNameSocketPool(
- HttpNetworkSession* session)
- : HttpProxyClientSocketPool(0, 0, NULL, session->host_resolver(), NULL,
- NULL, NULL) {}
+ HostResolver* host_resolver,
+ CertVerifier* /* cert_verifier */)
+ : HttpProxyClientSocketPool(0, 0, NULL, host_resolver, NULL, NULL, NULL) {}
template<>
CaptureGroupNameSSLSocketPool::CaptureGroupNameSocketPool(
- HttpNetworkSession* session)
- : SSLClientSocketPool(0, 0, NULL, session->host_resolver(),
- session->cert_verifier(), NULL, NULL,
+ HostResolver* host_resolver,
+ CertVerifier* cert_verifier)
+ : SSLClientSocketPool(0, 0, NULL, host_resolver, cert_verifier, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL) {}
//-----------------------------------------------------------------------------
@@ -5508,10 +5508,10 @@ TEST_F(HttpNetworkTransactionTest, GroupNameForDirectConnections) {
HttpNetworkSessionPeer peer(session);
CaptureGroupNameTCPSocketPool* tcp_conn_pool =
- new CaptureGroupNameTCPSocketPool(session);
+ new CaptureGroupNameTCPSocketPool(NULL, NULL);
peer.SetTCPSocketPool(tcp_conn_pool);
CaptureGroupNameSSLSocketPool* ssl_conn_pool =
- new CaptureGroupNameSSLSocketPool(session.get());
+ new CaptureGroupNameSSLSocketPool(NULL, NULL);
peer.SetSSLSocketPool(ssl_conn_pool);
EXPECT_EQ(ERR_IO_PENDING,
@@ -5562,10 +5562,10 @@ TEST_F(HttpNetworkTransactionTest, GroupNameForHTTPProxyConnections) {
HostPortPair proxy_host("http_proxy", 80);
CaptureGroupNameHttpProxySocketPool* http_proxy_pool =
- new CaptureGroupNameHttpProxySocketPool(session);
+ new CaptureGroupNameHttpProxySocketPool(NULL, NULL);
peer.SetSocketPoolForHTTPProxy(proxy_host, http_proxy_pool);
CaptureGroupNameSSLSocketPool* ssl_conn_pool =
- new CaptureGroupNameSSLSocketPool(session);
+ new CaptureGroupNameSSLSocketPool(NULL, NULL);
peer.SetSocketPoolForSSLWithProxy(proxy_host, ssl_conn_pool);
EXPECT_EQ(ERR_IO_PENDING,
@@ -5627,10 +5627,10 @@ TEST_F(HttpNetworkTransactionTest, GroupNameForSOCKSConnections) {
HostPortPair proxy_host("socks_proxy", 1080);
CaptureGroupNameSOCKSSocketPool* socks_conn_pool =
- new CaptureGroupNameSOCKSSocketPool(session);
+ new CaptureGroupNameSOCKSSocketPool(NULL, NULL);
peer.SetSocketPoolForSOCKSProxy(proxy_host, socks_conn_pool);
CaptureGroupNameSSLSocketPool* ssl_conn_pool =
- new CaptureGroupNameSSLSocketPool(session);
+ new CaptureGroupNameSSLSocketPool(NULL, NULL);
peer.SetSocketPoolForSSLWithProxy(proxy_host, ssl_conn_pool);
scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session));
@@ -6933,15 +6933,14 @@ TEST_F(HttpNetworkTransactionTest,
SSLConfig ssl_config;
session->ssl_config_service()->GetSSLConfig(&ssl_config);
- ClientSocket* socket = connection->release_socket();
- socket = session->socket_factory()->CreateSSLClientSocket(
- socket, HostPortPair("" , 443), ssl_config, NULL /* ssl_host_info */,
- session->cert_verifier());
- connection->set_socket(socket);
- EXPECT_EQ(ERR_IO_PENDING, socket->Connect(&callback));
+ scoped_ptr<ClientSocketHandle> ssl_connection(new ClientSocketHandle);
+ ssl_connection->set_socket(session_deps.socket_factory.CreateSSLClientSocket(
+ connection.release(), HostPortPair("" , 443), ssl_config,
+ NULL /* ssl_host_info */, session_deps.cert_verifier.get(), NULL));
+ EXPECT_EQ(ERR_IO_PENDING, ssl_connection->socket()->Connect(&callback));
EXPECT_EQ(OK, callback.WaitForResult());
- EXPECT_EQ(OK, spdy_session->InitializeWithSocket(connection.release(),
+ EXPECT_EQ(OK, spdy_session->InitializeWithSocket(ssl_connection.release(),
true, OK));
trans.reset(new HttpNetworkTransaction(session));
diff --git a/net/http/http_proxy_client_socket_pool_unittest.cc b/net/http/http_proxy_client_socket_pool_unittest.cc
index da4970f..359a058 100644
--- a/net/http/http_proxy_client_socket_pool_unittest.cc
+++ b/net/http/http_proxy_client_socket_pool_unittest.cc
@@ -20,7 +20,6 @@
#include "net/socket/client_socket_pool_histograms.h"
#include "net/socket/socket_test_util.h"
#include "net/spdy/spdy_protocol.h"
-#include "net/spdy/spdy_session_pool.h"
#include "net/spdy/spdy_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -60,13 +59,12 @@ class HttpProxyClientSocketPoolTest : public TestWithHttpParam {
&tcp_histograms_,
&socket_factory_),
ssl_histograms_("MockSSL"),
+ proxy_service_(ProxyService::CreateDirect()),
ssl_config_service_(new SSLConfigServiceDefaults),
- host_resolver_(new MockHostResolver),
- cert_verifier_(new CertVerifier),
ssl_socket_pool_(kMaxSockets, kMaxSocketsPerGroup,
&ssl_histograms_,
- host_resolver_.get(),
- cert_verifier_.get(),
+ &host_resolver_,
+ &cert_verifier_,
NULL /* dnsrr_resolver */,
NULL /* dns_cert_checker */,
NULL /* ssl_host_info_factory */,
@@ -77,19 +75,8 @@ class HttpProxyClientSocketPoolTest : public TestWithHttpParam {
ssl_config_service_.get(),
BoundNetLog().net_log()),
http_auth_handler_factory_(
- HttpAuthHandlerFactory::CreateDefault(host_resolver_.get())),
- session_(new HttpNetworkSession(host_resolver_.get(),
- cert_verifier_.get(),
- NULL /* dnsrr_resolver */,
- NULL /* dns_cert_checker */,
- NULL /* ssl_host_info_factory */,
- ProxyService::CreateDirect(),
- &socket_factory_,
- new SSLConfigServiceDefaults,
- new SpdySessionPool(NULL),
- http_auth_handler_factory_.get(),
- NULL,
- NULL)),
+ HttpAuthHandlerFactory::CreateDefault(&host_resolver_)),
+ session_(CreateNetworkSession()),
http_proxy_histograms_("HttpProxyUnitTest"),
ssl_data_(NULL),
data_(NULL),
@@ -189,6 +176,17 @@ class HttpProxyClientSocketPoolTest : public TestWithHttpParam {
ssl_data_->was_npn_negotiated = true;
}
+ HttpNetworkSession* CreateNetworkSession() {
+ HttpNetworkSession::Params params;
+ params.host_resolver = &host_resolver_;
+ params.cert_verifier = &cert_verifier_;
+ params.proxy_service = proxy_service_;
+ params.client_socket_factory = &socket_factory_;
+ params.ssl_config_service = ssl_config_service_;
+ params.http_auth_handler_factory = http_auth_handler_factory_.get();
+ return new HttpNetworkSession(params);
+ }
+
private:
SSLConfig ssl_config_;
@@ -198,13 +196,14 @@ class HttpProxyClientSocketPoolTest : public TestWithHttpParam {
DeterministicMockClientSocketFactory socket_factory_;
MockTCPClientSocketPool tcp_socket_pool_;
ClientSocketPoolHistograms ssl_histograms_;
- scoped_refptr<SSLConfigService> ssl_config_service_;
- scoped_ptr<HostResolver> host_resolver_;
- scoped_ptr<CertVerifier> cert_verifier_;
+ MockHostResolver host_resolver_;
+ CertVerifier cert_verifier_;
+ const scoped_refptr<ProxyService> proxy_service_;
+ const scoped_refptr<SSLConfigService> ssl_config_service_;
SSLClientSocketPool ssl_socket_pool_;
- scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_;
- scoped_refptr<HttpNetworkSession> session_;
+ const scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_;
+ const scoped_refptr<HttpNetworkSession> session_;
ClientSocketPoolHistograms http_proxy_histograms_;
protected:
diff --git a/net/http/http_response_body_drainer_unittest.cc b/net/http/http_response_body_drainer_unittest.cc
index 76304f8..5745865 100644
--- a/net/http/http_response_body_drainer_unittest.cc
+++ b/net/http/http_response_body_drainer_unittest.cc
@@ -16,7 +16,6 @@
#include "net/http/http_network_session.h"
#include "net/http/http_stream.h"
#include "net/proxy/proxy_service.h"
-#include "net/spdy/spdy_session_pool.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace net {
@@ -174,23 +173,23 @@ void MockHttpStream::CompleteRead() {
class HttpResponseBodyDrainerTest : public testing::Test {
protected:
HttpResponseBodyDrainerTest()
- : session_(new HttpNetworkSession(
- NULL /* host_resolver */,
- NULL /* dnsrr_resolver */,
- NULL /* dns_cert_checker */,
- NULL,
- NULL /* ssl_host_info_factory */,
- ProxyService::CreateDirect(),
- NULL,
- new SSLConfigServiceDefaults,
- new SpdySessionPool(NULL),
- NULL,
- NULL,
- NULL)),
+ : proxy_service_(ProxyService::CreateDirect()),
+ ssl_config_service_(new SSLConfigServiceDefaults),
+ session_(CreateNetworkSession()),
mock_stream_(new MockHttpStream(&result_waiter_)),
drainer_(new HttpResponseBodyDrainer(mock_stream_)) {}
+
~HttpResponseBodyDrainerTest() {}
+ HttpNetworkSession* CreateNetworkSession() const {
+ HttpNetworkSession::Params params;
+ params.proxy_service = proxy_service_;
+ params.ssl_config_service = ssl_config_service_;
+ return new HttpNetworkSession(params);
+ }
+
+ scoped_refptr<ProxyService> proxy_service_;
+ scoped_refptr<SSLConfigService> ssl_config_service_;
const scoped_refptr<HttpNetworkSession> session_;
CloseResultWaiter result_waiter_;
MockHttpStream* const mock_stream_; // Owned by |drainer_|.
diff --git a/net/http/http_stream_factory_unittest.cc b/net/http/http_stream_factory_unittest.cc
index 5c5e200..81f2f1b 100644
--- a/net/http/http_stream_factory_unittest.cc
+++ b/net/http/http_stream_factory_unittest.cc
@@ -46,18 +46,16 @@ struct SessionDependencies {
};
HttpNetworkSession* CreateSession(SessionDependencies* session_deps) {
- return new HttpNetworkSession(session_deps->host_resolver.get(),
- session_deps->cert_verifier.get(),
- NULL /* dnsrr_resolver */,
- NULL /* dns_cert_checker */,
- NULL /* ssl_host_info_factory */,
- session_deps->proxy_service,
- &session_deps->socket_factory,
- session_deps->ssl_config_service,
- new SpdySessionPool(NULL),
- session_deps->http_auth_handler_factory.get(),
- NULL,
- session_deps->net_log);
+ HttpNetworkSession::Params params;
+ params.host_resolver = session_deps->host_resolver.get();
+ params.cert_verifier = session_deps->cert_verifier.get();
+ params.proxy_service = session_deps->proxy_service;
+ params.ssl_config_service = session_deps->ssl_config_service;
+ params.client_socket_factory = &session_deps->socket_factory;
+ params.http_auth_handler_factory =
+ session_deps->http_auth_handler_factory.get();
+ params.net_log = session_deps->net_log;
+ return new HttpNetworkSession(params);
}
struct TestCase {
@@ -97,7 +95,8 @@ int PreconnectHelper(const TestCase& test,
template<typename ParentPool>
class CapturePreconnectsSocketPool : public ParentPool {
public:
- explicit CapturePreconnectsSocketPool(HttpNetworkSession* session);
+ CapturePreconnectsSocketPool(HostResolver* host_resolver,
+ CertVerifier* cert_verifier);
int last_num_streams() const {
return last_num_streams_;
@@ -163,22 +162,20 @@ CapturePreconnectsSSLSocketPool;
template<typename ParentPool>
CapturePreconnectsSocketPool<ParentPool>::CapturePreconnectsSocketPool(
- HttpNetworkSession* session)
- : ParentPool(0, 0, NULL, session->host_resolver(), NULL, NULL),
+ HostResolver* host_resolver, CertVerifier* /* cert_verifier */)
+ : ParentPool(0, 0, NULL, host_resolver, NULL, NULL),
last_num_streams_(-1) {}
template<>
CapturePreconnectsHttpProxySocketPool::CapturePreconnectsSocketPool(
- HttpNetworkSession* session)
- : HttpProxyClientSocketPool(0, 0, NULL, session->host_resolver(), NULL,
- NULL, NULL),
+ HostResolver* host_resolver, CertVerifier* /* cert_verifier */)
+ : HttpProxyClientSocketPool(0, 0, NULL, host_resolver, NULL, NULL, NULL),
last_num_streams_(-1) {}
template<>
CapturePreconnectsSSLSocketPool::CapturePreconnectsSocketPool(
- HttpNetworkSession* session)
- : SSLClientSocketPool(0, 0, NULL, session->host_resolver(),
- session->cert_verifier(), NULL, NULL,
+ HostResolver* host_resolver, CertVerifier* cert_verifier)
+ : SSLClientSocketPool(0, 0, NULL, host_resolver, cert_verifier, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL),
last_num_streams_(-1) {}
@@ -188,10 +185,14 @@ TEST(HttpStreamFactoryTest, PreconnectDirect) {
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps));
HttpNetworkSessionPeer peer(session);
CapturePreconnectsTCPSocketPool* tcp_conn_pool =
- new CapturePreconnectsTCPSocketPool(session);
+ new CapturePreconnectsTCPSocketPool(
+ session_deps.host_resolver.get(),
+ session_deps.cert_verifier.get());
peer.SetTCPSocketPool(tcp_conn_pool);
CapturePreconnectsSSLSocketPool* ssl_conn_pool =
- new CapturePreconnectsSSLSocketPool(session.get());
+ new CapturePreconnectsSSLSocketPool(
+ session_deps.host_resolver.get(),
+ session_deps.cert_verifier.get());
peer.SetSSLSocketPool(ssl_conn_pool);
EXPECT_EQ(OK, PreconnectHelper(kTests[i], session));
if (kTests[i].ssl)
@@ -208,10 +209,14 @@ TEST(HttpStreamFactoryTest, PreconnectHttpProxy) {
HttpNetworkSessionPeer peer(session);
HostPortPair proxy_host("http_proxy", 80);
CapturePreconnectsHttpProxySocketPool* http_proxy_pool =
- new CapturePreconnectsHttpProxySocketPool(session);
+ new CapturePreconnectsHttpProxySocketPool(
+ session_deps.host_resolver.get(),
+ session_deps.cert_verifier.get());
peer.SetSocketPoolForHTTPProxy(proxy_host, http_proxy_pool);
CapturePreconnectsSSLSocketPool* ssl_conn_pool =
- new CapturePreconnectsSSLSocketPool(session);
+ new CapturePreconnectsSSLSocketPool(
+ session_deps.host_resolver.get(),
+ session_deps.cert_verifier.get());
peer.SetSocketPoolForSSLWithProxy(proxy_host, ssl_conn_pool);
EXPECT_EQ(OK, PreconnectHelper(kTests[i], session));
if (kTests[i].ssl)
@@ -229,10 +234,14 @@ TEST(HttpStreamFactoryTest, PreconnectSocksProxy) {
HttpNetworkSessionPeer peer(session);
HostPortPair proxy_host("socks_proxy", 1080);
CapturePreconnectsSOCKSSocketPool* socks_proxy_pool =
- new CapturePreconnectsSOCKSSocketPool(session);
+ new CapturePreconnectsSOCKSSocketPool(
+ session_deps.host_resolver.get(),
+ session_deps.cert_verifier.get());
peer.SetSocketPoolForSOCKSProxy(proxy_host, socks_proxy_pool);
CapturePreconnectsSSLSocketPool* ssl_conn_pool =
- new CapturePreconnectsSSLSocketPool(session);
+ new CapturePreconnectsSSLSocketPool(
+ session_deps.host_resolver.get(),
+ session_deps.cert_verifier.get());
peer.SetSocketPoolForSSLWithProxy(proxy_host, ssl_conn_pool);
EXPECT_EQ(OK, PreconnectHelper(kTests[i], session));
if (kTests[i].ssl)
@@ -256,10 +265,14 @@ TEST(HttpStreamFactoryTest, PreconnectDirectWithExistingSpdySession) {
pair, session->mutable_spdy_settings(), BoundNetLog());
CapturePreconnectsTCPSocketPool* tcp_conn_pool =
- new CapturePreconnectsTCPSocketPool(session);
+ new CapturePreconnectsTCPSocketPool(
+ session_deps.host_resolver.get(),
+ session_deps.cert_verifier.get());
peer.SetTCPSocketPool(tcp_conn_pool);
CapturePreconnectsSSLSocketPool* ssl_conn_pool =
- new CapturePreconnectsSSLSocketPool(session.get());
+ new CapturePreconnectsSSLSocketPool(
+ session_deps.host_resolver.get(),
+ session_deps.cert_verifier.get());
peer.SetSSLSocketPool(ssl_conn_pool);
EXPECT_EQ(OK, PreconnectHelper(kTests[i], session));
// We shouldn't be preconnecting if we have an existing session, which is
diff --git a/net/proxy/proxy_script_fetcher_impl_unittest.cc b/net/proxy/proxy_script_fetcher_impl_unittest.cc
index ae751eb..ce92986 100644
--- a/net/proxy/proxy_script_fetcher_impl_unittest.cc
+++ b/net/proxy/proxy_script_fetcher_impl_unittest.cc
@@ -16,8 +16,6 @@
#include "net/disk_cache/disk_cache.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_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
@@ -50,20 +48,13 @@ class RequestContext : public URLRequestContext {
proxy_service_ = ProxyService::CreateFixed(no_proxy);
ssl_config_service_ = new SSLConfigServiceDefaults;
+ HttpNetworkSession::Params params;
+ params.host_resolver = host_resolver_;
+ params.cert_verifier = cert_verifier_;
+ params.proxy_service = proxy_service_;
+ params.ssl_config_service = ssl_config_service_;
scoped_refptr<HttpNetworkSession> network_session(
- new HttpNetworkSession(
- host_resolver_,
- cert_verifier_,
- NULL /* dnsrr_resolver */,
- NULL /* dns_cert_checker */,
- NULL /* ssl_host_info_factory */,
- proxy_service_,
- ClientSocketFactory::GetDefaultFactory(),
- ssl_config_service_,
- new SpdySessionPool(NULL),
- NULL,
- NULL,
- NULL));
+ new HttpNetworkSession(params));
http_transaction_factory_ = new HttpCache(
network_session,
HttpCache::DefaultBackend::InMemory(0));
diff --git a/net/socket/ssl_client_socket_pool_unittest.cc b/net/socket/ssl_client_socket_pool_unittest.cc
index 646f03d..e211591 100644
--- a/net/socket/ssl_client_socket_pool_unittest.cc
+++ b/net/socket/ssl_client_socket_pool_unittest.cc
@@ -19,7 +19,6 @@
#include "net/http/http_network_session.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_response_headers.h"
-#include "net/socket/client_socket_factory.h"
#include "net/socket/client_socket_handle.h"
#include "net/socket/client_socket_pool_histograms.h"
#include "net/socket/socket_test_util.h"
@@ -36,22 +35,11 @@ const int kMaxSocketsPerGroup = 6;
class SSLClientSocketPoolTest : public testing::Test {
protected:
SSLClientSocketPoolTest()
- : host_resolver_(new MockHostResolver),
- cert_verifier_(new CertVerifier),
+ : proxy_service_(ProxyService::CreateDirect()),
+ ssl_config_service_(new SSLConfigServiceDefaults),
http_auth_handler_factory_(HttpAuthHandlerFactory::CreateDefault(
- host_resolver_.get())),
- session_(new HttpNetworkSession(host_resolver_.get(),
- cert_verifier_.get(),
- NULL /* dnsrr_resolver */,
- NULL /* dns_cert_checker */,
- NULL /* ssl_host_info_factory */,
- ProxyService::CreateDirect(),
- &socket_factory_,
- new SSLConfigServiceDefaults,
- new SpdySessionPool(NULL),
- http_auth_handler_factory_.get(),
- NULL,
- NULL)),
+ &host_resolver_)),
+ session_(CreateNetworkSession()),
direct_tcp_socket_params_(new TCPSocketParams(
HostPortPair("host", 443), MEDIUM, GURL(), false)),
tcp_histograms_("MockTCP"),
@@ -84,7 +72,7 @@ class SSLClientSocketPoolTest : public testing::Test {
kMaxSockets,
kMaxSocketsPerGroup,
&http_proxy_histograms_,
- host_resolver_.get(),
+ &host_resolver_,
&tcp_socket_pool_,
NULL,
NULL) {
@@ -138,11 +126,24 @@ class SSLClientSocketPoolTest : public testing::Test {
"/");
}
+ HttpNetworkSession* CreateNetworkSession() {
+ HttpNetworkSession::Params params;
+ params.host_resolver = &host_resolver_;
+ params.cert_verifier = &cert_verifier_;
+ params.proxy_service = proxy_service_;
+ params.client_socket_factory = &socket_factory_;
+ params.ssl_config_service = ssl_config_service_;
+ params.http_auth_handler_factory = http_auth_handler_factory_.get();
+ return new HttpNetworkSession(params);
+ }
+
MockClientSocketFactory socket_factory_;
- scoped_ptr<HostResolver> host_resolver_;
- scoped_ptr<CertVerifier> cert_verifier_;
- scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_;
- scoped_refptr<HttpNetworkSession> session_;
+ MockHostResolver host_resolver_;
+ CertVerifier cert_verifier_;
+ const scoped_refptr<ProxyService> proxy_service_;
+ const scoped_refptr<SSLConfigService> ssl_config_service_;
+ const scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_;
+ const scoped_refptr<HttpNetworkSession> session_;
scoped_refptr<TCPSocketParams> direct_tcp_socket_params_;
ClientSocketPoolHistograms tcp_histograms_;
diff --git a/net/spdy/spdy_http_utils.cc b/net/spdy/spdy_http_utils.cc
index e367c42..bf7376a 100644
--- a/net/spdy/spdy_http_utils.cc
+++ b/net/spdy/spdy_http_utils.cc
@@ -107,4 +107,18 @@ void CreateSpdyHeadersFromHttpRequest(const HttpRequestInfo& info,
}
+// TODO(gavinp): re-adjust this once SPDY v3 has three priority bits,
+// eliminating the need for this folding.
+int ConvertRequestPriorityToSpdyPriority(const RequestPriority priority) {
+ DCHECK(HIGHEST <= priority && priority < NUM_PRIORITIES);
+ switch (priority) {
+ case LOWEST:
+ return SPDY_PRIORITY_LOWEST - 1;
+ case IDLE:
+ return SPDY_PRIORITY_LOWEST;
+ default:
+ return priority;
+ }
+}
+
} // namespace net
diff --git a/net/spdy/spdy_http_utils.h b/net/spdy/spdy_http_utils.h
index 40f0254..855d264 100644
--- a/net/spdy/spdy_http_utils.h
+++ b/net/spdy/spdy_http_utils.h
@@ -6,6 +6,7 @@
#define NET_SPDY_SPDY_HTTP_UTILS_H_
#pragma once
+#include "net/base/request_priority.h"
#include "net/spdy/spdy_framer.h"
namespace net {
@@ -29,6 +30,8 @@ void CreateSpdyHeadersFromHttpRequest(const HttpRequestInfo& info,
spdy::SpdyHeaderBlock* headers,
bool direct);
+int ConvertRequestPriorityToSpdyPriority(RequestPriority priority);
+
} // namespace net
#endif // NET_SPDY_SPDY_HTTP_UTILS_H_
diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc
index 02c8d17..de248cb 100644
--- a/net/spdy/spdy_network_transaction_unittest.cc
+++ b/net/spdy/spdy_network_transaction_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "net/http/http_network_transaction.h"
+
#include <string>
#include <vector>
@@ -10,6 +12,7 @@
#include "net/http/http_network_session_peer.h"
#include "net/http/http_transaction_unittest.h"
#include "net/spdy/spdy_http_stream.h"
+#include "net/spdy/spdy_http_utils.h"
#include "net/spdy/spdy_session.h"
#include "net/spdy/spdy_session_pool.h"
#include "net/spdy/spdy_test_util.h"
diff --git a/net/spdy/spdy_proxy_client_socket_unittest.cc b/net/spdy/spdy_proxy_client_socket_unittest.cc
index 8ceea45..e4483bd 100644
--- a/net/spdy/spdy_proxy_client_socket_unittest.cc
+++ b/net/spdy/spdy_proxy_client_socket_unittest.cc
@@ -16,6 +16,7 @@
#include "net/socket/client_socket_factory.h"
#include "net/socket/tcp_client_socket.h"
#include "net/socket/socket_test_util.h"
+#include "net/spdy/spdy_http_utils.h"
#include "net/spdy/spdy_protocol.h"
#include "net/spdy/spdy_session_pool.h"
#include "net/spdy/spdy_test_util.h"
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index cbc1365..f4c3acc 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -23,7 +23,9 @@
#include "net/http/http_network_session.h"
#include "net/socket/ssl_client_socket.h"
#include "net/spdy/spdy_frame_builder.h"
+#include "net/spdy/spdy_http_utils.h"
#include "net/spdy/spdy_protocol.h"
+#include "net/spdy/spdy_session_pool.h"
#include "net/spdy/spdy_settings_storage.h"
#include "net/spdy/spdy_stream.h"
diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc
index aa807af..50bb20b 100644
--- a/net/spdy/spdy_session_pool.cc
+++ b/net/spdy/spdy_session_pool.cc
@@ -114,15 +114,15 @@ void SpdySessionPool::Remove(const scoped_refptr<SpdySession>& session) {
RemoveSessionList(session->host_port_proxy_pair());
}
-Value* SpdySessionPool::SpdySessionPoolInfoToValue() {
+Value* SpdySessionPool::SpdySessionPoolInfoToValue() const {
ListValue* list = new ListValue();
SpdySessionsMap::const_iterator spdy_session_pool_it = sessions_.begin();
for (SpdySessionsMap::const_iterator it = sessions_.begin();
- it != sessions_.end(); it++) {
+ it != sessions_.end(); ++it) {
SpdySessionList* sessions = it->second;
for (SpdySessionList::const_iterator session = sessions->begin();
- session != sessions->end(); session++) {
+ session != sessions->end(); ++session) {
list->Append(session->get()->GetInfoAsValue());
}
}
diff --git a/net/spdy/spdy_session_pool.h b/net/spdy/spdy_session_pool.h
index 6b346f6..1a0d536 100644
--- a/net/spdy/spdy_session_pool.h
+++ b/net/spdy/spdy_session_pool.h
@@ -90,7 +90,7 @@ class SpdySessionPool
// Creates a Value summary of the state of the spdy session pool. The caller
// responsible for deleting the returned value.
- Value* SpdySessionPoolInfoToValue();
+ Value* SpdySessionPoolInfoToValue() const;
// NetworkChangeNotifier::Observer methods:
diff --git a/net/spdy/spdy_session_unittest.cc b/net/spdy/spdy_session_unittest.cc
index 8b76cd9..44848e3 100644
--- a/net/spdy/spdy_session_unittest.cc
+++ b/net/spdy/spdy_session_unittest.cc
@@ -5,6 +5,7 @@
#include "net/spdy/spdy_session.h"
#include "net/spdy/spdy_io_buffer.h"
+#include "net/spdy/spdy_session_pool.h"
#include "net/spdy/spdy_stream.h"
#include "net/spdy/spdy_test_util.h"
#include "testing/platform_test.h"
diff --git a/net/spdy/spdy_stream_unittest.cc b/net/spdy/spdy_stream_unittest.cc
index 3bf0a23..9c7b934 100644
--- a/net/spdy/spdy_stream_unittest.cc
+++ b/net/spdy/spdy_stream_unittest.cc
@@ -4,6 +4,7 @@
#include "net/spdy/spdy_stream.h"
#include "base/ref_counted.h"
+#include "net/spdy/spdy_http_utils.h"
#include "net/spdy/spdy_session.h"
#include "net/spdy/spdy_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/net/spdy/spdy_test_util.cc b/net/spdy/spdy_test_util.cc
index e7bde0a..5340f22 100644
--- a/net/spdy/spdy_test_util.cc
+++ b/net/spdy/spdy_test_util.cc
@@ -12,6 +12,7 @@
#include "net/http/http_network_session.h"
#include "net/http/http_network_transaction.h"
#include "net/spdy/spdy_framer.h"
+#include "net/spdy/spdy_http_utils.h"
namespace net {
@@ -291,7 +292,7 @@ spdy::SpdyFrame* ConstructSpdyControlFrame(const char* const extra_headers[],
type, // Kind = Syn
stream_id, // Stream ID
associated_stream_id, // Associated stream ID
- net::ConvertRequestPriorityToSpdyPriority(request_priority),
+ ConvertRequestPriorityToSpdyPriority(request_priority),
// Priority
flags, // Control Flags
compressed, // Compressed
@@ -886,36 +887,30 @@ SpdySessionDependencies::~SpdySessionDependencies() {}
// static
HttpNetworkSession* SpdySessionDependencies::SpdyCreateSession(
SpdySessionDependencies* session_deps) {
- return new HttpNetworkSession(session_deps->host_resolver.get(),
- session_deps->cert_verifier.get(),
- NULL /* dnsrr_resolver */,
- NULL /* dns_cert_checker */,
- NULL /* ssl_host_info_factory */,
- session_deps->proxy_service,
- session_deps->socket_factory.get(),
- session_deps->ssl_config_service,
- new SpdySessionPool(NULL),
- session_deps->http_auth_handler_factory.get(),
- NULL,
- NULL);
+ net::HttpNetworkSession::Params params;
+ params.client_socket_factory = session_deps->socket_factory.get();
+ params.host_resolver = session_deps->host_resolver.get();
+ params.cert_verifier = session_deps->cert_verifier.get();
+ params.proxy_service = session_deps->proxy_service;
+ params.ssl_config_service = session_deps->ssl_config_service;
+ params.http_auth_handler_factory =
+ session_deps->http_auth_handler_factory.get();
+ return new HttpNetworkSession(params);
}
// static
HttpNetworkSession* SpdySessionDependencies::SpdyCreateSessionDeterministic(
SpdySessionDependencies* session_deps) {
- return new HttpNetworkSession(session_deps->host_resolver.get(),
- session_deps->cert_verifier.get(),
- NULL /* dnsrr_resolver */,
- NULL /* dns_cert_checker */,
- NULL /* ssl_host_info_factory */,
- session_deps->proxy_service,
- session_deps->
- deterministic_socket_factory.get(),
- session_deps->ssl_config_service,
- new SpdySessionPool(NULL),
- session_deps->http_auth_handler_factory.get(),
- NULL,
- NULL);
+ net::HttpNetworkSession::Params params;
+ params.client_socket_factory =
+ session_deps->deterministic_socket_factory.get();
+ params.host_resolver = session_deps->host_resolver.get();
+ params.cert_verifier = session_deps->cert_verifier.get();
+ params.proxy_service = session_deps->proxy_service;
+ params.ssl_config_service = session_deps->ssl_config_service;
+ params.http_auth_handler_factory =
+ session_deps->http_auth_handler_factory.get();
+ return new HttpNetworkSession(params);
}
SpdyURLRequestContext::SpdyURLRequestContext() {
@@ -925,20 +920,16 @@ SpdyURLRequestContext::SpdyURLRequestContext() {
ssl_config_service_ = new SSLConfigServiceDefaults;
http_auth_handler_factory_ = HttpAuthHandlerFactory::CreateDefault(
host_resolver_);
+ net::HttpNetworkSession::Params params;
+ params.client_socket_factory = &socket_factory_;
+ params.host_resolver = host_resolver_;
+ params.cert_verifier = cert_verifier_;
+ params.proxy_service = proxy_service_;
+ params.ssl_config_service = ssl_config_service_;
+ params.http_auth_handler_factory = http_auth_handler_factory_;
+ params.network_delegate = network_delegate_;
scoped_refptr<HttpNetworkSession> network_session(
- new HttpNetworkSession(
- host_resolver_,
- cert_verifier_,
- NULL /* dnsrr_resolver */,
- NULL /* dns_cert_checker */,
- NULL /* ssl_host_info_factory */,
- proxy_service_,
- &socket_factory_,
- ssl_config_service_,
- new SpdySessionPool(NULL),
- http_auth_handler_factory_,
- network_delegate_,
- NULL /* net_log */));
+ new HttpNetworkSession(params));
http_transaction_factory_ = new HttpCache(
network_session,
HttpCache::DefaultBackend::InMemory(0));
diff --git a/net/spdy/spdy_test_util.h b/net/spdy/spdy_test_util.h
index 8839514..7bd78b6 100644
--- a/net/spdy/spdy_test_util.h
+++ b/net/spdy/spdy_test_util.h
@@ -19,7 +19,6 @@
#include "net/proxy/proxy_service.h"
#include "net/socket/socket_test_util.h"
#include "net/spdy/spdy_framer.h"
-#include "net/spdy/spdy_session_pool.h"
#include "net/url_request/url_request_context.h"
namespace net {
diff --git a/net/tools/fetch/fetch_client.cc b/net/tools/fetch/fetch_client.cc
index 8ba7534..31e4001 100644
--- a/net/tools/fetch/fetch_client.cc
+++ b/net/tools/fetch/fetch_client.cc
@@ -24,8 +24,6 @@
#include "net/http/http_request_info.h"
#include "net/http/http_transaction.h"
#include "net/proxy/proxy_service.h"
-#include "net/socket/client_socket_factory.h"
-#include "net/spdy/spdy_session_pool.h"
void usage(const char* program_name) {
printf("usage: %s --url=<url> [--n=<clients>] [--stats] [--use_cache]\n",
@@ -151,20 +149,16 @@ int main(int argc, char**argv) {
net::HttpTransactionFactory* factory = NULL;
scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory(
net::HttpAuthHandlerFactory::CreateDefault(host_resolver.get()));
+
+ net::HttpNetworkSession::Params session_params;
+ session_params.host_resolver = host_resolver.get();
+ session_params.cert_verifier = cert_verifier.get();
+ session_params.proxy_service = proxy_service;
+ session_params.http_auth_handler_factory = http_auth_handler_factory.get();
+ session_params.ssl_config_service = ssl_config_service;
+
scoped_refptr<net::HttpNetworkSession> network_session(
- new net::HttpNetworkSession(
- host_resolver.get(),
- cert_verifier.get(),
- NULL /* dnsrr_resolver */,
- NULL /* dns_cert_checker */,
- NULL /* ssl_host_info_factory */,
- proxy_service,
- net::ClientSocketFactory::GetDefaultFactory(),
- ssl_config_service,
- new net::SpdySessionPool(NULL),
- http_auth_handler_factory.get(),
- NULL,
- NULL));
+ new net::HttpNetworkSession(session_params));
if (use_cache) {
factory = new net::HttpCache(network_session,
net::HttpCache::DefaultBackend::InMemory(0));
diff --git a/net/url_request/url_request_test_util.cc b/net/url_request/url_request_test_util.cc
index 5053f35..3e93648 100644
--- a/net/url_request/url_request_test_util.cc
+++ b/net/url_request/url_request_test_util.cc
@@ -8,8 +8,6 @@
#include "base/message_loop.h"
#include "base/threading/thread.h"
#include "net/http/http_network_session.h"
-#include "net/socket/client_socket_factory.h"
-#include "net/spdy/spdy_session_pool.h"
TestCookiePolicy::TestCookiePolicy(int options_bit_mask)
: ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)),
@@ -112,20 +110,16 @@ void TestURLRequestContext::Init() {
ssl_config_service_ = new net::SSLConfigServiceDefaults;
http_auth_handler_factory_ = net::HttpAuthHandlerFactory::CreateDefault(
host_resolver_);
+ net::HttpNetworkSession::Params params;
+ params.host_resolver = host_resolver_;
+ params.cert_verifier = cert_verifier_;
+ params.proxy_service = proxy_service_;
+ params.ssl_config_service = ssl_config_service_;
+ params.http_auth_handler_factory = http_auth_handler_factory_;
+ params.network_delegate = network_delegate_;
+
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_,
- network_delegate_,
- NULL),
+ new net::HttpNetworkSession(params),
net::HttpCache::DefaultBackend::InMemory(0));
// In-memory cookie store.
cookie_store_ = new net::CookieMonster(NULL, NULL);