| OLD | NEW |
| 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/ftp/ftp_auth_cache.h" | 5 #include "net/ftp/ftp_auth_cache.h" |
| 6 #include "net/ftp/ftp_transaction.h" | 6 #include "net/ftp/ftp_transaction.h" |
| 7 #include "net/ftp/ftp_transaction_factory.h" | 7 #include "net/ftp/ftp_transaction_factory.h" |
| 8 #include "net/url_request/ftp_protocol_handler.h" | 8 #include "net/url_request/ftp_protocol_handler.h" |
| 9 #include "net/url_request/url_request.h" | 9 #include "net/url_request/url_request.h" |
| 10 #include "net/url_request/url_request_context.h" | 10 #include "net/url_request/url_request_context.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 ::testing::StrictMock<MockFtpTransactionFactory> ftp_transaction_factory; | 51 ::testing::StrictMock<MockFtpTransactionFactory> ftp_transaction_factory; |
| 52 ::testing::StrictMock<MockURLRequestDelegate> delegate; | 52 ::testing::StrictMock<MockURLRequestDelegate> delegate; |
| 53 FtpAuthCache ftp_auth_cache; | 53 FtpAuthCache ftp_auth_cache; |
| 54 | 54 |
| 55 GURL url("ftp://example.com"); | 55 GURL url("ftp://example.com"); |
| 56 URLRequestContext context; | 56 URLRequestContext context; |
| 57 URLRequest url_request(url, &delegate, &context); | 57 URLRequest url_request(url, &delegate, &context); |
| 58 | 58 |
| 59 FtpProtocolHandler ftp_protocol_handler( | 59 FtpProtocolHandler ftp_protocol_handler( |
| 60 NULL, &ftp_transaction_factory, &ftp_auth_cache); | 60 &ftp_transaction_factory, &ftp_auth_cache); |
| 61 | 61 |
| 62 scoped_refptr<URLRequestJob> ftp_job( | 62 scoped_refptr<URLRequestJob> ftp_job( |
| 63 ftp_protocol_handler.MaybeCreateJob(&url_request)); | 63 ftp_protocol_handler.MaybeCreateJob(&url_request, NULL)); |
| 64 ASSERT_TRUE(ftp_job.get()); | 64 ASSERT_TRUE(ftp_job.get()); |
| 65 | 65 |
| 66 EXPECT_CALL(ftp_transaction_factory, CreateTransaction()) | 66 EXPECT_CALL(ftp_transaction_factory, CreateTransaction()) |
| 67 .WillOnce(Return(static_cast<FtpTransaction*>(NULL))); | 67 .WillOnce(Return(static_cast<FtpTransaction*>(NULL))); |
| 68 ftp_job->Start(); | 68 ftp_job->Start(); |
| 69 EXPECT_CALL(delegate, OnResponseStarted(_)) | 69 EXPECT_CALL(delegate, OnResponseStarted(_)) |
| 70 .WillOnce(HandleOnResponseStarted(URLRequestStatus::FAILED)); | 70 .WillOnce(HandleOnResponseStarted(URLRequestStatus::FAILED)); |
| 71 MessageLoop::current()->RunAllPending(); | 71 MessageLoop::current()->RunAllPending(); |
| 72 EXPECT_FALSE(url_request.is_pending()); | 72 EXPECT_FALSE(url_request.is_pending()); |
| 73 } | 73 } |
| 74 | 74 |
| 75 } // namespace net | 75 } // namespace net |
| OLD | NEW |