| 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_network_transaction.h" | 5 #include "net/ftp/ftp_network_transaction.h" |
| 6 | 6 |
| 7 #include <deque> | 7 #include <deque> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1698 TEST_P(FtpNetworkTransactionTest, ExtraQuitResponses) { | 1698 TEST_P(FtpNetworkTransactionTest, ExtraQuitResponses) { |
| 1699 FtpSocketDataProviderDirectoryListing ctrl_socket; | 1699 FtpSocketDataProviderDirectoryListing ctrl_socket; |
| 1700 ctrl_socket.InjectFailure(FtpSocketDataProvider::PRE_QUIT, | 1700 ctrl_socket.InjectFailure(FtpSocketDataProvider::PRE_QUIT, |
| 1701 FtpSocketDataProvider::QUIT, | 1701 FtpSocketDataProvider::QUIT, |
| 1702 "221 Foo\r\n" | 1702 "221 Foo\r\n" |
| 1703 "221 Bar\r\n" | 1703 "221 Bar\r\n" |
| 1704 "221 Trombones\r\n"); | 1704 "221 Trombones\r\n"); |
| 1705 ExecuteTransaction(&ctrl_socket, "ftp://host/", ERR_INVALID_RESPONSE); | 1705 ExecuteTransaction(&ctrl_socket, "ftp://host/", ERR_INVALID_RESPONSE); |
| 1706 } | 1706 } |
| 1707 | 1707 |
| 1708 // Test case for https://crbug.com/633841 - similar to the ExtraQuitResponses |
| 1709 // test case, but with an empty response. |
| 1710 TEST_P(FtpNetworkTransactionTest, EmptyQuitResponse) { |
| 1711 FtpSocketDataProviderDirectoryListing ctrl_socket; |
| 1712 ctrl_socket.InjectFailure(FtpSocketDataProvider::PRE_QUIT, |
| 1713 FtpSocketDataProvider::QUIT, ""); |
| 1714 ExecuteTransaction(&ctrl_socket, "ftp://host/", OK); |
| 1715 } |
| 1716 |
| 1708 TEST_P(FtpNetworkTransactionTest, InvalidRemoteDirectory) { | 1717 TEST_P(FtpNetworkTransactionTest, InvalidRemoteDirectory) { |
| 1709 FtpSocketDataProviderFileDownload ctrl_socket; | 1718 FtpSocketDataProviderFileDownload ctrl_socket; |
| 1710 TransactionFailHelper( | 1719 TransactionFailHelper( |
| 1711 &ctrl_socket, "ftp://host/file", FtpSocketDataProvider::PRE_PWD, | 1720 &ctrl_socket, "ftp://host/file", FtpSocketDataProvider::PRE_PWD, |
| 1712 FtpSocketDataProvider::PRE_QUIT, | 1721 FtpSocketDataProvider::PRE_QUIT, |
| 1713 "257 \"foo\rbar\" is your current location\r\n", ERR_INVALID_RESPONSE); | 1722 "257 \"foo\rbar\" is your current location\r\n", ERR_INVALID_RESPONSE); |
| 1714 } | 1723 } |
| 1715 | 1724 |
| 1716 TEST_P(FtpNetworkTransactionTest, InvalidRemoteDirectory2) { | 1725 TEST_P(FtpNetworkTransactionTest, InvalidRemoteDirectory2) { |
| 1717 FtpSocketDataProviderFileDownload ctrl_socket; | 1726 FtpSocketDataProviderFileDownload ctrl_socket; |
| 1718 TransactionFailHelper( | 1727 TransactionFailHelper( |
| 1719 &ctrl_socket, "ftp://host/file", FtpSocketDataProvider::PRE_PWD, | 1728 &ctrl_socket, "ftp://host/file", FtpSocketDataProvider::PRE_PWD, |
| 1720 FtpSocketDataProvider::PRE_QUIT, | 1729 FtpSocketDataProvider::PRE_QUIT, |
| 1721 "257 \"foo\nbar\" is your current location\r\n", ERR_INVALID_RESPONSE); | 1730 "257 \"foo\nbar\" is your current location\r\n", ERR_INVALID_RESPONSE); |
| 1722 } | 1731 } |
| 1723 | 1732 |
| 1724 INSTANTIATE_TEST_CASE_P(Ftp, | 1733 INSTANTIATE_TEST_CASE_P(Ftp, |
| 1725 FtpNetworkTransactionTest, | 1734 FtpNetworkTransactionTest, |
| 1726 ::testing::Values(AF_INET, AF_INET6)); | 1735 ::testing::Values(AF_INET, AF_INET6)); |
| 1727 | 1736 |
| 1728 } // namespace net | 1737 } // namespace net |
| OLD | NEW |