diff options
author | gavinp@chromium.org <gavinp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-10 14:13:34 +0000 |
---|---|---|
committer | gavinp@chromium.org <gavinp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-10 14:13:34 +0000 |
commit | 96e272bcde178a2abe0b8008149c467630148f18 (patch) | |
tree | 1f4f8683341507dae46b023f43ef347f2a2b6394 /net/socket/socket_test_util.h | |
parent | 04e3f3559dac2a7a5178e8f0d935d69970e2a33c (diff) | |
download | chromium_src-96e272bcde178a2abe0b8008149c467630148f18.zip chromium_src-96e272bcde178a2abe0b8008149c467630148f18.tar.gz chromium_src-96e272bcde178a2abe0b8008149c467630148f18.tar.bz2 |
Pass nulls through test sockets.
Fixing 35050, one of the tests I wrote for EPSV required NULS go through the
testing framework. That created issue 42432 which covers permitting NULs through
our socket tests. I added an interface to SimulateRead which passes in an explicit
length, and moved as much of that into ftp_network_transaction_unittest as possible.
BUG=42432
TEST=see the modified Epsv test in ftp_network_transaction_unittest.cc
Review URL: http://codereview.chromium.org/1949003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46813 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/socket_test_util.h')
-rw-r--r-- | net/socket/socket_test_util.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/net/socket/socket_test_util.h b/net/socket/socket_test_util.h index f50cf7d..6e0698f 100644 --- a/net/socket/socket_test_util.h +++ b/net/socket/socket_test_util.h @@ -5,6 +5,7 @@ #ifndef NET_SOCKET_SOCKET_TEST_UTIL_H_ #define NET_SOCKET_SOCKET_TEST_UTIL_H_ +#include <cstring> #include <deque> #include <string> #include <vector> @@ -211,7 +212,10 @@ class DynamicSocketDataProvider : public SocketDataProvider { protected: // The next time there is a read from this socket, it will return |data|. // Before calling SimulateRead next time, the previous data must be consumed. - void SimulateRead(const char* data); + void SimulateRead(const char* data, size_t length); + void SimulateRead(const char* data) { + SimulateRead(data, std::strlen(data)); + } private: std::deque<MockRead> reads_; |