Chromium Code Reviews| 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 "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1722 for (FtpSocketDataProvider::State state : kFailingStates) { | 1722 for (FtpSocketDataProvider::State state : kFailingStates) { |
| 1723 LOG(ERROR) << "??: " << state; | 1723 LOG(ERROR) << "??: " << state; |
| 1724 SetUpTransaction(); | 1724 SetUpTransaction(); |
| 1725 FtpSocketDataProviderFileDownload ctrl_socket; | 1725 FtpSocketDataProviderFileDownload ctrl_socket; |
| 1726 ctrl_socket.InjectFailure(state, FtpSocketDataProvider::PRE_QUIT, | 1726 ctrl_socket.InjectFailure(state, FtpSocketDataProvider::PRE_QUIT, |
| 1727 "157 Foo\r\n"); | 1727 "157 Foo\r\n"); |
| 1728 ExecuteTransaction(&ctrl_socket, "ftp://host/file", ERR_INVALID_RESPONSE); | 1728 ExecuteTransaction(&ctrl_socket, "ftp://host/file", ERR_INVALID_RESPONSE); |
| 1729 } | 1729 } |
| 1730 } | 1730 } |
| 1731 | 1731 |
| 1732 // Make sure that receiving extra unexpected responses correctly results in | |
| 1733 // sending a QUIT message, without triggering a DCHECK. | |
| 1734 TEST_P(FtpNetworkTransactionTest, ExtraResponses) { | |
| 1735 FtpSocketDataProviderDirectoryListing ctrl_socket; | |
| 1736 ctrl_socket.InjectFailure(FtpSocketDataProvider::PRE_TYPE, | |
| 1737 FtpSocketDataProvider::PRE_QUIT, | |
| 1738 "157 Foo\r\n" | |
| 1739 "157 Bar\r\n" | |
| 1740 "157 Trombones\r\n"); | |
| 1741 ExecuteTransaction(&ctrl_socket, "ftp://host/", ERR_INVALID_RESPONSE); | |
| 1742 } | |
| 1743 | |
| 1744 // Make sure that receiving extra unexpected responses to a QUIT message | |
| 1745 // correctly results in ending the transaction with an error, without triggering | |
| 1746 // a DCHECK. | |
| 1747 TEST_P(FtpNetworkTransactionTest, ExtraQuitResponses) { | |
|
mmenke
2016/11/28 17:43:08
This one would have passed before, since Stop() ha
| |
| 1748 FtpSocketDataProviderDirectoryListing ctrl_socket; | |
| 1749 ctrl_socket.InjectFailure(FtpSocketDataProvider::PRE_QUIT, | |
| 1750 FtpSocketDataProvider::QUIT, | |
| 1751 "221 Foo\r\n" | |
| 1752 "221 Bar\r\n" | |
| 1753 "221 Trombones\r\n"); | |
| 1754 ExecuteTransaction(&ctrl_socket, "ftp://host/", ERR_INVALID_RESPONSE); | |
| 1755 } | |
| 1756 | |
| 1732 INSTANTIATE_TEST_CASE_P(FTP, | 1757 INSTANTIATE_TEST_CASE_P(FTP, |
| 1733 FtpNetworkTransactionTest, | 1758 FtpNetworkTransactionTest, |
| 1734 ::testing::Values(AF_INET, AF_INET6)); | 1759 ::testing::Values(AF_INET, AF_INET6)); |
| 1735 | 1760 |
| 1736 } // namespace net | 1761 } // namespace net |
| OLD | NEW |