Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(911)

Side by Side Diff: net/ftp/ftp_network_transaction_unittest.cc

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « net/ftp/ftp_directory_listing_parser_windows_unittest.cc ('k') | net/http/http_auth_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698