diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-25 16:08:38 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-25 16:08:38 +0000 |
commit | 520dc79d6c0262b48da86e72c34a89a937486ed7 (patch) | |
tree | ee038c776808e2e44811806f15e3d9dfb42b8c5d /net/ftp/ftp_network_transaction_unittest.cc | |
parent | 7c46fa57a345c80dbc812b450a9a2996ab6ace88 (diff) | |
download | chromium_src-520dc79d6c0262b48da86e72c34a89a937486ed7.zip chromium_src-520dc79d6c0262b48da86e72c34a89a937486ed7.tar.gz chromium_src-520dc79d6c0262b48da86e72c34a89a937486ed7.tar.bz2 |
Add a test for correct FTP SIZE response handling when the file size
is big (doesn't fit in a 32-bit integer).
TEST=net_unittests
BUG=36360
Review URL: http://codereview.chromium.org/654011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40022 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/ftp/ftp_network_transaction_unittest.cc')
-rw-r--r-- | net/ftp/ftp_network_transaction_unittest.cc | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/net/ftp/ftp_network_transaction_unittest.cc b/net/ftp/ftp_network_transaction_unittest.cc index adf074e..c695b87 100644 --- a/net/ftp/ftp_network_transaction_unittest.cc +++ b/net/ftp/ftp_network_transaction_unittest.cc @@ -620,12 +620,6 @@ class FtpNetworkTransactionTest : public PlatformTest { ASSERT_EQ(static_cast<int>(mock_data.length()), callback_.WaitForResult()); EXPECT_EQ(mock_data, std::string(io_buffer->data(), mock_data.length())); - if (transaction_.GetResponseInfo()->is_directory_listing) { - EXPECT_EQ(-1, transaction_.GetResponseInfo()->expected_content_size); - } else { - // We pass an artificial value of 18 as a response to the SIZE command. - EXPECT_EQ(18, transaction_.GetResponseInfo()->expected_content_size); - } } EXPECT_EQ(LOAD_STATE_IDLE, transaction_.GetLoadState()); } @@ -660,6 +654,9 @@ TEST_F(FtpNetworkTransactionTest, FailedLookup) { TEST_F(FtpNetworkTransactionTest, DirectoryTransaction) { FtpSocketDataProviderDirectoryListing ctrl_socket; ExecuteTransaction(&ctrl_socket, "ftp://host", OK); + + EXPECT_TRUE(transaction_.GetResponseInfo()->is_directory_listing); + EXPECT_EQ(-1, transaction_.GetResponseInfo()->expected_content_size); } TEST_F(FtpNetworkTransactionTest, DirectoryTransactionMultilineWelcome) { @@ -708,6 +705,9 @@ TEST_F(FtpNetworkTransactionTest, DirectoryTransactionTransferStarting) { TEST_F(FtpNetworkTransactionTest, DownloadTransaction) { FtpSocketDataProviderFileDownload ctrl_socket; ExecuteTransaction(&ctrl_socket, "ftp://host/file", OK); + + // We pass an artificial value of 18 as a response to the SIZE command. + EXPECT_EQ(18, transaction_.GetResponseInfo()->expected_content_size); } TEST_F(FtpNetworkTransactionTest, DownloadTransactionMultilineWelcome) { @@ -949,6 +949,17 @@ TEST_F(FtpNetworkTransactionTest, DownloadTransactionEvilSize) { ExecuteTransaction(&ctrl_socket, "ftp://host/file", ERR_INVALID_RESPONSE); } +// Test for http://crbug.com/36360. +TEST_F(FtpNetworkTransactionTest, DownloadTransactionBigSize) { + // Pass a valid, but large file size. The transaction should not fail. + FtpSocketDataProviderEvilSize ctrl_socket( + "213 3204427776\r\n", + FtpSocketDataProvider::PRE_MDTM); + ExecuteTransaction(&ctrl_socket, "ftp://host/file", OK); + EXPECT_EQ(3204427776LL, + transaction_.GetResponseInfo()->expected_content_size); +} + // Regression test for http://crbug.com/25023. TEST_F(FtpNetworkTransactionTest, CloseConnection) { FtpSocketDataProviderCloseConnection ctrl_socket; |