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

Unified Diff: net/url_request/url_request_unittest.cc

Issue 10836206: Removed static factories for data, ftp, file, and about jobs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: small fix Created 8 years, 4 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
« no previous file with comments | « net/url_request/url_request_job_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 406dabf945dacbd0446bec0ecf7c50f2956c16ee..3e309dff023704b6be06f10cb0974a5bf1dcc697 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"
@@ -2433,6 +2435,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.
@@ -2477,6 +2483,10 @@ 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_.set_job_factory(&job_factory);
+
TestDelegate d;
{
URLRequest r(app_url, &d, &default_context_);
@@ -2517,6 +2527,10 @@ 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_.set_job_factory(&job_factory);
+
TestDelegate d;
{
URLRequest r(temp_url, &d, &default_context_);
@@ -2561,6 +2575,10 @@ 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_.set_job_factory(&job_factory);
+
TestDelegate d;
{
URLRequest r(temp_url, &d, &default_context_);
@@ -2782,6 +2800,10 @@ 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_.set_job_factory(&job_factory);
+
TestDelegate d;
URLRequest req(FilePathToFileURL(path), &d, &default_context_);
req.Start();
@@ -2809,6 +2831,10 @@ TEST_F(URLRequestTest, FileDirRedirectSingleSlash) {
TEST_F(URLRequestTestHTTP, RestrictRedirects) {
ASSERT_TRUE(test_server_.Start());
+ URLRequestJobFactory job_factory;
+ job_factory.SetProtocolHandler("file", new FileProtocolHandler());
+ default_context_.set_job_factory(&job_factory);
+
TestDelegate d;
URLRequest req(test_server_.GetURL(
"files/redirect-to-file.html"), &d, &default_context_);
@@ -4171,9 +4197,6 @@ TEST_F(URLRequestTestFTP, UnsafePort) {
URLRequestJobFactoryImpl job_factory;
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(),
« no previous file with comments | « net/url_request/url_request_job_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698