Clean up FtpTransactionFacory ownership.
Previously, it was owned by the ProfileImplIOData, which is deleted
before the ProfileIOData, which owns the URLRequestContext. Now it's
owned by the FtpProtocolHandler, which is owned by the
URLRequestJobFactory. This also makes URLRequestContext creation a bit
simpler.
With this CL, isolated app URLRequestContexts now have their own
FtpTransactionFactories. Since FTP connections aren't pooled, and the
FTP auth cache is owned by a higher layer, this effectively makes no
difference.
BUG=657135
Review-Url: https://chromiumcodereview.appspot.com/2428143002
Cr-Commit-Position: refs/heads/master@{#426248}
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc
index 5b98e35..e8711919 100644
--- a/net/url_request/url_request_unittest.cc
+++ b/net/url_request/url_request_unittest.cc
@@ -9858,8 +9858,7 @@
class URLRequestTestFTP : public URLRequestTest {
public:
URLRequestTestFTP()
- : ftp_transaction_factory_(&host_resolver_),
- ftp_test_server_(SpawnedTestServer::TYPE_FTP,
+ : ftp_test_server_(SpawnedTestServer::TYPE_FTP,
SpawnedTestServer::kLocalhost,
base::FilePath(kTestFilePath)) {
// Can't use |default_context_|'s HostResolver to set up the
@@ -9871,7 +9870,7 @@
void SetUpFactory() override {
// Add FTP support to the default URLRequestContext.
job_factory_impl_->SetProtocolHandler(
- "ftp", base::MakeUnique<FtpProtocolHandler>(&ftp_transaction_factory_));
+ "ftp", FtpProtocolHandler::Create(&host_resolver_));
}
std::string GetTestFileContents() {
@@ -9885,8 +9884,10 @@
}
protected:
+ // Note that this is destroyed before the FtpProtocolHandler that references
+ // it, which is owned by the parent class. Since no requests are made during
+ // teardown, this works, though it's not great.
MockHostResolver host_resolver_;
- FtpNetworkLayer ftp_transaction_factory_;
SpawnedTestServer ftp_test_server_;
};