summaryrefslogtreecommitdiffstats
path: root/net/ftp/ftp_network_transaction_unittest.cc
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-05 18:34:47 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-05 18:34:47 +0000
commitb17a1a7fa91f4416b31fbc6fc622b901e37ae199 (patch)
tree9543d6475b5470601ac82bdb0aef58a80fd4651f /net/ftp/ftp_network_transaction_unittest.cc
parenta05cfeea397e7be36e621cf60e218b1ac71d2054 (diff)
downloadchromium_src-b17a1a7fa91f4416b31fbc6fc622b901e37ae199.zip
chromium_src-b17a1a7fa91f4416b31fbc6fc622b901e37ae199.tar.gz
chromium_src-b17a1a7fa91f4416b31fbc6fc622b901e37ae199.tar.bz2
Correctly handle multiple control responses for RETR command.
Re-enable tests which were intermittently failing before this fix and remove debugging code used to track down the issue. TEST=Covered by net_unittests. http://crbug.com/18036 Review URL: http://codereview.chromium.org/160537 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22500 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/ftp/ftp_network_transaction_unittest.cc')
-rw-r--r--net/ftp/ftp_network_transaction_unittest.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/net/ftp/ftp_network_transaction_unittest.cc b/net/ftp/ftp_network_transaction_unittest.cc
index 7726416..cc9c1bb 100644
--- a/net/ftp/ftp_network_transaction_unittest.cc
+++ b/net/ftp/ftp_network_transaction_unittest.cc
@@ -208,6 +208,30 @@ class FtpMockControlSocketFileDownload : public FtpMockControlSocket {
DISALLOW_COPY_AND_ASSIGN(FtpMockControlSocketFileDownload);
};
+class FtpMockControlSocketFileDownloadTransferStarting
+ : public FtpMockControlSocketFileDownload {
+ public:
+ FtpMockControlSocketFileDownloadTransferStarting() {
+ }
+
+ virtual MockWriteResult OnWrite(const std::string& data) {
+ if (InjectFault())
+ return MockWriteResult(true, data.length());
+ switch (state()) {
+ case PRE_RETR:
+ return Verify("RETR /file\r\n", data, PRE_QUIT,
+ "125-Data connection already open.\r\n"
+ "125 Transfer starting.\r\n"
+ "226 Transfer complete.\r\n");
+ default:
+ return FtpMockControlSocketFileDownload::OnWrite(data);
+ }
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(FtpMockControlSocketFileDownloadTransferStarting);
+};
+
class FtpMockControlSocketFileDownloadRetrFail
: public FtpMockControlSocketFileDownload {
public:
@@ -356,6 +380,12 @@ TEST_F(FtpNetworkTransactionTest, DownloadTransactionShortReads5) {
ExecuteTransaction(&ctrl_socket, "ftp://host/file", OK);
}
+TEST_F(FtpNetworkTransactionTest, DownloadTransactionTransferStarting) {
+ FtpMockControlSocketFileDownloadTransferStarting ctrl_socket;
+ ExecuteTransaction(&ctrl_socket, "ftp://host/file", OK);
+}
+
+
TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFailUser) {
FtpMockControlSocketDirectoryListing ctrl_socket;
TransactionFailHelper(&ctrl_socket,