| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/macros.h" | 10 #include "base/macros.h" |
| (...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 PRE_QUIT, ""); | 834 PRE_QUIT, ""); |
| 835 default: | 835 default: |
| 836 return FtpSocketDataProvider::OnWrite(data); | 836 return FtpSocketDataProvider::OnWrite(data); |
| 837 } | 837 } |
| 838 } | 838 } |
| 839 | 839 |
| 840 private: | 840 private: |
| 841 DISALLOW_COPY_AND_ASSIGN(FtpSocketDataProviderCloseConnection); | 841 DISALLOW_COPY_AND_ASSIGN(FtpSocketDataProviderCloseConnection); |
| 842 }; | 842 }; |
| 843 | 843 |
| 844 class BorkedFtpSocketDataProvider : public FtpSocketDataProvider { |
| 845 public: |
| 846 BorkedFtpSocketDataProvider() {} |
| 847 ~BorkedFtpSocketDataProvider() override {} |
| 848 |
| 849 MockWriteResult OnWrite(const std::string& data) override { |
| 850 switch (state()) { |
| 851 case PRE_USER: |
| 852 return Verify("USER anonymous\r\n", data, PRE_PASSWD, "957 Spam\r\n"); |
| 853 default: |
| 854 return FtpSocketDataProvider::OnWrite(data); |
| 855 } |
| 856 } |
| 857 |
| 858 private: |
| 859 DISALLOW_COPY_AND_ASSIGN(BorkedFtpSocketDataProvider); |
| 860 }; |
| 861 |
| 844 class FtpNetworkTransactionTest | 862 class FtpNetworkTransactionTest |
| 845 : public PlatformTest, | 863 : public PlatformTest, |
| 846 public ::testing::WithParamInterface<int> { | 864 public ::testing::WithParamInterface<int> { |
| 847 public: | 865 public: |
| 848 FtpNetworkTransactionTest() | 866 FtpNetworkTransactionTest() : host_resolver_(new MockHostResolver) { |
| 849 : host_resolver_(new MockHostResolver), | 867 SetUpTransaction(); |
| 850 transaction_(host_resolver_.get(), &mock_socket_factory_) { | 868 |
| 851 scoped_refptr<RuleBasedHostResolverProc> rules( | 869 scoped_refptr<RuleBasedHostResolverProc> rules( |
| 852 new RuleBasedHostResolverProc(NULL)); | 870 new RuleBasedHostResolverProc(nullptr)); |
| 853 if (GetFamily() == AF_INET) { | 871 if (GetFamily() == AF_INET) { |
| 854 rules->AddIPLiteralRule("*", "127.0.0.1", "127.0.0.1"); | 872 rules->AddIPLiteralRule("*", "127.0.0.1", "127.0.0.1"); |
| 855 } else if (GetFamily() == AF_INET6) { | 873 } else if (GetFamily() == AF_INET6) { |
| 856 rules->AddIPLiteralRule("*", "::1", "::1"); | 874 rules->AddIPLiteralRule("*", "::1", "::1"); |
| 857 } else { | 875 } else { |
| 858 NOTREACHED(); | 876 NOTREACHED(); |
| 859 } | 877 } |
| 860 host_resolver_->set_rules(rules.get()); | 878 host_resolver_->set_rules(rules.get()); |
| 861 } | 879 } |
| 862 | 880 |
| 881 // Sets up an FtpNetworkTransaction and MocketClientSocketFactory, replacing |
| 882 // the default one. Only needs to be called if a test runs multiple |
| 883 // transactions. |
| 884 void SetUpTransaction() { |
| 885 mock_socket_factory_.reset(new MockClientSocketFactory()); |
| 886 transaction_.reset(new FtpNetworkTransaction(host_resolver_.get(), |
| 887 mock_socket_factory_.get())); |
| 888 } |
| 889 |
| 863 protected: | 890 protected: |
| 864 // Accessor to make code refactoring-friendly, e.g. when we change the way | 891 // Accessor to make code refactoring-friendly, e.g. when we change the way |
| 865 // parameters are passed (like more parameters). | 892 // parameters are passed (like more parameters). |
| 866 int GetFamily() { | 893 int GetFamily() { |
| 867 return GetParam(); | 894 return GetParam(); |
| 868 } | 895 } |
| 869 | 896 |
| 870 FtpRequestInfo GetRequestInfo(const std::string& url) { | 897 FtpRequestInfo GetRequestInfo(const std::string& url) { |
| 871 FtpRequestInfo info; | 898 FtpRequestInfo info; |
| 872 info.url = GURL(url); | 899 info.url = GURL(url); |
| 873 return info; | 900 return info; |
| 874 } | 901 } |
| 875 | 902 |
| 876 void ExecuteTransaction(FtpSocketDataProvider* ctrl_socket, | 903 void ExecuteTransaction(FtpSocketDataProvider* ctrl_socket, |
| 877 const char* request, | 904 const char* request, |
| 878 int expected_result) { | 905 int expected_result) { |
| 879 // Expect EPSV usage for non-IPv4 control connections. | 906 // Expect EPSV usage for non-IPv4 control connections. |
| 880 ctrl_socket->set_use_epsv((GetFamily() != AF_INET)); | 907 ctrl_socket->set_use_epsv((GetFamily() != AF_INET)); |
| 881 | 908 |
| 882 mock_socket_factory_.AddSocketDataProvider(ctrl_socket); | 909 mock_socket_factory_->AddSocketDataProvider(ctrl_socket); |
| 883 | 910 |
| 884 std::string mock_data("mock-data"); | 911 std::string mock_data("mock-data"); |
| 885 MockRead data_reads[] = { | 912 MockRead data_reads[] = { |
| 886 // Usually FTP servers close the data connection after the entire data has | 913 // Usually FTP servers close the data connection after the entire data has |
| 887 // been received. | 914 // been received. |
| 888 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ), | 915 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ), |
| 889 MockRead(mock_data.c_str()), | 916 MockRead(mock_data.c_str()), |
| 890 }; | 917 }; |
| 891 | 918 |
| 892 std::unique_ptr<StaticSocketDataProvider> data_socket( | 919 std::unique_ptr<StaticSocketDataProvider> data_socket( |
| 893 new StaticSocketDataProvider(data_reads, arraysize(data_reads), NULL, | 920 new StaticSocketDataProvider(data_reads, arraysize(data_reads), NULL, |
| 894 0)); | 921 0)); |
| 895 mock_socket_factory_.AddSocketDataProvider(data_socket.get()); | 922 mock_socket_factory_->AddSocketDataProvider(data_socket.get()); |
| 896 FtpRequestInfo request_info = GetRequestInfo(request); | 923 FtpRequestInfo request_info = GetRequestInfo(request); |
| 897 EXPECT_EQ(LOAD_STATE_IDLE, transaction_.GetLoadState()); | 924 EXPECT_EQ(LOAD_STATE_IDLE, transaction_->GetLoadState()); |
| 898 ASSERT_EQ(ERR_IO_PENDING, | 925 ASSERT_EQ(ERR_IO_PENDING, |
| 899 transaction_.Start(&request_info, callback_.callback(), | 926 transaction_->Start(&request_info, callback_.callback(), |
| 900 NetLogWithSource())); | 927 NetLogWithSource())); |
| 901 EXPECT_NE(LOAD_STATE_IDLE, transaction_.GetLoadState()); | 928 EXPECT_NE(LOAD_STATE_IDLE, transaction_->GetLoadState()); |
| 902 ASSERT_EQ(expected_result, callback_.WaitForResult()); | 929 ASSERT_EQ(expected_result, callback_.WaitForResult()); |
| 903 if (expected_result == OK) { | 930 if (expected_result == OK) { |
| 904 scoped_refptr<IOBuffer> io_buffer(new IOBuffer(kBufferSize)); | 931 scoped_refptr<IOBuffer> io_buffer(new IOBuffer(kBufferSize)); |
| 905 memset(io_buffer->data(), 0, kBufferSize); | 932 memset(io_buffer->data(), 0, kBufferSize); |
| 906 ASSERT_EQ(ERR_IO_PENDING, | 933 ASSERT_EQ(ERR_IO_PENDING, transaction_->Read(io_buffer.get(), kBufferSize, |
| 907 transaction_.Read(io_buffer.get(), kBufferSize, | 934 callback_.callback())); |
| 908 callback_.callback())); | |
| 909 ASSERT_EQ(static_cast<int>(mock_data.length()), | 935 ASSERT_EQ(static_cast<int>(mock_data.length()), |
| 910 callback_.WaitForResult()); | 936 callback_.WaitForResult()); |
| 911 EXPECT_EQ(mock_data, std::string(io_buffer->data(), mock_data.length())); | 937 EXPECT_EQ(mock_data, std::string(io_buffer->data(), mock_data.length())); |
| 912 | 938 |
| 913 // Do another Read to detect that the data socket is now closed. | 939 // Do another Read to detect that the data socket is now closed. |
| 914 int rv = transaction_.Read(io_buffer.get(), kBufferSize, | 940 int rv = transaction_->Read(io_buffer.get(), kBufferSize, |
| 915 callback_.callback()); | 941 callback_.callback()); |
| 916 if (rv == ERR_IO_PENDING) { | 942 if (rv == ERR_IO_PENDING) { |
| 917 EXPECT_EQ(0, callback_.WaitForResult()); | 943 EXPECT_EQ(0, callback_.WaitForResult()); |
| 918 } else { | 944 } else { |
| 919 EXPECT_EQ(0, rv); | 945 EXPECT_EQ(0, rv); |
| 920 } | 946 } |
| 921 } | 947 } |
| 922 EXPECT_EQ(FtpSocketDataProvider::QUIT, ctrl_socket->state()); | 948 EXPECT_EQ(FtpSocketDataProvider::QUIT, ctrl_socket->state()); |
| 923 EXPECT_EQ(LOAD_STATE_IDLE, transaction_.GetLoadState()); | 949 EXPECT_EQ(LOAD_STATE_IDLE, transaction_->GetLoadState()); |
| 924 } | 950 } |
| 925 | 951 |
| 926 void TransactionFailHelper(FtpSocketDataProvider* ctrl_socket, | 952 void TransactionFailHelper(FtpSocketDataProvider* ctrl_socket, |
| 927 const char* request, | 953 const char* request, |
| 928 FtpSocketDataProvider::State state, | 954 FtpSocketDataProvider::State state, |
| 929 FtpSocketDataProvider::State next_state, | 955 FtpSocketDataProvider::State next_state, |
| 930 const char* response, | 956 const char* response, |
| 931 int expected_result) { | 957 int expected_result) { |
| 932 ctrl_socket->InjectFailure(state, next_state, response); | 958 ctrl_socket->InjectFailure(state, next_state, response); |
| 933 ExecuteTransaction(ctrl_socket, request, expected_result); | 959 ExecuteTransaction(ctrl_socket, request, expected_result); |
| 934 } | 960 } |
| 935 | 961 |
| 936 std::unique_ptr<MockHostResolver> host_resolver_; | 962 std::unique_ptr<MockHostResolver> host_resolver_; |
| 937 MockClientSocketFactory mock_socket_factory_; | 963 std::unique_ptr<MockClientSocketFactory> mock_socket_factory_; |
| 938 FtpNetworkTransaction transaction_; | 964 std::unique_ptr<FtpNetworkTransaction> transaction_; |
| 939 TestCompletionCallback callback_; | 965 TestCompletionCallback callback_; |
| 940 }; | 966 }; |
| 941 | 967 |
| 942 TEST_P(FtpNetworkTransactionTest, FailedLookup) { | 968 TEST_P(FtpNetworkTransactionTest, FailedLookup) { |
| 943 FtpRequestInfo request_info = GetRequestInfo("ftp://badhost"); | 969 FtpRequestInfo request_info = GetRequestInfo("ftp://badhost"); |
| 944 scoped_refptr<RuleBasedHostResolverProc> rules( | 970 scoped_refptr<RuleBasedHostResolverProc> rules( |
| 945 new RuleBasedHostResolverProc(NULL)); | 971 new RuleBasedHostResolverProc(NULL)); |
| 946 rules->AddSimulatedFailure("badhost"); | 972 rules->AddSimulatedFailure("badhost"); |
| 947 host_resolver_->set_rules(rules.get()); | 973 host_resolver_->set_rules(rules.get()); |
| 948 | 974 |
| 949 EXPECT_EQ(LOAD_STATE_IDLE, transaction_.GetLoadState()); | 975 EXPECT_EQ(LOAD_STATE_IDLE, transaction_->GetLoadState()); |
| 950 ASSERT_EQ(ERR_IO_PENDING, | 976 ASSERT_EQ(ERR_IO_PENDING, |
| 951 transaction_.Start(&request_info, callback_.callback(), | 977 transaction_->Start(&request_info, callback_.callback(), |
| 952 NetLogWithSource())); | 978 NetLogWithSource())); |
| 953 ASSERT_THAT(callback_.WaitForResult(), IsError(ERR_NAME_NOT_RESOLVED)); | 979 ASSERT_THAT(callback_.WaitForResult(), IsError(ERR_NAME_NOT_RESOLVED)); |
| 954 EXPECT_EQ(LOAD_STATE_IDLE, transaction_.GetLoadState()); | 980 EXPECT_EQ(LOAD_STATE_IDLE, transaction_->GetLoadState()); |
| 955 } | 981 } |
| 956 | 982 |
| 957 // Check that when determining the host, the square brackets decorating IPv6 | 983 // Check that when determining the host, the square brackets decorating IPv6 |
| 958 // literals in URLs are stripped. | 984 // literals in URLs are stripped. |
| 959 TEST_P(FtpNetworkTransactionTest, StripBracketsFromIPv6Literals) { | 985 TEST_P(FtpNetworkTransactionTest, StripBracketsFromIPv6Literals) { |
| 960 // This test only makes sense for IPv6 connections. | 986 // This test only makes sense for IPv6 connections. |
| 961 if (GetFamily() != AF_INET6) | 987 if (GetFamily() != AF_INET6) |
| 962 return; | 988 return; |
| 963 | 989 |
| 964 host_resolver_->rules()->AddSimulatedFailure("[::1]"); | 990 host_resolver_->rules()->AddSimulatedFailure("[::1]"); |
| 965 | 991 |
| 966 // We start a transaction that is expected to fail with ERR_INVALID_RESPONSE. | 992 // We start a transaction that is expected to fail with ERR_INVALID_RESPONSE. |
| 967 // The important part of this test is to make sure that we don't fail with | 993 // The important part of this test is to make sure that we don't fail with |
| 968 // ERR_NAME_NOT_RESOLVED, since that would mean the decorated hostname | 994 // ERR_NAME_NOT_RESOLVED, since that would mean the decorated hostname |
| 969 // was used. | 995 // was used. |
| 970 FtpSocketDataProviderEvilSize ctrl_socket( | 996 FtpSocketDataProviderEvilSize ctrl_socket( |
| 971 "213 99999999999999999999999999999999\r\n", | 997 "213 99999999999999999999999999999999\r\n", |
| 972 FtpSocketDataProvider::PRE_QUIT); | 998 FtpSocketDataProvider::PRE_QUIT); |
| 973 ExecuteTransaction(&ctrl_socket, "ftp://[::1]/file", ERR_INVALID_RESPONSE); | 999 ExecuteTransaction(&ctrl_socket, "ftp://[::1]/file", ERR_INVALID_RESPONSE); |
| 974 } | 1000 } |
| 975 | 1001 |
| 976 TEST_P(FtpNetworkTransactionTest, DirectoryTransaction) { | 1002 TEST_P(FtpNetworkTransactionTest, DirectoryTransaction) { |
| 977 FtpSocketDataProviderDirectoryListing ctrl_socket; | 1003 FtpSocketDataProviderDirectoryListing ctrl_socket; |
| 978 ExecuteTransaction(&ctrl_socket, "ftp://host", OK); | 1004 ExecuteTransaction(&ctrl_socket, "ftp://host", OK); |
| 979 | 1005 |
| 980 EXPECT_TRUE(transaction_.GetResponseInfo()->is_directory_listing); | 1006 EXPECT_TRUE(transaction_->GetResponseInfo()->is_directory_listing); |
| 981 EXPECT_EQ(-1, transaction_.GetResponseInfo()->expected_content_size); | 1007 EXPECT_EQ(-1, transaction_->GetResponseInfo()->expected_content_size); |
| 982 EXPECT_EQ((GetFamily() == AF_INET) ? "127.0.0.1" : "::1", | 1008 EXPECT_EQ((GetFamily() == AF_INET) ? "127.0.0.1" : "::1", |
| 983 transaction_.GetResponseInfo()->socket_address.host()); | 1009 transaction_->GetResponseInfo()->socket_address.host()); |
| 984 EXPECT_EQ(21, transaction_.GetResponseInfo()->socket_address.port()); | 1010 EXPECT_EQ(21, transaction_->GetResponseInfo()->socket_address.port()); |
| 985 } | 1011 } |
| 986 | 1012 |
| 987 TEST_P(FtpNetworkTransactionTest, DirectoryTransactionWithPasvFallback) { | 1013 TEST_P(FtpNetworkTransactionTest, DirectoryTransactionWithPasvFallback) { |
| 988 FtpSocketDataProviderDirectoryListingWithPasvFallback ctrl_socket; | 1014 FtpSocketDataProviderDirectoryListingWithPasvFallback ctrl_socket; |
| 989 ExecuteTransaction(&ctrl_socket, "ftp://host", OK); | 1015 ExecuteTransaction(&ctrl_socket, "ftp://host", OK); |
| 990 | 1016 |
| 991 EXPECT_TRUE(transaction_.GetResponseInfo()->is_directory_listing); | 1017 EXPECT_TRUE(transaction_->GetResponseInfo()->is_directory_listing); |
| 992 EXPECT_EQ(-1, transaction_.GetResponseInfo()->expected_content_size); | 1018 EXPECT_EQ(-1, transaction_->GetResponseInfo()->expected_content_size); |
| 993 } | 1019 } |
| 994 | 1020 |
| 995 TEST_P(FtpNetworkTransactionTest, DirectoryTransactionWithTypecode) { | 1021 TEST_P(FtpNetworkTransactionTest, DirectoryTransactionWithTypecode) { |
| 996 FtpSocketDataProviderDirectoryListing ctrl_socket; | 1022 FtpSocketDataProviderDirectoryListing ctrl_socket; |
| 997 ExecuteTransaction(&ctrl_socket, "ftp://host/;type=d", OK); | 1023 ExecuteTransaction(&ctrl_socket, "ftp://host/;type=d", OK); |
| 998 | 1024 |
| 999 EXPECT_TRUE(transaction_.GetResponseInfo()->is_directory_listing); | 1025 EXPECT_TRUE(transaction_->GetResponseInfo()->is_directory_listing); |
| 1000 EXPECT_EQ(-1, transaction_.GetResponseInfo()->expected_content_size); | 1026 EXPECT_EQ(-1, transaction_->GetResponseInfo()->expected_content_size); |
| 1001 } | 1027 } |
| 1002 | 1028 |
| 1003 TEST_P(FtpNetworkTransactionTest, DirectoryTransactionMultilineWelcome) { | 1029 TEST_P(FtpNetworkTransactionTest, DirectoryTransactionMultilineWelcome) { |
| 1004 FtpSocketDataProviderDirectoryListing ctrl_socket; | 1030 FtpSocketDataProviderDirectoryListing ctrl_socket; |
| 1005 ctrl_socket.set_multiline_welcome(true); | 1031 ctrl_socket.set_multiline_welcome(true); |
| 1006 ExecuteTransaction(&ctrl_socket, "ftp://host", OK); | 1032 ExecuteTransaction(&ctrl_socket, "ftp://host", OK); |
| 1007 } | 1033 } |
| 1008 | 1034 |
| 1009 TEST_P(FtpNetworkTransactionTest, DirectoryTransactionShortReads2) { | 1035 TEST_P(FtpNetworkTransactionTest, DirectoryTransactionShortReads2) { |
| 1010 FtpSocketDataProviderDirectoryListing ctrl_socket; | 1036 FtpSocketDataProviderDirectoryListing ctrl_socket; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 TEST_P(FtpNetworkTransactionTest, DirectoryTransactionTransferStarting) { | 1073 TEST_P(FtpNetworkTransactionTest, DirectoryTransactionTransferStarting) { |
| 1048 FtpSocketDataProviderDirectoryListingTransferStarting ctrl_socket; | 1074 FtpSocketDataProviderDirectoryListingTransferStarting ctrl_socket; |
| 1049 ExecuteTransaction(&ctrl_socket, "ftp://host", OK); | 1075 ExecuteTransaction(&ctrl_socket, "ftp://host", OK); |
| 1050 } | 1076 } |
| 1051 | 1077 |
| 1052 TEST_P(FtpNetworkTransactionTest, DownloadTransaction) { | 1078 TEST_P(FtpNetworkTransactionTest, DownloadTransaction) { |
| 1053 FtpSocketDataProviderFileDownload ctrl_socket; | 1079 FtpSocketDataProviderFileDownload ctrl_socket; |
| 1054 ExecuteTransaction(&ctrl_socket, "ftp://host/file", OK); | 1080 ExecuteTransaction(&ctrl_socket, "ftp://host/file", OK); |
| 1055 | 1081 |
| 1056 // We pass an artificial value of 18 as a response to the SIZE command. | 1082 // We pass an artificial value of 18 as a response to the SIZE command. |
| 1057 EXPECT_EQ(18, transaction_.GetResponseInfo()->expected_content_size); | 1083 EXPECT_EQ(18, transaction_->GetResponseInfo()->expected_content_size); |
| 1058 EXPECT_EQ((GetFamily() == AF_INET) ? "127.0.0.1" : "::1", | 1084 EXPECT_EQ((GetFamily() == AF_INET) ? "127.0.0.1" : "::1", |
| 1059 transaction_.GetResponseInfo()->socket_address.host()); | 1085 transaction_->GetResponseInfo()->socket_address.host()); |
| 1060 EXPECT_EQ(21, transaction_.GetResponseInfo()->socket_address.port()); | 1086 EXPECT_EQ(21, transaction_->GetResponseInfo()->socket_address.port()); |
| 1061 } | 1087 } |
| 1062 | 1088 |
| 1063 TEST_P(FtpNetworkTransactionTest, DownloadTransactionWithPasvFallback) { | 1089 TEST_P(FtpNetworkTransactionTest, DownloadTransactionWithPasvFallback) { |
| 1064 FtpSocketDataProviderFileDownloadWithPasvFallback ctrl_socket; | 1090 FtpSocketDataProviderFileDownloadWithPasvFallback ctrl_socket; |
| 1065 ExecuteTransaction(&ctrl_socket, "ftp://host/file", OK); | 1091 ExecuteTransaction(&ctrl_socket, "ftp://host/file", OK); |
| 1066 | 1092 |
| 1067 // We pass an artificial value of 18 as a response to the SIZE command. | 1093 // We pass an artificial value of 18 as a response to the SIZE command. |
| 1068 EXPECT_EQ(18, transaction_.GetResponseInfo()->expected_content_size); | 1094 EXPECT_EQ(18, transaction_->GetResponseInfo()->expected_content_size); |
| 1069 } | 1095 } |
| 1070 | 1096 |
| 1071 TEST_P(FtpNetworkTransactionTest, DownloadTransactionWithTypecodeA) { | 1097 TEST_P(FtpNetworkTransactionTest, DownloadTransactionWithTypecodeA) { |
| 1072 FtpSocketDataProviderFileDownloadWithFileTypecode ctrl_socket; | 1098 FtpSocketDataProviderFileDownloadWithFileTypecode ctrl_socket; |
| 1073 ctrl_socket.set_data_type('A'); | 1099 ctrl_socket.set_data_type('A'); |
| 1074 ExecuteTransaction(&ctrl_socket, "ftp://host/file;type=a", OK); | 1100 ExecuteTransaction(&ctrl_socket, "ftp://host/file;type=a", OK); |
| 1075 | 1101 |
| 1076 // We pass an artificial value of 18 as a response to the SIZE command. | 1102 // We pass an artificial value of 18 as a response to the SIZE command. |
| 1077 EXPECT_EQ(18, transaction_.GetResponseInfo()->expected_content_size); | 1103 EXPECT_EQ(18, transaction_->GetResponseInfo()->expected_content_size); |
| 1078 } | 1104 } |
| 1079 | 1105 |
| 1080 TEST_P(FtpNetworkTransactionTest, DownloadTransactionWithTypecodeI) { | 1106 TEST_P(FtpNetworkTransactionTest, DownloadTransactionWithTypecodeI) { |
| 1081 FtpSocketDataProviderFileDownloadWithFileTypecode ctrl_socket; | 1107 FtpSocketDataProviderFileDownloadWithFileTypecode ctrl_socket; |
| 1082 ExecuteTransaction(&ctrl_socket, "ftp://host/file;type=i", OK); | 1108 ExecuteTransaction(&ctrl_socket, "ftp://host/file;type=i", OK); |
| 1083 | 1109 |
| 1084 // We pass an artificial value of 18 as a response to the SIZE command. | 1110 // We pass an artificial value of 18 as a response to the SIZE command. |
| 1085 EXPECT_EQ(18, transaction_.GetResponseInfo()->expected_content_size); | 1111 EXPECT_EQ(18, transaction_->GetResponseInfo()->expected_content_size); |
| 1086 } | 1112 } |
| 1087 | 1113 |
| 1088 TEST_P(FtpNetworkTransactionTest, DownloadTransactionMultilineWelcome) { | 1114 TEST_P(FtpNetworkTransactionTest, DownloadTransactionMultilineWelcome) { |
| 1089 FtpSocketDataProviderFileDownload ctrl_socket; | 1115 FtpSocketDataProviderFileDownload ctrl_socket; |
| 1090 ctrl_socket.set_multiline_welcome(true); | 1116 ctrl_socket.set_multiline_welcome(true); |
| 1091 ExecuteTransaction(&ctrl_socket, "ftp://host/file", OK); | 1117 ExecuteTransaction(&ctrl_socket, "ftp://host/file", OK); |
| 1092 } | 1118 } |
| 1093 | 1119 |
| 1094 TEST_P(FtpNetworkTransactionTest, DownloadTransactionShortReads2) { | 1120 TEST_P(FtpNetworkTransactionTest, DownloadTransactionShortReads2) { |
| 1095 FtpSocketDataProviderFileDownload ctrl_socket; | 1121 FtpSocketDataProviderFileDownload ctrl_socket; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1165 FtpSocketDataProviderEvilPasv ctrl_socket( | 1191 FtpSocketDataProviderEvilPasv ctrl_socket( |
| 1166 "227 Portscan (10,1,2,3,123,456)\r\n", FtpSocketDataProvider::PRE_RETR); | 1192 "227 Portscan (10,1,2,3,123,456)\r\n", FtpSocketDataProvider::PRE_RETR); |
| 1167 ctrl_socket.set_use_epsv(GetFamily() != AF_INET); | 1193 ctrl_socket.set_use_epsv(GetFamily() != AF_INET); |
| 1168 std::string mock_data("mock-data"); | 1194 std::string mock_data("mock-data"); |
| 1169 MockRead data_reads[] = { | 1195 MockRead data_reads[] = { |
| 1170 MockRead(mock_data.c_str()), | 1196 MockRead(mock_data.c_str()), |
| 1171 }; | 1197 }; |
| 1172 StaticSocketDataProvider data_socket1; | 1198 StaticSocketDataProvider data_socket1; |
| 1173 StaticSocketDataProvider data_socket2(data_reads, arraysize(data_reads), | 1199 StaticSocketDataProvider data_socket2(data_reads, arraysize(data_reads), |
| 1174 NULL, 0); | 1200 NULL, 0); |
| 1175 mock_socket_factory_.AddSocketDataProvider(&ctrl_socket); | 1201 mock_socket_factory_->AddSocketDataProvider(&ctrl_socket); |
| 1176 mock_socket_factory_.AddSocketDataProvider(&data_socket1); | 1202 mock_socket_factory_->AddSocketDataProvider(&data_socket1); |
| 1177 mock_socket_factory_.AddSocketDataProvider(&data_socket2); | 1203 mock_socket_factory_->AddSocketDataProvider(&data_socket2); |
| 1178 FtpRequestInfo request_info = GetRequestInfo("ftp://host/file"); | 1204 FtpRequestInfo request_info = GetRequestInfo("ftp://host/file"); |
| 1179 | 1205 |
| 1180 // Start the transaction. | 1206 // Start the transaction. |
| 1181 ASSERT_EQ(ERR_IO_PENDING, | 1207 ASSERT_EQ(ERR_IO_PENDING, |
| 1182 transaction_.Start(&request_info, callback_.callback(), | 1208 transaction_->Start(&request_info, callback_.callback(), |
| 1183 NetLogWithSource())); | 1209 NetLogWithSource())); |
| 1184 ASSERT_THAT(callback_.WaitForResult(), IsOk()); | 1210 ASSERT_THAT(callback_.WaitForResult(), IsOk()); |
| 1185 | 1211 |
| 1186 // The transaction fires the callback when we can start reading data. That | 1212 // The transaction fires the callback when we can start reading data. That |
| 1187 // means that the data socket should be open. | 1213 // means that the data socket should be open. |
| 1188 MockTCPClientSocket* data_socket = | 1214 MockTCPClientSocket* data_socket = |
| 1189 static_cast<MockTCPClientSocket*>(transaction_.data_socket_.get()); | 1215 static_cast<MockTCPClientSocket*>(transaction_->data_socket_.get()); |
| 1190 ASSERT_TRUE(data_socket); | 1216 ASSERT_TRUE(data_socket); |
| 1191 ASSERT_TRUE(data_socket->IsConnected()); | 1217 ASSERT_TRUE(data_socket->IsConnected()); |
| 1192 | 1218 |
| 1193 // Even if the PASV response specified some other address, we connect | 1219 // Even if the PASV response specified some other address, we connect |
| 1194 // to the address we used for control connection (which could be 127.0.0.1 | 1220 // to the address we used for control connection (which could be 127.0.0.1 |
| 1195 // or ::1 depending on whether we use IPv6). | 1221 // or ::1 depending on whether we use IPv6). |
| 1196 for (AddressList::const_iterator it = data_socket->addresses().begin(); | 1222 for (AddressList::const_iterator it = data_socket->addresses().begin(); |
| 1197 it != data_socket->addresses().end(); ++it) { | 1223 it != data_socket->addresses().end(); ++it) { |
| 1198 EXPECT_NE("10.1.2.3", it->ToStringWithoutPort()); | 1224 EXPECT_NE("10.1.2.3", it->ToStringWithoutPort()); |
| 1199 } | 1225 } |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1344 | 1370 |
| 1345 // Make sure FtpNetworkTransaction doesn't request paths like | 1371 // Make sure FtpNetworkTransaction doesn't request paths like |
| 1346 // "/foo/../bar". Doing so wouldn't be a security issue, client side, but just | 1372 // "/foo/../bar". Doing so wouldn't be a security issue, client side, but just |
| 1347 // doesn't seem like a good idea. | 1373 // doesn't seem like a good idea. |
| 1348 TEST_P(FtpNetworkTransactionTest, | 1374 TEST_P(FtpNetworkTransactionTest, |
| 1349 DownloadTransactionPathSeparatorsNotUnescaped) { | 1375 DownloadTransactionPathSeparatorsNotUnescaped) { |
| 1350 FtpSocketDataProviderPathSeparatorsNotUnescaped ctrl_socket; | 1376 FtpSocketDataProviderPathSeparatorsNotUnescaped ctrl_socket; |
| 1351 ExecuteTransaction(&ctrl_socket, "ftp://host/foo%2f..%2fbar%5c", OK); | 1377 ExecuteTransaction(&ctrl_socket, "ftp://host/foo%2f..%2fbar%5c", OK); |
| 1352 | 1378 |
| 1353 // We pass an artificial value of 18 as a response to the SIZE command. | 1379 // We pass an artificial value of 18 as a response to the SIZE command. |
| 1354 EXPECT_EQ(18, transaction_.GetResponseInfo()->expected_content_size); | 1380 EXPECT_EQ(18, transaction_->GetResponseInfo()->expected_content_size); |
| 1355 } | 1381 } |
| 1356 | 1382 |
| 1357 TEST_P(FtpNetworkTransactionTest, EvilRestartUser) { | 1383 TEST_P(FtpNetworkTransactionTest, EvilRestartUser) { |
| 1358 FtpSocketDataProvider ctrl_socket1; | 1384 FtpSocketDataProvider ctrl_socket1; |
| 1359 ctrl_socket1.InjectFailure(FtpSocketDataProvider::PRE_PASSWD, | 1385 ctrl_socket1.InjectFailure(FtpSocketDataProvider::PRE_PASSWD, |
| 1360 FtpSocketDataProvider::PRE_QUIT, | 1386 FtpSocketDataProvider::PRE_QUIT, |
| 1361 "530 Login authentication failed\r\n"); | 1387 "530 Login authentication failed\r\n"); |
| 1362 mock_socket_factory_.AddSocketDataProvider(&ctrl_socket1); | 1388 mock_socket_factory_->AddSocketDataProvider(&ctrl_socket1); |
| 1363 | 1389 |
| 1364 FtpRequestInfo request_info = GetRequestInfo("ftp://host/file"); | 1390 FtpRequestInfo request_info = GetRequestInfo("ftp://host/file"); |
| 1365 | 1391 |
| 1366 ASSERT_EQ(ERR_IO_PENDING, | 1392 ASSERT_EQ(ERR_IO_PENDING, |
| 1367 transaction_.Start(&request_info, callback_.callback(), | 1393 transaction_->Start(&request_info, callback_.callback(), |
| 1368 NetLogWithSource())); | 1394 NetLogWithSource())); |
| 1369 ASSERT_THAT(callback_.WaitForResult(), IsError(ERR_FTP_FAILED)); | 1395 ASSERT_THAT(callback_.WaitForResult(), IsError(ERR_FTP_FAILED)); |
| 1370 | 1396 |
| 1371 MockRead ctrl_reads[] = { | 1397 MockRead ctrl_reads[] = { |
| 1372 MockRead("220 host TestFTPd\r\n"), | 1398 MockRead("220 host TestFTPd\r\n"), |
| 1373 MockRead("221 Goodbye!\r\n"), | 1399 MockRead("221 Goodbye!\r\n"), |
| 1374 MockRead(SYNCHRONOUS, OK), | 1400 MockRead(SYNCHRONOUS, OK), |
| 1375 }; | 1401 }; |
| 1376 MockWrite ctrl_writes[] = { | 1402 MockWrite ctrl_writes[] = { |
| 1377 MockWrite("QUIT\r\n"), | 1403 MockWrite("QUIT\r\n"), |
| 1378 }; | 1404 }; |
| 1379 StaticSocketDataProvider ctrl_socket2(ctrl_reads, arraysize(ctrl_reads), | 1405 StaticSocketDataProvider ctrl_socket2(ctrl_reads, arraysize(ctrl_reads), |
| 1380 ctrl_writes, arraysize(ctrl_writes)); | 1406 ctrl_writes, arraysize(ctrl_writes)); |
| 1381 mock_socket_factory_.AddSocketDataProvider(&ctrl_socket2); | 1407 mock_socket_factory_->AddSocketDataProvider(&ctrl_socket2); |
| 1382 ASSERT_EQ(ERR_IO_PENDING, | 1408 ASSERT_EQ(ERR_IO_PENDING, |
| 1383 transaction_.RestartWithAuth( | 1409 transaction_->RestartWithAuth( |
| 1384 AuthCredentials( | 1410 AuthCredentials(base::ASCIIToUTF16("foo\nownz0red"), |
| 1385 base::ASCIIToUTF16("foo\nownz0red"), | 1411 base::ASCIIToUTF16("innocent")), |
| 1386 base::ASCIIToUTF16("innocent")), | |
| 1387 callback_.callback())); | 1412 callback_.callback())); |
| 1388 EXPECT_THAT(callback_.WaitForResult(), IsError(ERR_MALFORMED_IDENTITY)); | 1413 EXPECT_THAT(callback_.WaitForResult(), IsError(ERR_MALFORMED_IDENTITY)); |
| 1389 } | 1414 } |
| 1390 | 1415 |
| 1391 TEST_P(FtpNetworkTransactionTest, EvilRestartPassword) { | 1416 TEST_P(FtpNetworkTransactionTest, EvilRestartPassword) { |
| 1392 FtpSocketDataProvider ctrl_socket1; | 1417 FtpSocketDataProvider ctrl_socket1; |
| 1393 ctrl_socket1.InjectFailure(FtpSocketDataProvider::PRE_PASSWD, | 1418 ctrl_socket1.InjectFailure(FtpSocketDataProvider::PRE_PASSWD, |
| 1394 FtpSocketDataProvider::PRE_QUIT, | 1419 FtpSocketDataProvider::PRE_QUIT, |
| 1395 "530 Login authentication failed\r\n"); | 1420 "530 Login authentication failed\r\n"); |
| 1396 mock_socket_factory_.AddSocketDataProvider(&ctrl_socket1); | 1421 mock_socket_factory_->AddSocketDataProvider(&ctrl_socket1); |
| 1397 | 1422 |
| 1398 FtpRequestInfo request_info = GetRequestInfo("ftp://host/file"); | 1423 FtpRequestInfo request_info = GetRequestInfo("ftp://host/file"); |
| 1399 | 1424 |
| 1400 ASSERT_EQ(ERR_IO_PENDING, | 1425 ASSERT_EQ(ERR_IO_PENDING, |
| 1401 transaction_.Start(&request_info, callback_.callback(), | 1426 transaction_->Start(&request_info, callback_.callback(), |
| 1402 NetLogWithSource())); | 1427 NetLogWithSource())); |
| 1403 ASSERT_THAT(callback_.WaitForResult(), IsError(ERR_FTP_FAILED)); | 1428 ASSERT_THAT(callback_.WaitForResult(), IsError(ERR_FTP_FAILED)); |
| 1404 | 1429 |
| 1405 MockRead ctrl_reads[] = { | 1430 MockRead ctrl_reads[] = { |
| 1406 MockRead("220 host TestFTPd\r\n"), | 1431 MockRead("220 host TestFTPd\r\n"), |
| 1407 MockRead("331 User okay, send password\r\n"), | 1432 MockRead("331 User okay, send password\r\n"), |
| 1408 MockRead("221 Goodbye!\r\n"), | 1433 MockRead("221 Goodbye!\r\n"), |
| 1409 MockRead(SYNCHRONOUS, OK), | 1434 MockRead(SYNCHRONOUS, OK), |
| 1410 }; | 1435 }; |
| 1411 MockWrite ctrl_writes[] = { | 1436 MockWrite ctrl_writes[] = { |
| 1412 MockWrite("USER innocent\r\n"), | 1437 MockWrite("USER innocent\r\n"), |
| 1413 MockWrite("QUIT\r\n"), | 1438 MockWrite("QUIT\r\n"), |
| 1414 }; | 1439 }; |
| 1415 StaticSocketDataProvider ctrl_socket2(ctrl_reads, arraysize(ctrl_reads), | 1440 StaticSocketDataProvider ctrl_socket2(ctrl_reads, arraysize(ctrl_reads), |
| 1416 ctrl_writes, arraysize(ctrl_writes)); | 1441 ctrl_writes, arraysize(ctrl_writes)); |
| 1417 mock_socket_factory_.AddSocketDataProvider(&ctrl_socket2); | 1442 mock_socket_factory_->AddSocketDataProvider(&ctrl_socket2); |
| 1418 ASSERT_EQ(ERR_IO_PENDING, | 1443 ASSERT_EQ(ERR_IO_PENDING, |
| 1419 transaction_.RestartWithAuth( | 1444 transaction_->RestartWithAuth( |
| 1420 AuthCredentials(base::ASCIIToUTF16("innocent"), | 1445 AuthCredentials(base::ASCIIToUTF16("innocent"), |
| 1421 base::ASCIIToUTF16("foo\nownz0red")), | 1446 base::ASCIIToUTF16("foo\nownz0red")), |
| 1422 callback_.callback())); | 1447 callback_.callback())); |
| 1423 EXPECT_THAT(callback_.WaitForResult(), IsError(ERR_MALFORMED_IDENTITY)); | 1448 EXPECT_THAT(callback_.WaitForResult(), IsError(ERR_MALFORMED_IDENTITY)); |
| 1424 } | 1449 } |
| 1425 | 1450 |
| 1426 TEST_P(FtpNetworkTransactionTest, Escaping) { | 1451 TEST_P(FtpNetworkTransactionTest, Escaping) { |
| 1427 FtpSocketDataProviderEscaping ctrl_socket; | 1452 FtpSocketDataProviderEscaping ctrl_socket; |
| 1428 ExecuteTransaction(&ctrl_socket, "ftp://host/%20%21%22%23%24%25%79%80%81", | 1453 ExecuteTransaction(&ctrl_socket, "ftp://host/%20%21%22%23%24%25%79%80%81", |
| 1429 OK); | 1454 OK); |
| 1430 } | 1455 } |
| 1431 | 1456 |
| 1432 // Test for http://crbug.com/23794. | 1457 // Test for http://crbug.com/23794. |
| 1433 TEST_P(FtpNetworkTransactionTest, DownloadTransactionEvilSize) { | 1458 TEST_P(FtpNetworkTransactionTest, DownloadTransactionEvilSize) { |
| 1434 // Try to overflow int64_t in the response. | 1459 // Try to overflow int64_t in the response. |
| 1435 FtpSocketDataProviderEvilSize ctrl_socket( | 1460 FtpSocketDataProviderEvilSize ctrl_socket( |
| 1436 "213 99999999999999999999999999999999\r\n", | 1461 "213 99999999999999999999999999999999\r\n", |
| 1437 FtpSocketDataProvider::PRE_QUIT); | 1462 FtpSocketDataProvider::PRE_QUIT); |
| 1438 ExecuteTransaction(&ctrl_socket, "ftp://host/file", ERR_INVALID_RESPONSE); | 1463 ExecuteTransaction(&ctrl_socket, "ftp://host/file", ERR_INVALID_RESPONSE); |
| 1439 } | 1464 } |
| 1440 | 1465 |
| 1441 // Test for http://crbug.com/36360. | 1466 // Test for http://crbug.com/36360. |
| 1442 TEST_P(FtpNetworkTransactionTest, DownloadTransactionBigSize) { | 1467 TEST_P(FtpNetworkTransactionTest, DownloadTransactionBigSize) { |
| 1443 // Pass a valid, but large file size. The transaction should not fail. | 1468 // Pass a valid, but large file size. The transaction should not fail. |
| 1444 FtpSocketDataProviderEvilSize ctrl_socket( | 1469 FtpSocketDataProviderEvilSize ctrl_socket( |
| 1445 "213 3204427776\r\n", | 1470 "213 3204427776\r\n", |
| 1446 FtpSocketDataProvider::PRE_CWD); | 1471 FtpSocketDataProvider::PRE_CWD); |
| 1447 ExecuteTransaction(&ctrl_socket, "ftp://host/file", OK); | 1472 ExecuteTransaction(&ctrl_socket, "ftp://host/file", OK); |
| 1448 EXPECT_EQ(3204427776LL, | 1473 EXPECT_EQ(3204427776LL, |
| 1449 transaction_.GetResponseInfo()->expected_content_size); | 1474 transaction_->GetResponseInfo()->expected_content_size); |
| 1450 } | 1475 } |
| 1451 | 1476 |
| 1452 // Regression test for http://crbug.com/25023. | 1477 // Regression test for http://crbug.com/25023. |
| 1453 TEST_P(FtpNetworkTransactionTest, CloseConnection) { | 1478 TEST_P(FtpNetworkTransactionTest, CloseConnection) { |
| 1454 FtpSocketDataProviderCloseConnection ctrl_socket; | 1479 FtpSocketDataProviderCloseConnection ctrl_socket; |
| 1455 ExecuteTransaction(&ctrl_socket, "ftp://host", ERR_EMPTY_RESPONSE); | 1480 ExecuteTransaction(&ctrl_socket, "ftp://host", ERR_EMPTY_RESPONSE); |
| 1456 } | 1481 } |
| 1457 | 1482 |
| 1458 TEST_P(FtpNetworkTransactionTest, DirectoryTransactionFailUser) { | 1483 TEST_P(FtpNetworkTransactionTest, DirectoryTransactionFailUser) { |
| 1459 FtpSocketDataProviderDirectoryListing ctrl_socket; | 1484 FtpSocketDataProviderDirectoryListing ctrl_socket; |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1653 TEST_P(FtpNetworkTransactionTest, ZeroLengthDirInPWD) { | 1678 TEST_P(FtpNetworkTransactionTest, ZeroLengthDirInPWD) { |
| 1654 FtpSocketDataProviderFileDownload ctrl_socket; | 1679 FtpSocketDataProviderFileDownload ctrl_socket; |
| 1655 TransactionFailHelper(&ctrl_socket, | 1680 TransactionFailHelper(&ctrl_socket, |
| 1656 "ftp://host/file", | 1681 "ftp://host/file", |
| 1657 FtpSocketDataProvider::PRE_PWD, | 1682 FtpSocketDataProvider::PRE_PWD, |
| 1658 FtpSocketDataProvider::PRE_TYPE, | 1683 FtpSocketDataProvider::PRE_TYPE, |
| 1659 "257 \"\"\r\n", | 1684 "257 \"\"\r\n", |
| 1660 OK); | 1685 OK); |
| 1661 } | 1686 } |
| 1662 | 1687 |
| 1688 TEST_P(FtpNetworkTransactionTest, UnexpectedInitiatedResponseForDirectory) { |
| 1689 // The states for a directory listing where an initiated response will cause |
| 1690 // an error. Includes all commands sent on the directory listing path, except |
| 1691 // CWD, SIZE, LIST, and QUIT commands. |
| 1692 FtpSocketDataProvider::State kFailingStates[] = { |
| 1693 FtpSocketDataProvider::PRE_USER, FtpSocketDataProvider::PRE_PASSWD, |
| 1694 FtpSocketDataProvider::PRE_SYST, FtpSocketDataProvider::PRE_PWD, |
| 1695 FtpSocketDataProvider::PRE_TYPE, |
| 1696 GetFamily() != AF_INET ? FtpSocketDataProvider::PRE_LIST_EPSV |
| 1697 : FtpSocketDataProvider::PRE_LIST_PASV, |
| 1698 FtpSocketDataProvider::PRE_CWD, |
| 1699 }; |
| 1700 |
| 1701 for (FtpSocketDataProvider::State state : kFailingStates) { |
| 1702 SetUpTransaction(); |
| 1703 FtpSocketDataProviderDirectoryListing ctrl_socket; |
| 1704 ctrl_socket.InjectFailure(state, FtpSocketDataProvider::PRE_QUIT, |
| 1705 "157 Foo\r\n"); |
| 1706 ExecuteTransaction(&ctrl_socket, "ftp://host/", ERR_INVALID_RESPONSE); |
| 1707 } |
| 1708 } |
| 1709 |
| 1710 TEST_P(FtpNetworkTransactionTest, UnexpectedInitiatedResponseForFile) { |
| 1711 // The states for a download where an initiated response will cause an error. |
| 1712 // Includes all commands sent on the file download path, except CWD, SIZE, and |
| 1713 // QUIT commands. |
| 1714 const FtpSocketDataProvider::State kFailingStates[] = { |
| 1715 FtpSocketDataProvider::PRE_USER, FtpSocketDataProvider::PRE_PASSWD, |
| 1716 FtpSocketDataProvider::PRE_SYST, FtpSocketDataProvider::PRE_PWD, |
| 1717 FtpSocketDataProvider::PRE_TYPE, |
| 1718 GetFamily() != AF_INET ? FtpSocketDataProvider::PRE_RETR_EPSV |
| 1719 : FtpSocketDataProvider::PRE_RETR_PASV, |
| 1720 FtpSocketDataProvider::PRE_CWD}; |
| 1721 |
| 1722 for (FtpSocketDataProvider::State state : kFailingStates) { |
| 1723 LOG(ERROR) << "??: " << state; |
| 1724 SetUpTransaction(); |
| 1725 FtpSocketDataProviderFileDownload ctrl_socket; |
| 1726 ctrl_socket.InjectFailure(state, FtpSocketDataProvider::PRE_QUIT, |
| 1727 "157 Foo\r\n"); |
| 1728 ExecuteTransaction(&ctrl_socket, "ftp://host/file", ERR_INVALID_RESPONSE); |
| 1729 } |
| 1730 } |
| 1731 |
| 1663 INSTANTIATE_TEST_CASE_P(FTP, | 1732 INSTANTIATE_TEST_CASE_P(FTP, |
| 1664 FtpNetworkTransactionTest, | 1733 FtpNetworkTransactionTest, |
| 1665 ::testing::Values(AF_INET, AF_INET6)); | 1734 ::testing::Values(AF_INET, AF_INET6)); |
| 1666 | 1735 |
| 1667 } // namespace net | 1736 } // namespace net |
| OLD | NEW |