OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/ref_counted.h" | 9 #include "base/ref_counted.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 case PRE_PWD: | 74 case PRE_PWD: |
75 return Verify("PWD\r\n", data, PRE_TYPE, | 75 return Verify("PWD\r\n", data, PRE_TYPE, |
76 "257 \"/\" is your current location\r\n"); | 76 "257 \"/\" is your current location\r\n"); |
77 case PRE_TYPE: | 77 case PRE_TYPE: |
78 return Verify(std::string("TYPE ") + data_type_ + "\r\n", data, | 78 return Verify(std::string("TYPE ") + data_type_ + "\r\n", data, |
79 PRE_EPSV, "200 TYPE set successfully\r\n"); | 79 PRE_EPSV, "200 TYPE set successfully\r\n"); |
80 case PRE_EPSV: | 80 case PRE_EPSV: |
81 return Verify("EPSV\r\n", data, PRE_SIZE, | 81 return Verify("EPSV\r\n", data, PRE_SIZE, |
82 "227 Entering Extended Passive Mode (|||31744|)\r\n"); | 82 "227 Entering Extended Passive Mode (|||31744|)\r\n"); |
83 case PRE_NOPASV: | 83 case PRE_NOPASV: |
| 84 // Use unallocated 599 FTP error code to make sure it falls into the gen
eric |
| 85 // ERR_FTP_FAILED bucket. |
84 return Verify("PASV\r\n", data, PRE_QUIT, | 86 return Verify("PASV\r\n", data, PRE_QUIT, |
85 "599 fail\r\n"); | 87 "599 fail\r\n"); |
86 case PRE_QUIT: | 88 case PRE_QUIT: |
87 return Verify("QUIT\r\n", data, QUIT, "221 Goodbye.\r\n"); | 89 return Verify("QUIT\r\n", data, QUIT, "221 Goodbye.\r\n"); |
88 default: | 90 default: |
89 NOTREACHED() << "State not handled " << state(); | 91 NOTREACHED() << "State not handled " << state(); |
90 return MockWriteResult(true, ERR_UNEXPECTED); | 92 return MockWriteResult(true, ERR_UNEXPECTED); |
91 } | 93 } |
92 } | 94 } |
93 | 95 |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 : public FtpSocketDataProviderFileDownload { | 468 : public FtpSocketDataProviderFileDownload { |
467 public: | 469 public: |
468 FtpSocketDataProviderFileDownloadInvalidResponse() { | 470 FtpSocketDataProviderFileDownloadInvalidResponse() { |
469 } | 471 } |
470 | 472 |
471 virtual MockWriteResult OnWrite(const std::string& data) { | 473 virtual MockWriteResult OnWrite(const std::string& data) { |
472 if (InjectFault()) | 474 if (InjectFault()) |
473 return MockWriteResult(true, data.length()); | 475 return MockWriteResult(true, data.length()); |
474 switch (state()) { | 476 switch (state()) { |
475 case PRE_SIZE: | 477 case PRE_SIZE: |
| 478 // Use unallocated 599 FTP error code to make sure it falls into the |
| 479 // generic ERR_FTP_FAILED bucket. |
476 return Verify("SIZE /file\r\n", data, PRE_QUIT, | 480 return Verify("SIZE /file\r\n", data, PRE_QUIT, |
477 "599 Evil Response\r\n" | 481 "599 Evil Response\r\n" |
478 "599 More Evil\r\n"); | 482 "599 More Evil\r\n"); |
479 default: | 483 default: |
480 return FtpSocketDataProviderFileDownload::OnWrite(data); | 484 return FtpSocketDataProviderFileDownload::OnWrite(data); |
481 } | 485 } |
482 } | 486 } |
483 | 487 |
484 private: | 488 private: |
485 DISALLOW_COPY_AND_ASSIGN(FtpSocketDataProviderFileDownloadInvalidResponse); | 489 DISALLOW_COPY_AND_ASSIGN(FtpSocketDataProviderFileDownloadInvalidResponse); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 void ExecuteTransaction(FtpSocketDataProvider* ctrl_socket, | 646 void ExecuteTransaction(FtpSocketDataProvider* ctrl_socket, |
643 const char* request, | 647 const char* request, |
644 int expected_result) { | 648 int expected_result) { |
645 std::string mock_data("mock-data"); | 649 std::string mock_data("mock-data"); |
646 MockRead data_reads[] = { | 650 MockRead data_reads[] = { |
647 // Usually FTP servers close the data connection after the entire data has | 651 // Usually FTP servers close the data connection after the entire data has |
648 // been received. | 652 // been received. |
649 MockRead(false, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ), | 653 MockRead(false, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ), |
650 MockRead(mock_data.c_str()), | 654 MockRead(mock_data.c_str()), |
651 }; | 655 }; |
652 // For compatibility with FileZilla, the transaction code will use two data | 656 StaticSocketDataProvider data_socket(data_reads, arraysize(data_reads), |
653 // sockets for directory requests. For more info see http://crbug.com/25316. | 657 NULL, 0); |
654 StaticSocketDataProvider data1(data_reads, arraysize(data_reads), NULL, 0); | |
655 StaticSocketDataProvider data2(data_reads, arraysize(data_reads), NULL, 0); | |
656 mock_socket_factory_.AddSocketDataProvider(ctrl_socket); | 658 mock_socket_factory_.AddSocketDataProvider(ctrl_socket); |
657 mock_socket_factory_.AddSocketDataProvider(&data1); | 659 mock_socket_factory_.AddSocketDataProvider(&data_socket); |
658 mock_socket_factory_.AddSocketDataProvider(&data2); | |
659 FtpRequestInfo request_info = GetRequestInfo(request); | 660 FtpRequestInfo request_info = GetRequestInfo(request); |
660 EXPECT_EQ(LOAD_STATE_IDLE, transaction_.GetLoadState()); | 661 EXPECT_EQ(LOAD_STATE_IDLE, transaction_.GetLoadState()); |
661 ASSERT_EQ(ERR_IO_PENDING, | 662 ASSERT_EQ(ERR_IO_PENDING, |
662 transaction_.Start(&request_info, &callback_, BoundNetLog())); | 663 transaction_.Start(&request_info, &callback_, BoundNetLog())); |
663 EXPECT_NE(LOAD_STATE_IDLE, transaction_.GetLoadState()); | 664 EXPECT_NE(LOAD_STATE_IDLE, transaction_.GetLoadState()); |
664 ASSERT_EQ(expected_result, callback_.WaitForResult()); | 665 ASSERT_EQ(expected_result, callback_.WaitForResult()); |
665 if (expected_result == OK) { | 666 if (expected_result == OK) { |
666 scoped_refptr<IOBuffer> io_buffer(new IOBuffer(kBufferSize)); | 667 scoped_refptr<IOBuffer> io_buffer(new IOBuffer(kBufferSize)); |
667 memset(io_buffer->data(), 0, kBufferSize); | 668 memset(io_buffer->data(), 0, kBufferSize); |
668 ASSERT_EQ(ERR_IO_PENDING, | 669 ASSERT_EQ(ERR_IO_PENDING, |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 } | 1110 } |
1110 | 1111 |
1111 // Regression test for http://crbug.com/25023. | 1112 // Regression test for http://crbug.com/25023. |
1112 TEST_F(FtpNetworkTransactionTest, CloseConnection) { | 1113 TEST_F(FtpNetworkTransactionTest, CloseConnection) { |
1113 FtpSocketDataProviderCloseConnection ctrl_socket; | 1114 FtpSocketDataProviderCloseConnection ctrl_socket; |
1114 ExecuteTransaction(&ctrl_socket, "ftp://host", ERR_EMPTY_RESPONSE); | 1115 ExecuteTransaction(&ctrl_socket, "ftp://host", ERR_EMPTY_RESPONSE); |
1115 } | 1116 } |
1116 | 1117 |
1117 TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFailUser) { | 1118 TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFailUser) { |
1118 FtpSocketDataProviderDirectoryListing ctrl_socket; | 1119 FtpSocketDataProviderDirectoryListing ctrl_socket; |
| 1120 // Use unallocated 599 FTP error code to make sure it falls into the generic |
| 1121 // ERR_FTP_FAILED bucket. |
1119 TransactionFailHelper(&ctrl_socket, | 1122 TransactionFailHelper(&ctrl_socket, |
1120 "ftp://host", | 1123 "ftp://host", |
1121 FtpSocketDataProvider::PRE_USER, | 1124 FtpSocketDataProvider::PRE_USER, |
1122 FtpSocketDataProvider::PRE_QUIT, | 1125 FtpSocketDataProvider::PRE_QUIT, |
1123 "599 fail\r\n", | 1126 "599 fail\r\n", |
1124 ERR_FTP_FAILED); | 1127 ERR_FTP_FAILED); |
1125 } | 1128 } |
1126 | 1129 |
1127 TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFailPass) { | 1130 TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFailPass) { |
1128 FtpSocketDataProviderDirectoryListing ctrl_socket; | 1131 FtpSocketDataProviderDirectoryListing ctrl_socket; |
(...skipping 11 matching lines...) Expand all Loading... |
1140 TransactionFailHelper(&ctrl_socket, | 1143 TransactionFailHelper(&ctrl_socket, |
1141 "ftp://host", | 1144 "ftp://host", |
1142 FtpSocketDataProvider::PRE_PASSWD, | 1145 FtpSocketDataProvider::PRE_PASSWD, |
1143 FtpSocketDataProvider::PRE_QUIT, | 1146 FtpSocketDataProvider::PRE_QUIT, |
1144 "503 Bad sequence of commands\r\n", | 1147 "503 Bad sequence of commands\r\n", |
1145 ERR_FTP_BAD_COMMAND_SEQUENCE); | 1148 ERR_FTP_BAD_COMMAND_SEQUENCE); |
1146 } | 1149 } |
1147 | 1150 |
1148 TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFailSyst) { | 1151 TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFailSyst) { |
1149 FtpSocketDataProviderDirectoryListing ctrl_socket; | 1152 FtpSocketDataProviderDirectoryListing ctrl_socket; |
| 1153 // Use unallocated 599 FTP error code to make sure it falls into the generic |
| 1154 // ERR_FTP_FAILED bucket. |
1150 TransactionFailHelper(&ctrl_socket, | 1155 TransactionFailHelper(&ctrl_socket, |
1151 "ftp://host", | 1156 "ftp://host", |
1152 FtpSocketDataProvider::PRE_SYST, | 1157 FtpSocketDataProvider::PRE_SYST, |
1153 FtpSocketDataProvider::PRE_PWD, | 1158 FtpSocketDataProvider::PRE_PWD, |
1154 "599 fail\r\n", | 1159 "599 fail\r\n", |
1155 OK); | 1160 OK); |
1156 } | 1161 } |
1157 | 1162 |
1158 TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFailPwd) { | 1163 TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFailPwd) { |
1159 FtpSocketDataProviderDirectoryListing ctrl_socket; | 1164 FtpSocketDataProviderDirectoryListing ctrl_socket; |
| 1165 // Use unallocated 599 FTP error code to make sure it falls into the generic |
| 1166 // ERR_FTP_FAILED bucket. |
1160 TransactionFailHelper(&ctrl_socket, | 1167 TransactionFailHelper(&ctrl_socket, |
1161 "ftp://host", | 1168 "ftp://host", |
1162 FtpSocketDataProvider::PRE_PWD, | 1169 FtpSocketDataProvider::PRE_PWD, |
1163 FtpSocketDataProvider::PRE_QUIT, | 1170 FtpSocketDataProvider::PRE_QUIT, |
1164 "599 fail\r\n", | 1171 "599 fail\r\n", |
1165 ERR_FTP_FAILED); | 1172 ERR_FTP_FAILED); |
1166 } | 1173 } |
1167 | 1174 |
1168 TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFailType) { | 1175 TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFailType) { |
1169 FtpSocketDataProviderDirectoryListing ctrl_socket; | 1176 FtpSocketDataProviderDirectoryListing ctrl_socket; |
| 1177 // Use unallocated 599 FTP error code to make sure it falls into the generic |
| 1178 // ERR_FTP_FAILED bucket. |
1170 TransactionFailHelper(&ctrl_socket, | 1179 TransactionFailHelper(&ctrl_socket, |
1171 "ftp://host", | 1180 "ftp://host", |
1172 FtpSocketDataProvider::PRE_TYPE, | 1181 FtpSocketDataProvider::PRE_TYPE, |
1173 FtpSocketDataProvider::PRE_QUIT, | 1182 FtpSocketDataProvider::PRE_QUIT, |
1174 "599 fail\r\n", | 1183 "599 fail\r\n", |
1175 ERR_FTP_FAILED); | 1184 ERR_FTP_FAILED); |
1176 } | 1185 } |
1177 | 1186 |
1178 TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFailEpsv) { | 1187 TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFailEpsv) { |
1179 FtpSocketDataProviderDirectoryListing ctrl_socket; | 1188 FtpSocketDataProviderDirectoryListing ctrl_socket; |
| 1189 // Use unallocated 599 FTP error code to make sure it falls into the generic |
| 1190 // ERR_FTP_FAILED bucket. |
1180 TransactionFailHelper(&ctrl_socket, | 1191 TransactionFailHelper(&ctrl_socket, |
1181 "ftp://host", | 1192 "ftp://host", |
1182 FtpSocketDataProvider::PRE_EPSV, | 1193 FtpSocketDataProvider::PRE_EPSV, |
1183 FtpSocketDataProvider::PRE_NOPASV, | 1194 FtpSocketDataProvider::PRE_NOPASV, |
1184 "599 fail\r\n", | 1195 "599 fail\r\n", |
1185 ERR_FTP_FAILED); | 1196 ERR_FTP_FAILED); |
1186 } | 1197 } |
1187 | 1198 |
1188 TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFailCwd) { | 1199 TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFailCwd) { |
1189 FtpSocketDataProviderDirectoryListing ctrl_socket; | 1200 FtpSocketDataProviderDirectoryListing ctrl_socket; |
| 1201 // Use unallocated 599 FTP error code to make sure it falls into the generic |
| 1202 // ERR_FTP_FAILED bucket. |
1190 TransactionFailHelper(&ctrl_socket, | 1203 TransactionFailHelper(&ctrl_socket, |
1191 "ftp://host", | 1204 "ftp://host", |
1192 FtpSocketDataProvider::PRE_CWD, | 1205 FtpSocketDataProvider::PRE_CWD, |
1193 FtpSocketDataProvider::PRE_QUIT, | 1206 FtpSocketDataProvider::PRE_QUIT, |
1194 "599 fail\r\n", | 1207 "599 fail\r\n", |
1195 ERR_FTP_FAILED); | 1208 ERR_FTP_FAILED); |
1196 } | 1209 } |
1197 | 1210 |
1198 TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFileNotFound) { | 1211 TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFileNotFound) { |
1199 FtpSocketDataProviderDirectoryListing ctrl_socket; | 1212 FtpSocketDataProviderDirectoryListing ctrl_socket; |
(...skipping 10 matching lines...) Expand all Loading... |
1210 TransactionFailHelper(&ctrl_socket, | 1223 TransactionFailHelper(&ctrl_socket, |
1211 "ftp://host", | 1224 "ftp://host", |
1212 FtpSocketDataProvider::PRE_MLSD, | 1225 FtpSocketDataProvider::PRE_MLSD, |
1213 FtpSocketDataProvider::PRE_LIST, | 1226 FtpSocketDataProvider::PRE_LIST, |
1214 "500 Unrecognized command\r\n", | 1227 "500 Unrecognized command\r\n", |
1215 OK); | 1228 OK); |
1216 } | 1229 } |
1217 | 1230 |
1218 TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFailList) { | 1231 TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFailList) { |
1219 FtpSocketDataProviderVMSDirectoryListing ctrl_socket; | 1232 FtpSocketDataProviderVMSDirectoryListing ctrl_socket; |
| 1233 // Use unallocated 599 FTP error code to make sure it falls into the generic |
| 1234 // ERR_FTP_FAILED bucket. |
1220 TransactionFailHelper(&ctrl_socket, | 1235 TransactionFailHelper(&ctrl_socket, |
1221 "ftp://host/dir", | 1236 "ftp://host/dir", |
1222 FtpSocketDataProvider::PRE_LIST, | 1237 FtpSocketDataProvider::PRE_LIST, |
1223 FtpSocketDataProvider::PRE_QUIT, | 1238 FtpSocketDataProvider::PRE_QUIT, |
1224 "599 fail\r\n", | 1239 "599 fail\r\n", |
1225 ERR_FTP_FAILED); | 1240 ERR_FTP_FAILED); |
1226 } | 1241 } |
1227 | 1242 |
1228 TEST_F(FtpNetworkTransactionTest, DownloadTransactionFailUser) { | 1243 TEST_F(FtpNetworkTransactionTest, DownloadTransactionFailUser) { |
1229 FtpSocketDataProviderFileDownload ctrl_socket; | 1244 FtpSocketDataProviderFileDownload ctrl_socket; |
| 1245 // Use unallocated 599 FTP error code to make sure it falls into the generic |
| 1246 // ERR_FTP_FAILED bucket. |
1230 TransactionFailHelper(&ctrl_socket, | 1247 TransactionFailHelper(&ctrl_socket, |
1231 "ftp://host/file", | 1248 "ftp://host/file", |
1232 FtpSocketDataProvider::PRE_USER, | 1249 FtpSocketDataProvider::PRE_USER, |
1233 FtpSocketDataProvider::PRE_QUIT, | 1250 FtpSocketDataProvider::PRE_QUIT, |
1234 "599 fail\r\n", | 1251 "599 fail\r\n", |
1235 ERR_FTP_FAILED); | 1252 ERR_FTP_FAILED); |
1236 } | 1253 } |
1237 | 1254 |
1238 TEST_F(FtpNetworkTransactionTest, DownloadTransactionFailPass) { | 1255 TEST_F(FtpNetworkTransactionTest, DownloadTransactionFailPass) { |
1239 FtpSocketDataProviderFileDownload ctrl_socket; | 1256 FtpSocketDataProviderFileDownload ctrl_socket; |
1240 TransactionFailHelper(&ctrl_socket, | 1257 TransactionFailHelper(&ctrl_socket, |
1241 "ftp://host/file", | 1258 "ftp://host/file", |
1242 FtpSocketDataProvider::PRE_PASSWD, | 1259 FtpSocketDataProvider::PRE_PASSWD, |
1243 FtpSocketDataProvider::PRE_QUIT, | 1260 FtpSocketDataProvider::PRE_QUIT, |
1244 "530 Login authentication failed\r\n", | 1261 "530 Login authentication failed\r\n", |
1245 ERR_FTP_FAILED); | 1262 ERR_FTP_FAILED); |
1246 } | 1263 } |
1247 | 1264 |
1248 TEST_F(FtpNetworkTransactionTest, DownloadTransactionFailSyst) { | 1265 TEST_F(FtpNetworkTransactionTest, DownloadTransactionFailSyst) { |
1249 FtpSocketDataProviderFileDownload ctrl_socket; | 1266 FtpSocketDataProviderFileDownload ctrl_socket; |
| 1267 // Use unallocated 599 FTP error code to make sure it falls into the generic |
| 1268 // ERR_FTP_FAILED bucket. |
1250 TransactionFailHelper(&ctrl_socket, | 1269 TransactionFailHelper(&ctrl_socket, |
1251 "ftp://host/file", | 1270 "ftp://host/file", |
1252 FtpSocketDataProvider::PRE_SYST, | 1271 FtpSocketDataProvider::PRE_SYST, |
1253 FtpSocketDataProvider::PRE_PWD, | 1272 FtpSocketDataProvider::PRE_PWD, |
1254 "599 fail\r\n", | 1273 "599 fail\r\n", |
1255 OK); | 1274 OK); |
1256 } | 1275 } |
1257 | 1276 |
1258 TEST_F(FtpNetworkTransactionTest, DownloadTransactionFailPwd) { | 1277 TEST_F(FtpNetworkTransactionTest, DownloadTransactionFailPwd) { |
1259 FtpSocketDataProviderFileDownload ctrl_socket; | 1278 FtpSocketDataProviderFileDownload ctrl_socket; |
| 1279 // Use unallocated 599 FTP error code to make sure it falls into the generic |
| 1280 // ERR_FTP_FAILED bucket. |
1260 TransactionFailHelper(&ctrl_socket, | 1281 TransactionFailHelper(&ctrl_socket, |
1261 "ftp://host/file", | 1282 "ftp://host/file", |
1262 FtpSocketDataProvider::PRE_PWD, | 1283 FtpSocketDataProvider::PRE_PWD, |
1263 FtpSocketDataProvider::PRE_QUIT, | 1284 FtpSocketDataProvider::PRE_QUIT, |
1264 "599 fail\r\n", | 1285 "599 fail\r\n", |
1265 ERR_FTP_FAILED); | 1286 ERR_FTP_FAILED); |
1266 } | 1287 } |
1267 | 1288 |
1268 TEST_F(FtpNetworkTransactionTest, DownloadTransactionFailType) { | 1289 TEST_F(FtpNetworkTransactionTest, DownloadTransactionFailType) { |
1269 FtpSocketDataProviderFileDownload ctrl_socket; | 1290 FtpSocketDataProviderFileDownload ctrl_socket; |
| 1291 // Use unallocated 599 FTP error code to make sure it falls into the generic |
| 1292 // ERR_FTP_FAILED bucket. |
1270 TransactionFailHelper(&ctrl_socket, | 1293 TransactionFailHelper(&ctrl_socket, |
1271 "ftp://host/file", | 1294 "ftp://host/file", |
1272 FtpSocketDataProvider::PRE_TYPE, | 1295 FtpSocketDataProvider::PRE_TYPE, |
1273 FtpSocketDataProvider::PRE_QUIT, | 1296 FtpSocketDataProvider::PRE_QUIT, |
1274 "599 fail\r\n", | 1297 "599 fail\r\n", |
1275 ERR_FTP_FAILED); | 1298 ERR_FTP_FAILED); |
1276 } | 1299 } |
1277 | 1300 |
1278 TEST_F(FtpNetworkTransactionTest, DownloadTransactionFailEpsv) { | 1301 TEST_F(FtpNetworkTransactionTest, DownloadTransactionFailEpsv) { |
1279 FtpSocketDataProviderFileDownload ctrl_socket; | 1302 FtpSocketDataProviderFileDownload ctrl_socket; |
| 1303 // Use unallocated 599 FTP error code to make sure it falls into the generic |
| 1304 // ERR_FTP_FAILED bucket. |
1280 TransactionFailHelper(&ctrl_socket, | 1305 TransactionFailHelper(&ctrl_socket, |
1281 "ftp://host/file", | 1306 "ftp://host/file", |
1282 FtpSocketDataProvider::PRE_EPSV, | 1307 FtpSocketDataProvider::PRE_EPSV, |
1283 FtpSocketDataProvider::PRE_NOPASV, | 1308 FtpSocketDataProvider::PRE_NOPASV, |
1284 "599 fail\r\n", | 1309 "599 fail\r\n", |
1285 ERR_FTP_FAILED); | 1310 ERR_FTP_FAILED); |
1286 } | 1311 } |
1287 | 1312 |
1288 TEST_F(FtpNetworkTransactionTest, DownloadTransactionFailRetr) { | 1313 TEST_F(FtpNetworkTransactionTest, DownloadTransactionFailRetr) { |
1289 FtpSocketDataProviderFileDownload ctrl_socket; | 1314 FtpSocketDataProviderFileDownload ctrl_socket; |
| 1315 // Use unallocated 599 FTP error code to make sure it falls into the generic |
| 1316 // ERR_FTP_FAILED bucket. |
1290 TransactionFailHelper(&ctrl_socket, | 1317 TransactionFailHelper(&ctrl_socket, |
1291 "ftp://host/file", | 1318 "ftp://host/file", |
1292 FtpSocketDataProvider::PRE_RETR, | 1319 FtpSocketDataProvider::PRE_RETR, |
1293 FtpSocketDataProvider::PRE_QUIT, | 1320 FtpSocketDataProvider::PRE_QUIT, |
1294 "599 fail\r\n", | 1321 "599 fail\r\n", |
1295 ERR_FTP_FAILED); | 1322 ERR_FTP_FAILED); |
1296 } | 1323 } |
1297 | 1324 |
1298 TEST_F(FtpNetworkTransactionTest, DownloadTransactionFileNotFound) { | 1325 TEST_F(FtpNetworkTransactionTest, DownloadTransactionFileNotFound) { |
1299 FtpSocketDataProviderFileDownload ctrl_socket; | 1326 FtpSocketDataProviderFileDownload ctrl_socket; |
(...skipping 10 matching lines...) Expand all Loading... |
1310 FtpSocketDataProviderFileDownload ctrl_socket; | 1337 FtpSocketDataProviderFileDownload ctrl_socket; |
1311 TransactionFailHelper(&ctrl_socket, | 1338 TransactionFailHelper(&ctrl_socket, |
1312 "ftp://host/file", | 1339 "ftp://host/file", |
1313 FtpSocketDataProvider::PRE_PWD, | 1340 FtpSocketDataProvider::PRE_PWD, |
1314 FtpSocketDataProvider::PRE_TYPE, | 1341 FtpSocketDataProvider::PRE_TYPE, |
1315 "257 \"\"\r\n", | 1342 "257 \"\"\r\n", |
1316 OK); | 1343 OK); |
1317 } | 1344 } |
1318 | 1345 |
1319 } // namespace net | 1346 } // namespace net |
OLD | NEW |