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

Unified Diff: net/ftp/ftp_ctrl_response_buffer_unittest.cc

Issue 467032: net/ftp: Fix control response parsing for a corner cases where the first line... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/ftp/ftp_ctrl_response_buffer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ftp/ftp_ctrl_response_buffer_unittest.cc
===================================================================
--- net/ftp/ftp_ctrl_response_buffer_unittest.cc (revision 33979)
+++ net/ftp/ftp_ctrl_response_buffer_unittest.cc (working copy)
@@ -96,6 +96,25 @@
EXPECT_EQ("LastLine", response.lines[2]);
}
+TEST_F(FtpCtrlResponseBufferTest, MultilineContinuationZeroLength) {
+ // For the corner case from bug 29322.
+ EXPECT_EQ(net::OK, PushDataToBuffer("230-\r\n"));
+ EXPECT_FALSE(buffer_.ResponseAvailable());
+
+ EXPECT_EQ(net::OK, PushDataToBuffer("example.com\r\n"));
+ EXPECT_FALSE(buffer_.ResponseAvailable());
+
+ EXPECT_EQ(net::OK, PushDataToBuffer("230 LastLine\r\n"));
+ EXPECT_TRUE(buffer_.ResponseAvailable());
+
+ net::FtpCtrlResponse response = buffer_.PopResponse();
+ EXPECT_FALSE(buffer_.ResponseAvailable());
+ EXPECT_EQ(230, response.status_code);
+ ASSERT_EQ(2U, response.lines.size());
+ EXPECT_EQ("example.com", response.lines[0]);
+ EXPECT_EQ("LastLine", response.lines[1]);
+}
+
TEST_F(FtpCtrlResponseBufferTest, SimilarContinuation) {
EXPECT_EQ(net::OK, PushDataToBuffer("230-FirstLine\r\n"));
EXPECT_FALSE(buffer_.ResponseAvailable());
Property changes on: net/ftp/ftp_ctrl_response_buffer_unittest.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « net/ftp/ftp_ctrl_response_buffer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698