diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-20 18:50:38 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-20 18:50:38 +0000 |
commit | ac9eec64de86f3d3a290a1a8b9321260cff7ed23 (patch) | |
tree | aac041c6ddaec400b6e2b6d3d982935aa7f69a9c /net/socket/socket_test_util.cc | |
parent | 8c1ae5ec4d47638315096f54819793484383c91f (diff) | |
download | chromium_src-ac9eec64de86f3d3a290a1a8b9321260cff7ed23.zip chromium_src-ac9eec64de86f3d3a290a1a8b9321260cff7ed23.tar.gz chromium_src-ac9eec64de86f3d3a290a1a8b9321260cff7ed23.tar.bz2 |
Really connect to the same server in FTP network transaction.
Also create necessary infrastructure to know the address
a client socket is connected to.
TEST=Covered by net_unittests.
BUG=35670
Review URL: http://codereview.chromium.org/598071
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39559 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/socket_test_util.cc')
-rw-r--r-- | net/socket/socket_test_util.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/net/socket/socket_test_util.cc b/net/socket/socket_test_util.cc index 1ea1ec9..1634106 100644 --- a/net/socket/socket_test_util.cc +++ b/net/socket/socket_test_util.cc @@ -9,6 +9,8 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/message_loop.h" +#include "net/base/address_family.h" +#include "net/base/host_resolver_proc.h" #include "net/base/ssl_info.h" #include "net/socket/socket.h" #include "testing/gtest/include/gtest/gtest.h" @@ -47,9 +49,9 @@ bool MockClientSocket::IsConnectedAndIdle() const { return connected_; } -int MockClientSocket::GetPeerName(struct sockaddr* name, socklen_t* namelen) { - memset(reinterpret_cast<char *>(name), 0, *namelen); - return net::OK; +int MockClientSocket::GetPeerAddress(AddressList* address) const { + return net::SystemHostResolverProc("localhost", ADDRESS_FAMILY_UNSPECIFIED, + address); } void MockClientSocket::RunCallbackAsync(net::CompletionCallback* callback, @@ -370,12 +372,14 @@ void MockClientSocketFactory::ResetNextMockIndexes() { } MockTCPClientSocket* MockClientSocketFactory::GetMockTCPClientSocket( - int index) const { + size_t index) const { + DCHECK_LT(index, tcp_client_sockets_.size()); return tcp_client_sockets_[index]; } MockSSLClientSocket* MockClientSocketFactory::GetMockSSLClientSocket( - int index) const { + size_t index) const { + DCHECK_LT(index, ssl_client_sockets_.size()); return ssl_client_sockets_[index]; } |