Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(843)

Unified Diff: net/url_request/url_request_unittest.cc

Issue 11931024: Removed static factories for data, ftp, file, and about jobs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address erikwright's comments Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/url_request/url_request_unittest.cc
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc
index 6e22588cad553eda8fdb90c314bcfb38ff69c5f7..92f6a9d34b816c2023d5ef1b0031e8e10343f822 100644
--- a/net/url_request/url_request_unittest.cc
+++ b/net/url_request/url_request_unittest.cc
@@ -55,6 +55,8 @@
#include "net/proxy/proxy_service.h"
#include "net/socket/ssl_client_socket.h"
#include "net/test/test_server.h"
+#include "net/url_request/data_protocol_handler.h"
+#include "net/url_request/file_protocol_handler.h"
#include "net/url_request/ftp_protocol_handler.h"
#include "net/url_request/static_http_user_agent_settings.h"
#include "net/url_request/url_request.h"
@@ -464,6 +466,9 @@ class URLRequestTest : public PlatformTest {
public:
URLRequestTest() : default_context_(true) {
default_context_.set_network_delegate(&default_network_delegate_);
+ job_factory_.SetProtocolHandler("data", new DataProtocolHandler);
+ job_factory_.SetProtocolHandler("file", new FileProtocolHandler);
+ default_context_.set_job_factory(&job_factory_);
default_context_.Init();
}
virtual ~URLRequestTest() {}
@@ -471,15 +476,13 @@ class URLRequestTest : public PlatformTest {
// Adds the TestJobInterceptor to the default context.
TestJobInterceptor* AddTestInterceptor() {
TestJobInterceptor* protocol_handler_ = new TestJobInterceptor();
- job_factory_.reset(new URLRequestJobFactoryImpl);
- job_factory_->SetProtocolHandler("http", protocol_handler_);
- default_context_.set_job_factory(job_factory_.get());
+ job_factory_.SetProtocolHandler("http", protocol_handler_);
return protocol_handler_;
}
protected:
TestNetworkDelegate default_network_delegate_; // Must outlive URLRequest.
- scoped_ptr<URLRequestJobFactoryImpl> job_factory_;
+ URLRequestJobFactoryImpl job_factory_;
TestURLRequestContext default_context_;
};
@@ -4853,15 +4856,12 @@ TEST_F(URLRequestTestFTP, UnsafePort) {
ASSERT_TRUE(test_server_.Start());
URLRequestJobFactoryImpl job_factory;
+ FtpNetworkLayer ftp_transaction_factory(default_context_.host_resolver());
GURL url("ftp://127.0.0.1:7");
- FtpProtocolHandler ftp_protocol_handler(
- default_context_.ftp_transaction_factory(),
- default_context_.ftp_auth_cache());
job_factory.SetProtocolHandler(
"ftp",
- new FtpProtocolHandler(default_context_.ftp_transaction_factory(),
- default_context_.ftp_auth_cache()));
+ new FtpProtocolHandler(&ftp_transaction_factory));
default_context_.set_job_factory(&job_factory);
TestDelegate d;

Powered by Google App Engine
This is Rietveld 408576698