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 3ded0da89abf99743a6ee8005910bef6d85c133f..9629bf69d13dd3eec36eba3f096fb1acd7ce0fe0 100644 |
--- a/net/url_request/url_request_unittest.cc |
+++ b/net/url_request/url_request_unittest.cc |
@@ -52,6 +52,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/url_request.h" |
#include "net/url_request/url_request_file_dir_job.h" |
@@ -2430,6 +2432,10 @@ TEST_F(URLRequestTest, AboutBlankTest) { |
} |
TEST_F(URLRequestTest, DataURLImageTest) { |
+ URLRequestJobFactory job_factory; |
+ job_factory.SetProtocolHandler("data", new DataProtocolHandler()); |
+ default_context_.set_job_factory(&job_factory); |
+ |
TestDelegate d; |
{ |
// Use our nice little Chrome logo. |
@@ -2474,6 +2480,12 @@ TEST_F(URLRequestTest, FileTest) { |
PathService::Get(base::FILE_EXE, &app_path); |
GURL app_url = FilePathToFileURL(app_path); |
+ URLRequestJobFactory job_factory; |
+ job_factory.SetProtocolHandler( |
+ "file", |
+ new FileProtocolHandler(default_context_.network_delegate())); |
+ default_context_.set_job_factory(&job_factory); |
+ |
TestDelegate d; |
{ |
URLRequest r(app_url, &d, &default_context_); |
@@ -2514,6 +2526,12 @@ TEST_F(URLRequestTest, FileTestFullSpecifiedRange) { |
std::string partial_buffer_string(buffer.get() + first_byte_position, |
buffer.get() + last_byte_position + 1); |
+ URLRequestJobFactory job_factory; |
+ job_factory.SetProtocolHandler( |
+ "file", |
+ new FileProtocolHandler(default_context_.network_delegate())); |
+ default_context_.set_job_factory(&job_factory); |
+ |
TestDelegate d; |
{ |
URLRequest r(temp_url, &d, &default_context_); |
@@ -2558,6 +2576,12 @@ TEST_F(URLRequestTest, FileTestHalfSpecifiedRange) { |
std::string partial_buffer_string(buffer.get() + first_byte_position, |
buffer.get() + last_byte_position + 1); |
+ URLRequestJobFactory job_factory; |
+ job_factory.SetProtocolHandler( |
+ "file", |
+ new FileProtocolHandler(default_context_.network_delegate())); |
+ default_context_.set_job_factory(&job_factory); |
+ |
TestDelegate d; |
{ |
URLRequest r(temp_url, &d, &default_context_); |
@@ -2779,6 +2803,12 @@ TEST_F(URLRequestTest, FileDirRedirectNoCrash) { |
path = path.Append(FILE_PATH_LITERAL("data")); |
path = path.Append(FILE_PATH_LITERAL("url_request_unittest")); |
+ URLRequestJobFactory job_factory; |
+ job_factory.SetProtocolHandler( |
+ "file", |
+ new FileProtocolHandler(default_context_.network_delegate())); |
+ default_context_.set_job_factory(&job_factory); |
+ |
TestDelegate d; |
URLRequest req(FilePathToFileURL(path), &d, &default_context_); |
req.Start(); |
@@ -2806,6 +2836,12 @@ TEST_F(URLRequestTest, FileDirRedirectSingleSlash) { |
TEST_F(URLRequestTestHTTP, RestrictRedirects) { |
ASSERT_TRUE(test_server_.Start()); |
+ URLRequestJobFactory job_factory; |
+ job_factory.SetProtocolHandler( |
+ "file", |
+ new FileProtocolHandler(default_context_.network_delegate())); |
+ default_context_.set_job_factory(&job_factory); |
+ |
TestDelegate d; |
URLRequest req(test_server_.GetURL( |
"files/redirect-to-file.html"), &d, &default_context_); |
@@ -4160,10 +4196,6 @@ TEST_F(URLRequestTestFTP, UnsafePort) { |
URLRequestJobFactory job_factory; |
GURL url("ftp://127.0.0.1:7"); |
- FtpProtocolHandler ftp_protocol_handler( |
- default_context_.network_delegate(), |
- default_context_.ftp_transaction_factory(), |
- default_context_.ftp_auth_cache()); |
job_factory.SetProtocolHandler( |
"ftp", |
new FtpProtocolHandler(default_context_.network_delegate(), |