summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-03 21:48:34 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-03 21:48:34 +0000
commit9e1bdd3f9785ed8a84a137c98b781ddaec41b080 (patch)
tree36d3550cc6d9db08bf3a18fbb42668d440a94b56 /chrome/test
parent966c57777b2c18313cddd8e36d109665f5377521 (diff)
downloadchromium_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/test')
-rw-r--r--chrome/test/plugin/plugin_test.cpp73
1 files changed, 2 insertions, 71 deletions
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,