summaryrefslogtreecommitdiffstats
path: root/net/ftp
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-09 08:03:39 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-09 08:03:39 +0000
commit31a2bfeeba9a52f4dc651672aeeee9a66edae3b3 (patch)
tree6b76f6a7b0ad9b148f6587c0289032a94e2c3e6a /net/ftp
parent2a5ab280301194dd5594c9f76460b20a6755e499 (diff)
downloadchromium_src-31a2bfeeba9a52f4dc651672aeeee9a66edae3b3.zip
chromium_src-31a2bfeeba9a52f4dc651672aeeee9a66edae3b3.tar.gz
chromium_src-31a2bfeeba9a52f4dc651672aeeee9a66edae3b3.tar.bz2
Add bounds checking to StaticSocketDataProvider, to make tests more reliable
when they fail. TEST=net_unittests BUG=27567 Review URL: http://codereview.chromium.org/582020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38453 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/ftp')
-rw-r--r--net/ftp/ftp_network_transaction_unittest.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/net/ftp/ftp_network_transaction_unittest.cc b/net/ftp/ftp_network_transaction_unittest.cc
index d8479aa5..e46e1ba 100644
--- a/net/ftp/ftp_network_transaction_unittest.cc
+++ b/net/ftp/ftp_network_transaction_unittest.cc
@@ -574,8 +574,8 @@ class FtpNetworkTransactionTest : public PlatformTest {
};
// For compatibility with FileZilla, the transaction code will use two data
// sockets for directory requests. For more info see http://crbug.com/25316.
- StaticSocketDataProvider data1(data_reads, NULL);
- StaticSocketDataProvider data2(data_reads, NULL);
+ StaticSocketDataProvider data1(data_reads, arraysize(data_reads), NULL, 0);
+ StaticSocketDataProvider data2(data_reads, arraysize(data_reads), NULL, 0);
mock_socket_factory_.AddSocketDataProvider(ctrl_socket);
mock_socket_factory_.AddSocketDataProvider(&data1);
mock_socket_factory_.AddSocketDataProvider(&data2);
@@ -707,7 +707,8 @@ TEST_F(FtpNetworkTransactionTest, DownloadTransactionAcceptedDataConnection) {
MockRead data_reads[] = {
MockRead(mock_data.c_str()),
};
- StaticSocketDataProvider data_socket1(data_reads, NULL);
+ StaticSocketDataProvider data_socket1(data_reads, arraysize(data_reads),
+ NULL, 0);
mock_socket_factory_.AddSocketDataProvider(&ctrl_socket);
mock_socket_factory_.AddSocketDataProvider(&data_socket1);
FtpRequestInfo request_info = GetRequestInfo("ftp://host/file");
@@ -791,7 +792,8 @@ TEST_F(FtpNetworkTransactionTest, DownloadTransactionEvilPasvUnsafeHost) {
MockRead data_reads[] = {
MockRead(mock_data.c_str()),
};
- StaticSocketDataProvider data_socket1(data_reads, NULL);
+ StaticSocketDataProvider data_socket1(data_reads, arraysize(data_reads),
+ NULL, 0);
mock_socket_factory_.AddSocketDataProvider(&ctrl_socket);
mock_socket_factory_.AddSocketDataProvider(&data_socket1);
FtpRequestInfo request_info = GetRequestInfo("ftp://host/file");
@@ -857,7 +859,8 @@ TEST_F(FtpNetworkTransactionTest, EvilRestartUser) {
MockWrite ctrl_writes[] = {
MockWrite("QUIT\r\n"),
};
- StaticSocketDataProvider ctrl_socket2(ctrl_reads, ctrl_writes);
+ StaticSocketDataProvider ctrl_socket2(ctrl_reads, arraysize(ctrl_reads),
+ ctrl_writes, arraysize(ctrl_writes));
mock_socket_factory_.AddSocketDataProvider(&ctrl_socket2);
ASSERT_EQ(ERR_IO_PENDING, transaction_.RestartWithAuth(L"foo\nownz0red",
L"innocent",
@@ -888,7 +891,8 @@ TEST_F(FtpNetworkTransactionTest, EvilRestartPassword) {
MockWrite("USER innocent\r\n"),
MockWrite("QUIT\r\n"),
};
- StaticSocketDataProvider ctrl_socket2(ctrl_reads, ctrl_writes);
+ StaticSocketDataProvider ctrl_socket2(ctrl_reads, arraysize(ctrl_reads),
+ ctrl_writes, arraysize(ctrl_writes));
mock_socket_factory_.AddSocketDataProvider(&ctrl_socket2);
ASSERT_EQ(ERR_IO_PENDING, transaction_.RestartWithAuth(L"innocent",
L"foo\nownz0red",