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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 MockWriteResult OnWrite(const std::string& data) override { | 66 MockWriteResult OnWrite(const std::string& data) override { |
67 if (InjectFault()) | 67 if (InjectFault()) |
68 return MockWriteResult(ASYNC, data.length()); | 68 return MockWriteResult(ASYNC, data.length()); |
69 switch (state()) { | 69 switch (state()) { |
70 case PRE_USER: | 70 case PRE_USER: |
71 return Verify("USER anonymous\r\n", data, PRE_PASSWD, | 71 return Verify("USER anonymous\r\n", data, PRE_PASSWD, |
72 "331 Password needed\r\n"); | 72 "331 Password needed\r\n"); |
73 case PRE_PASSWD: | 73 case PRE_PASSWD: |
74 { | 74 { |
75 const char* response_one = "230 Welcome\r\n"; | 75 static const char response_one[] = "230 Welcome\r\n"; |
76 const char* response_multi = "230- One\r\n230- Two\r\n230 Three\r\n"; | 76 static const char response_multi[] = |
| 77 "230- One\r\n230- Two\r\n230 Three\r\n"; |
77 return Verify("PASS chrome@example.com\r\n", data, PRE_SYST, | 78 return Verify("PASS chrome@example.com\r\n", data, PRE_SYST, |
78 multiline_welcome_ ? response_multi : response_one); | 79 multiline_welcome_ ? response_multi : response_one); |
79 } | 80 } |
80 case PRE_SYST: | 81 case PRE_SYST: |
81 return Verify("SYST\r\n", data, PRE_PWD, "215 UNIX\r\n"); | 82 return Verify("SYST\r\n", data, PRE_PWD, "215 UNIX\r\n"); |
82 case PRE_PWD: | 83 case PRE_PWD: |
83 return Verify("PWD\r\n", data, PRE_TYPE, | 84 return Verify("PWD\r\n", data, PRE_TYPE, |
84 "257 \"/\" is your current location\r\n"); | 85 "257 \"/\" is your current location\r\n"); |
85 case PRE_TYPE: | 86 case PRE_TYPE: |
86 return Verify(std::string("TYPE ") + data_type_ + "\r\n", data, | 87 return Verify(std::string("TYPE ") + data_type_ + "\r\n", data, |
(...skipping 1507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1594 FtpSocketDataProvider::PRE_TYPE, | 1595 FtpSocketDataProvider::PRE_TYPE, |
1595 "257 \"\"\r\n", | 1596 "257 \"\"\r\n", |
1596 OK); | 1597 OK); |
1597 } | 1598 } |
1598 | 1599 |
1599 INSTANTIATE_TEST_CASE_P(FTP, | 1600 INSTANTIATE_TEST_CASE_P(FTP, |
1600 FtpNetworkTransactionTest, | 1601 FtpNetworkTransactionTest, |
1601 ::testing::Values(AF_INET, AF_INET6)); | 1602 ::testing::Values(AF_INET, AF_INET6)); |
1602 | 1603 |
1603 } // namespace net | 1604 } // namespace net |
OLD | NEW |