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

Unified Diff: net/ftp/ftp_network_transaction_unittest.cc

Issue 340054: Correctly handle FTP servers which unexpectedly close the control connection. (Closed)
Patch Set: Created 11 years, 2 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 side-by-side diff with in-line comments
Download patch
« net/ftp/ftp_network_transaction.cc ('K') | « net/ftp/ftp_network_transaction.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ftp/ftp_network_transaction_unittest.cc
diff --git a/net/ftp/ftp_network_transaction_unittest.cc b/net/ftp/ftp_network_transaction_unittest.cc
index af86b130959bd5d7699c0145c1c6c04fb1de5fc2..169e7886abb5ab4c156841df4fc635300464e4e3 100644
--- a/net/ftp/ftp_network_transaction_unittest.cc
+++ b/net/ftp/ftp_network_transaction_unittest.cc
@@ -502,6 +502,27 @@ class FtpMockControlSocketEvilLogin : public FtpMockControlSocketFileDownload {
DISALLOW_COPY_AND_ASSIGN(FtpMockControlSocketEvilLogin);
};
+class FtpMockControlSocketCloseConnection : public FtpMockControlSocket {
+ public:
+ FtpMockControlSocketCloseConnection() {
+ }
+
+ virtual MockWriteResult OnWrite(const std::string& data) {
+ if (InjectFault())
+ return MockWriteResult(true, data.length());
+ switch (state()) {
+ case PRE_USER:
+ return Verify("USER anonymous\r\n", data,
+ PRE_QUIT, "");
+ default:
+ return FtpMockControlSocket::OnWrite(data);
+ }
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(FtpMockControlSocketCloseConnection);
+};
+
class FtpNetworkTransactionTest : public PlatformTest {
public:
FtpNetworkTransactionTest()
@@ -849,6 +870,12 @@ TEST_F(FtpNetworkTransactionTest, Escaping) {
OK);
}
+// Regression test for http://crbug.com/25023.
+TEST_F(FtpNetworkTransactionTest, CloseConnection) {
+ FtpMockControlSocketCloseConnection ctrl_socket;
+ ExecuteTransaction(&ctrl_socket, "ftp://host", ERR_EMPTY_RESPONSE);
+}
+
TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFailUser) {
FtpMockControlSocketDirectoryListing ctrl_socket;
TransactionFailHelper(&ctrl_socket,
« net/ftp/ftp_network_transaction.cc ('K') | « net/ftp/ftp_network_transaction.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698