diff options
author | yutak@chromium.org <yutak@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-27 19:02:01 +0000 |
---|---|---|
committer | yutak@chromium.org <yutak@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-27 19:02:01 +0000 |
commit | f871ee159f586c8593bcfb947a625b1056e6427d (patch) | |
tree | 7985067348bd28ce3ed530a1cbb473b80a7defde /jingle | |
parent | 36b967f39fcb6f6512f139a93825bb1d9251779c (diff) | |
download | chromium_src-f871ee159f586c8593bcfb947a625b1056e6427d.zip chromium_src-f871ee159f586c8593bcfb947a625b1056e6427d.tar.gz chromium_src-f871ee159f586c8593bcfb947a625b1056e6427d.tar.bz2 |
Give MockRead and MockWrite distinct types.
Currently, MockRead and MockWrite are defined as the same type by using
typedef. However, these types are different types and should not be used
interchangably.
This change gives MockRead and MockWrite distinct types by using templates
so the compiler can cause an error when these types are used interchangably.
Some misuses of MockRead and MockWrite were found, so these are fixed in this
change, too.
BUG=none
R=mmenke@chromium.org,akalin@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10796085
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148782 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'jingle')
-rw-r--r-- | jingle/glue/fake_ssl_client_socket_unittest.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/jingle/glue/fake_ssl_client_socket_unittest.cc b/jingle/glue/fake_ssl_client_socket_unittest.cc index a7ae4fa..97cb3bb 100644 --- a/jingle/glue/fake_ssl_client_socket_unittest.cc +++ b/jingle/glue/fake_ssl_client_socket_unittest.cc @@ -72,16 +72,15 @@ class MockClientSocket : public net::StreamSocket { // Break up |data| into a bunch of chunked MockReads/Writes and push // them onto |ops|. +template <net::MockReadWriteType type> void AddChunkedOps(base::StringPiece data, size_t chunk_size, net::IoMode mode, - std::vector<net::MockRead>* ops) { + std::vector<net::MockReadWrite<type> >* ops) { DCHECK_GT(chunk_size, 0U); size_t offset = 0; while (offset < data.size()) { size_t bounded_chunk_size = std::min(data.size() - offset, chunk_size); - // We take advantage of the fact that MockWrite is typedefed to - // MockRead. - ops->push_back(net::MockRead(mode, data.data() + offset, - bounded_chunk_size)); + ops->push_back(net::MockReadWrite<type>(mode, data.data() + offset, + bounded_chunk_size)); offset += bounded_chunk_size; } } |