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

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

Issue 1295523006: Using scoped_ptr for URLRequestJobFactoryImpl::SetProtocolHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 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 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 "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 FtpTestURLRequestContext(ClientSocketFactory* socket_factory, 50 FtpTestURLRequestContext(ClientSocketFactory* socket_factory,
51 ProxyService* proxy_service, 51 ProxyService* proxy_service,
52 NetworkDelegate* network_delegate, 52 NetworkDelegate* network_delegate,
53 FtpTransactionFactory* ftp_transaction_factory) 53 FtpTransactionFactory* ftp_transaction_factory)
54 : TestURLRequestContext(true), 54 : TestURLRequestContext(true),
55 ftp_protocol_handler_(new FtpProtocolHandler(ftp_transaction_factory)) { 55 ftp_protocol_handler_(new FtpProtocolHandler(ftp_transaction_factory)) {
56 set_client_socket_factory(socket_factory); 56 set_client_socket_factory(socket_factory);
57 context_storage_.set_proxy_service(proxy_service); 57 context_storage_.set_proxy_service(proxy_service);
58 set_network_delegate(network_delegate); 58 set_network_delegate(network_delegate);
59 URLRequestJobFactoryImpl* job_factory = new URLRequestJobFactoryImpl; 59 URLRequestJobFactoryImpl* job_factory = new URLRequestJobFactoryImpl;
60 job_factory->SetProtocolHandler("ftp", ftp_protocol_handler_); 60 job_factory->SetProtocolHandler("ftp",
61 make_scoped_ptr(ftp_protocol_handler_));
61 context_storage_.set_job_factory(job_factory); 62 context_storage_.set_job_factory(job_factory);
62 Init(); 63 Init();
63 } 64 }
64 65
65 FtpAuthCache* GetFtpAuthCache() { 66 FtpAuthCache* GetFtpAuthCache() {
66 return ftp_protocol_handler_->ftp_auth_cache_.get(); 67 return ftp_protocol_handler_->ftp_auth_cache_.get();
67 } 68 }
68 69
69 void set_proxy_service(ProxyService* proxy_service) { 70 void set_proxy_service(ProxyService* proxy_service) {
70 context_storage_.set_proxy_service(proxy_service); 71 context_storage_.set_proxy_service(proxy_service);
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 EXPECT_TRUE(url_request2->status().is_success()); 727 EXPECT_TRUE(url_request2->status().is_success());
727 EXPECT_EQ(2, network_delegate()->completed_requests()); 728 EXPECT_EQ(2, network_delegate()->completed_requests());
728 EXPECT_EQ(0, network_delegate()->error_count()); 729 EXPECT_EQ(0, network_delegate()->error_count());
729 EXPECT_FALSE(request_delegate2.auth_required_called()); 730 EXPECT_FALSE(request_delegate2.auth_required_called());
730 EXPECT_EQ("test2.html", request_delegate2.data_received()); 731 EXPECT_EQ("test2.html", request_delegate2.data_received());
731 } 732 }
732 733
733 } // namespace 734 } // namespace
734 735
735 } // namespace net 736 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698