summaryrefslogtreecommitdiffstats
path: root/net/ftp/ftp_network_transaction_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'net/ftp/ftp_network_transaction_unittest.cc')
-rw-r--r--net/ftp/ftp_network_transaction_unittest.cc31
1 files changed, 5 insertions, 26 deletions
diff --git a/net/ftp/ftp_network_transaction_unittest.cc b/net/ftp/ftp_network_transaction_unittest.cc
index 95b1e8e..140a37d 100644
--- a/net/ftp/ftp_network_transaction_unittest.cc
+++ b/net/ftp/ftp_network_transaction_unittest.cc
@@ -47,7 +47,6 @@ class FtpMockControlSocket : public DynamicMockSocket {
PRE_MDTM,
PRE_LIST,
PRE_RETR,
- PRE_PASV2,
PRE_CWD,
PRE_QUIT,
QUIT
@@ -83,7 +82,7 @@ class FtpMockControlSocket : public DynamicMockSocket {
"200 TYPE is now 8-bit binary\r\n");
case PRE_PASV:
return Verify("PASV\r\n", data, PRE_SIZE,
- "227 Entering Passive Mode (127,0,0,1,123,456)\r\n");
+ "227 Entering Passive Mode 127,0,0,1,123,456\r\n");
case PRE_QUIT:
return Verify("QUIT\r\n", data, QUIT, "221 Goodbye.\r\n");
default:
@@ -171,12 +170,8 @@ class FtpMockControlSocketDirectoryListing : public FtpMockControlSocket {
return Verify("MDTM /\r\n", data, PRE_RETR,
"213 20070221112533\r\n");
case PRE_RETR:
- return Verify("RETR /\r\n", data, PRE_PASV2,
+ return Verify("RETR /\r\n", data, PRE_CWD,
"550 Can't download directory\r\n");
- case PRE_PASV2:
- // Parser should also accept format without parentheses.
- return Verify("PASV\r\n", data, PRE_CWD,
- "227 Entering Passive Mode 127,0,0,1,123,456\r\n");
case PRE_CWD:
return Verify("CWD /\r\n", data, PRE_LIST, "200 OK\r\n");
case PRE_LIST:
@@ -298,9 +293,6 @@ class FtpMockControlSocketFileDownloadRetrFail
if (InjectFault())
return MockWriteResult(true, data.length());
switch (state()) {
- case PRE_PASV2:
- return Verify("PASV\r\n", data, PRE_CWD,
- "227 Entering Passive Mode (127,0,0,1,123,456)\r\n");
case PRE_CWD:
return Verify("CWD /file\r\n", data, PRE_QUIT,
"550 file is a directory\r\n");
@@ -391,12 +383,9 @@ class FtpNetworkTransactionTest : public PlatformTest {
MockRead data_reads[] = {
MockRead(mock_data.c_str()),
};
- // TODO(phajdan.jr): FTP transaction should not open two data sockets.
- StaticMockSocket data_socket1(data_reads, NULL);
- StaticMockSocket data_socket2(data_reads, NULL);
+ StaticMockSocket data_socket(data_reads, NULL);
mock_socket_factory_.AddMockSocket(ctrl_socket);
- mock_socket_factory_.AddMockSocket(&data_socket1);
- mock_socket_factory_.AddMockSocket(&data_socket2);
+ mock_socket_factory_.AddMockSocket(&data_socket);
FtpRequestInfo request_info = GetRequestInfo(request);
EXPECT_EQ(LOAD_STATE_IDLE, transaction_.GetLoadState());
ASSERT_EQ(ERR_IO_PENDING,
@@ -774,16 +763,6 @@ TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFailMdtm) {
OK);
}
-TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFailPasv2) {
- FtpMockControlSocketDirectoryListing ctrl_socket;
- TransactionFailHelper(&ctrl_socket,
- "ftp://host",
- FtpMockControlSocket::PRE_PASV2,
- FtpMockControlSocket::PRE_QUIT,
- "500 failed pasv\r\n",
- ERR_FAILED);
-}
-
TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFailCwd) {
FtpMockControlSocketDirectoryListing ctrl_socket;
TransactionFailHelper(&ctrl_socket,
@@ -899,7 +878,7 @@ TEST_F(FtpNetworkTransactionTest, DownloadTransactionFileNotFound) {
TransactionFailHelper(&ctrl_socket,
"ftp://host/file",
FtpMockControlSocket::PRE_RETR,
- FtpMockControlSocket::PRE_PASV2,
+ FtpMockControlSocket::PRE_CWD,
"550 cannot open file\r\n",
ERR_FILE_NOT_FOUND);
}