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/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { | 184 virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { |
185 if (InjectFault()) | 185 if (InjectFault()) |
186 return MockWriteResult(ASYNC, data.length()); | 186 return MockWriteResult(ASYNC, data.length()); |
187 switch (state()) { | 187 switch (state()) { |
188 case PRE_SIZE: | 188 case PRE_SIZE: |
189 return Verify("SIZE /\r\n", data, PRE_CWD, | 189 return Verify("SIZE /\r\n", data, PRE_CWD, |
190 "550 I can only retrieve regular files\r\n"); | 190 "550 I can only retrieve regular files\r\n"); |
191 case PRE_CWD: | 191 case PRE_CWD: |
192 return Verify("CWD /\r\n", data, PRE_LIST, "200 OK\r\n"); | 192 return Verify("CWD /\r\n", data, PRE_LIST, "200 OK\r\n"); |
193 case PRE_LIST: | 193 case PRE_LIST: |
194 return Verify("LIST\r\n", data, PRE_QUIT, "200 OK\r\n"); | 194 return Verify("LIST -l\r\n", data, PRE_QUIT, "200 OK\r\n"); |
195 default: | 195 default: |
196 return FtpSocketDataProvider::OnWrite(data); | 196 return FtpSocketDataProvider::OnWrite(data); |
197 } | 197 } |
198 } | 198 } |
199 | 199 |
200 private: | 200 private: |
201 DISALLOW_COPY_AND_ASSIGN(FtpSocketDataProviderDirectoryListing); | 201 DISALLOW_COPY_AND_ASSIGN(FtpSocketDataProviderDirectoryListing); |
202 }; | 202 }; |
203 | 203 |
204 class FtpSocketDataProviderDirectoryListingWithPasvFallback | 204 class FtpSocketDataProviderDirectoryListingWithPasvFallback |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 : public FtpSocketDataProviderDirectoryListing { | 565 : public FtpSocketDataProviderDirectoryListing { |
566 public: | 566 public: |
567 FtpSocketDataProviderDirectoryListingTransferStarting() { | 567 FtpSocketDataProviderDirectoryListingTransferStarting() { |
568 } | 568 } |
569 | 569 |
570 virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { | 570 virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { |
571 if (InjectFault()) | 571 if (InjectFault()) |
572 return MockWriteResult(ASYNC, data.length()); | 572 return MockWriteResult(ASYNC, data.length()); |
573 switch (state()) { | 573 switch (state()) { |
574 case PRE_LIST: | 574 case PRE_LIST: |
575 return Verify("LIST\r\n", data, PRE_QUIT, | 575 return Verify("LIST -l\r\n", data, PRE_QUIT, |
576 "125-Data connection already open.\r\n" | 576 "125-Data connection already open.\r\n" |
577 "125 Transfer starting.\r\n" | 577 "125 Transfer starting.\r\n" |
578 "226 Transfer complete.\r\n"); | 578 "226 Transfer complete.\r\n"); |
579 default: | 579 default: |
580 return FtpSocketDataProviderDirectoryListing::OnWrite(data); | 580 return FtpSocketDataProviderDirectoryListing::OnWrite(data); |
581 } | 581 } |
582 } | 582 } |
583 | 583 |
584 private: | 584 private: |
585 DISALLOW_COPY_AND_ASSIGN( | 585 DISALLOW_COPY_AND_ASSIGN( |
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1466 FtpSocketDataProviderFileDownload ctrl_socket; | 1466 FtpSocketDataProviderFileDownload ctrl_socket; |
1467 TransactionFailHelper(&ctrl_socket, | 1467 TransactionFailHelper(&ctrl_socket, |
1468 "ftp://host/file", | 1468 "ftp://host/file", |
1469 FtpSocketDataProvider::PRE_PWD, | 1469 FtpSocketDataProvider::PRE_PWD, |
1470 FtpSocketDataProvider::PRE_TYPE, | 1470 FtpSocketDataProvider::PRE_TYPE, |
1471 "257 \"\"\r\n", | 1471 "257 \"\"\r\n", |
1472 OK); | 1472 OK); |
1473 } | 1473 } |
1474 | 1474 |
1475 } // namespace net | 1475 } // namespace net |
OLD | NEW |