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

Side by Side Diff: net/url_request/url_request_ftp_job_unittest.cc

Issue 1888963004: Add HttpProtocolHandler and convert everything to use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-supports-scheme
Patch Set: even more rebase Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/url_request/url_request_ftp_job.h" 5 #include "net/url_request/url_request_ftp_job.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 FtpTestURLRequestContext(ClientSocketFactory* socket_factory, 65 FtpTestURLRequestContext(ClientSocketFactory* socket_factory,
66 std::unique_ptr<ProxyService> proxy_service, 66 std::unique_ptr<ProxyService> proxy_service,
67 NetworkDelegate* network_delegate, 67 NetworkDelegate* network_delegate,
68 FtpTransactionFactory* ftp_transaction_factory) 68 FtpTransactionFactory* ftp_transaction_factory)
69 : TestURLRequestContext(true), 69 : TestURLRequestContext(true),
70 ftp_protocol_handler_(new FtpProtocolHandler(ftp_transaction_factory)) { 70 ftp_protocol_handler_(new FtpProtocolHandler(ftp_transaction_factory)) {
71 set_client_socket_factory(socket_factory); 71 set_client_socket_factory(socket_factory);
72 context_storage_.set_proxy_service(std::move(proxy_service)); 72 context_storage_.set_proxy_service(std::move(proxy_service));
73 set_network_delegate(network_delegate); 73 set_network_delegate(network_delegate);
74 std::unique_ptr<URLRequestJobFactoryImpl> job_factory = 74 std::unique_ptr<URLRequestJobFactoryImpl> job_factory =
75 base::WrapUnique(new URLRequestJobFactoryImpl); 75 URLRequestJobFactoryImpl::CreateWithDefaultProtocolHandlers();
76
76 job_factory->SetProtocolHandler("ftp", 77 job_factory->SetProtocolHandler("ftp",
77 base::WrapUnique(ftp_protocol_handler_)); 78 base::WrapUnique(ftp_protocol_handler_));
78 context_storage_.set_job_factory(std::move(job_factory)); 79 context_storage_.set_job_factory(std::move(job_factory));
79 Init(); 80 Init();
80 } 81 }
81 82
82 FtpAuthCache* GetFtpAuthCache() { 83 FtpAuthCache* GetFtpAuthCache() {
83 return ftp_protocol_handler_->ftp_auth_cache_.get(); 84 return ftp_protocol_handler_->ftp_auth_cache_.get();
84 } 85 }
85 86
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 EXPECT_TRUE(url_request2->status().is_success()); 793 EXPECT_TRUE(url_request2->status().is_success());
793 EXPECT_EQ(2, network_delegate()->completed_requests()); 794 EXPECT_EQ(2, network_delegate()->completed_requests());
794 EXPECT_EQ(0, network_delegate()->error_count()); 795 EXPECT_EQ(0, network_delegate()->error_count());
795 EXPECT_FALSE(request_delegate2.auth_required_called()); 796 EXPECT_FALSE(request_delegate2.auth_required_called());
796 EXPECT_EQ("test2.html", request_delegate2.data_received()); 797 EXPECT_EQ("test2.html", request_delegate2.data_received());
797 } 798 }
798 799
799 } // namespace 800 } // namespace
800 801
801 } // namespace net 802 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698