| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1055 | 1055 |
| 1056 // Start the transaction. | 1056 // Start the transaction. |
| 1057 ASSERT_EQ(ERR_IO_PENDING, | 1057 ASSERT_EQ(ERR_IO_PENDING, |
| 1058 transaction_.Start(&request_info, callback_.callback(), | 1058 transaction_.Start(&request_info, callback_.callback(), |
| 1059 BoundNetLog())); | 1059 BoundNetLog())); |
| 1060 ASSERT_EQ(OK, callback_.WaitForResult()); | 1060 ASSERT_EQ(OK, callback_.WaitForResult()); |
| 1061 | 1061 |
| 1062 // The transaction fires the callback when we can start reading data. That | 1062 // The transaction fires the callback when we can start reading data. That |
| 1063 // means that the data socket should be open. | 1063 // means that the data socket should be open. |
| 1064 MockTCPClientSocket* data_socket = | 1064 MockTCPClientSocket* data_socket = |
| 1065 mock_socket_factory_.GetMockTCPClientSocket(1); | 1065 static_cast<MockTCPClientSocket*>(transaction_.data_socket_.get()); |
| 1066 ASSERT_TRUE(data_socket); | 1066 ASSERT_TRUE(data_socket); |
| 1067 ASSERT_TRUE(data_socket->IsConnected()); | 1067 ASSERT_TRUE(data_socket->IsConnected()); |
| 1068 | 1068 |
| 1069 // Even if the PASV response specified some other address, we connect | 1069 // Even if the PASV response specified some other address, we connect |
| 1070 // to the address we used for control connection (which could be 127.0.0.1 | 1070 // to the address we used for control connection (which could be 127.0.0.1 |
| 1071 // or ::1 depending on whether we use IPv6). | 1071 // or ::1 depending on whether we use IPv6). |
| 1072 const struct addrinfo* addrinfo = data_socket->addresses().head(); | 1072 const struct addrinfo* addrinfo = data_socket->addresses().head(); |
| 1073 while (addrinfo) { | 1073 while (addrinfo) { |
| 1074 EXPECT_NE("10.1.2.3", NetAddressToString(addrinfo)); | 1074 EXPECT_NE("10.1.2.3", NetAddressToString(addrinfo)); |
| 1075 addrinfo = addrinfo->ai_next; | 1075 addrinfo = addrinfo->ai_next; |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1468 FtpSocketDataProviderFileDownload ctrl_socket; | 1468 FtpSocketDataProviderFileDownload ctrl_socket; |
| 1469 TransactionFailHelper(&ctrl_socket, | 1469 TransactionFailHelper(&ctrl_socket, |
| 1470 "ftp://host/file", | 1470 "ftp://host/file", |
| 1471 FtpSocketDataProvider::PRE_PWD, | 1471 FtpSocketDataProvider::PRE_PWD, |
| 1472 FtpSocketDataProvider::PRE_TYPE, | 1472 FtpSocketDataProvider::PRE_TYPE, |
| 1473 "257 \"\"\r\n", | 1473 "257 \"\"\r\n", |
| 1474 OK); | 1474 OK); |
| 1475 } | 1475 } |
| 1476 | 1476 |
| 1477 } // namespace net | 1477 } // namespace net |
| OLD | NEW |