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

Side by Side Diff: net/ftp/ftp_network_transaction_unittest.cc

Issue 6488010: Propagate the remote socket address to URLRequest and to ViewHostMsg_FrameNavigate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 FtpSocketDataProvider::PRE_QUIT); 824 FtpSocketDataProvider::PRE_QUIT);
825 ExecuteTransaction(&ctrl_socket, "ftp://[::1]/file", ERR_INVALID_RESPONSE); 825 ExecuteTransaction(&ctrl_socket, "ftp://[::1]/file", ERR_INVALID_RESPONSE);
826 } 826 }
827 827
828 TEST_F(FtpNetworkTransactionTest, DirectoryTransaction) { 828 TEST_F(FtpNetworkTransactionTest, DirectoryTransaction) {
829 FtpSocketDataProviderDirectoryListing ctrl_socket; 829 FtpSocketDataProviderDirectoryListing ctrl_socket;
830 ExecuteTransaction(&ctrl_socket, "ftp://host", OK); 830 ExecuteTransaction(&ctrl_socket, "ftp://host", OK);
831 831
832 EXPECT_TRUE(transaction_.GetResponseInfo()->is_directory_listing); 832 EXPECT_TRUE(transaction_.GetResponseInfo()->is_directory_listing);
833 EXPECT_EQ(-1, transaction_.GetResponseInfo()->expected_content_size); 833 EXPECT_EQ(-1, transaction_.GetResponseInfo()->expected_content_size);
834 EXPECT_EQ("192.0.2.33:0", transaction_.GetResponseInfo()->socket_address);
834 } 835 }
835 836
836 TEST_F(FtpNetworkTransactionTest, DirectoryTransactionWithPasvFallback) { 837 TEST_F(FtpNetworkTransactionTest, DirectoryTransactionWithPasvFallback) {
837 FtpSocketDataProviderDirectoryListingWithPasvFallback ctrl_socket; 838 FtpSocketDataProviderDirectoryListingWithPasvFallback ctrl_socket;
838 ExecuteTransaction(&ctrl_socket, "ftp://host", OK); 839 ExecuteTransaction(&ctrl_socket, "ftp://host", OK);
839 840
840 EXPECT_TRUE(transaction_.GetResponseInfo()->is_directory_listing); 841 EXPECT_TRUE(transaction_.GetResponseInfo()->is_directory_listing);
841 EXPECT_EQ(-1, transaction_.GetResponseInfo()->expected_content_size); 842 EXPECT_EQ(-1, transaction_.GetResponseInfo()->expected_content_size);
842 } 843 }
843 844
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 FtpSocketDataProviderDirectoryListingTransferStarting ctrl_socket; 898 FtpSocketDataProviderDirectoryListingTransferStarting ctrl_socket;
898 ExecuteTransaction(&ctrl_socket, "ftp://host", OK); 899 ExecuteTransaction(&ctrl_socket, "ftp://host", OK);
899 } 900 }
900 901
901 TEST_F(FtpNetworkTransactionTest, DownloadTransaction) { 902 TEST_F(FtpNetworkTransactionTest, DownloadTransaction) {
902 FtpSocketDataProviderFileDownload ctrl_socket; 903 FtpSocketDataProviderFileDownload ctrl_socket;
903 ExecuteTransaction(&ctrl_socket, "ftp://host/file", OK); 904 ExecuteTransaction(&ctrl_socket, "ftp://host/file", OK);
904 905
905 // We pass an artificial value of 18 as a response to the SIZE command. 906 // We pass an artificial value of 18 as a response to the SIZE command.
906 EXPECT_EQ(18, transaction_.GetResponseInfo()->expected_content_size); 907 EXPECT_EQ(18, transaction_.GetResponseInfo()->expected_content_size);
908 EXPECT_EQ("192.0.2.33:0", transaction_.GetResponseInfo()->socket_address);
907 } 909 }
908 910
909 TEST_F(FtpNetworkTransactionTest, DownloadTransactionWithPasvFallback) { 911 TEST_F(FtpNetworkTransactionTest, DownloadTransactionWithPasvFallback) {
910 FtpSocketDataProviderFileDownloadWithPasvFallback ctrl_socket; 912 FtpSocketDataProviderFileDownloadWithPasvFallback ctrl_socket;
911 ExecuteTransaction(&ctrl_socket, "ftp://host/file", OK); 913 ExecuteTransaction(&ctrl_socket, "ftp://host/file", OK);
912 914
913 // We pass an artificial value of 18 as a response to the SIZE command. 915 // We pass an artificial value of 18 as a response to the SIZE command.
914 EXPECT_EQ(18, transaction_.GetResponseInfo()->expected_content_size); 916 EXPECT_EQ(18, transaction_.GetResponseInfo()->expected_content_size);
915 } 917 }
916 918
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 FtpSocketDataProviderFileDownload ctrl_socket; 1426 FtpSocketDataProviderFileDownload ctrl_socket;
1425 TransactionFailHelper(&ctrl_socket, 1427 TransactionFailHelper(&ctrl_socket,
1426 "ftp://host/file", 1428 "ftp://host/file",
1427 FtpSocketDataProvider::PRE_PWD, 1429 FtpSocketDataProvider::PRE_PWD,
1428 FtpSocketDataProvider::PRE_TYPE, 1430 FtpSocketDataProvider::PRE_TYPE,
1429 "257 \"\"\r\n", 1431 "257 \"\"\r\n",
1430 OK); 1432 OK);
1431 } 1433 }
1432 1434
1433 } // namespace net 1435 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698