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 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 const char* epsv_response_; | 621 const char* epsv_response_; |
622 const size_t epsv_response_length_; | 622 const size_t epsv_response_length_; |
623 const State expected_state_; | 623 const State expected_state_; |
624 | 624 |
625 DISALLOW_COPY_AND_ASSIGN(FtpSocketDataProviderEvilEpsv); | 625 DISALLOW_COPY_AND_ASSIGN(FtpSocketDataProviderEvilEpsv); |
626 }; | 626 }; |
627 | 627 |
628 class FtpSocketDataProviderEvilPasv | 628 class FtpSocketDataProviderEvilPasv |
629 : public FtpSocketDataProviderFileDownloadWithPasvFallback { | 629 : public FtpSocketDataProviderFileDownloadWithPasvFallback { |
630 public: | 630 public: |
631 explicit FtpSocketDataProviderEvilPasv(const char* pasv_response, | 631 FtpSocketDataProviderEvilPasv(const char* pasv_response, State expected_state) |
632 State expected_state) | |
633 : pasv_response_(pasv_response), | 632 : pasv_response_(pasv_response), |
634 expected_state_(expected_state) { | 633 expected_state_(expected_state) { |
635 } | 634 } |
636 | 635 |
637 virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { | 636 virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { |
638 if (InjectFault()) | 637 if (InjectFault()) |
639 return MockWriteResult(true, data.length()); | 638 return MockWriteResult(true, data.length()); |
640 switch (state()) { | 639 switch (state()) { |
641 case PRE_PASV: | 640 case PRE_PASV: |
642 return Verify("PASV\r\n", data, expected_state_, pasv_response_); | 641 return Verify("PASV\r\n", data, expected_state_, pasv_response_); |
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1432 FtpSocketDataProviderFileDownload ctrl_socket; | 1431 FtpSocketDataProviderFileDownload ctrl_socket; |
1433 TransactionFailHelper(&ctrl_socket, | 1432 TransactionFailHelper(&ctrl_socket, |
1434 "ftp://host/file", | 1433 "ftp://host/file", |
1435 FtpSocketDataProvider::PRE_PWD, | 1434 FtpSocketDataProvider::PRE_PWD, |
1436 FtpSocketDataProvider::PRE_TYPE, | 1435 FtpSocketDataProvider::PRE_TYPE, |
1437 "257 \"\"\r\n", | 1436 "257 \"\"\r\n", |
1438 OK); | 1437 OK); |
1439 } | 1438 } |
1440 | 1439 |
1441 } // namespace net | 1440 } // namespace net |
OLD | NEW |