diff options
author | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-12 02:02:40 +0000 |
---|---|---|
committer | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-12 02:02:40 +0000 |
commit | fe89ea7e351d304ca379125329018f5b96a2aded (patch) | |
tree | f4a0a43fc9e626d3a8e015a363ebbab635154e4e /net/socket/tcp_server_socket_unittest.cc | |
parent | 1870d5cfa5ca359b44a32322c225cca1b2818e91 (diff) | |
download | chromium_src-fe89ea7e351d304ca379125329018f5b96a2aded.zip chromium_src-fe89ea7e351d304ca379125329018f5b96a2aded.tar.gz chromium_src-fe89ea7e351d304ca379125329018f5b96a2aded.tar.bz2 |
Miscelaneous cleanups to AddressList to make it harder to mis-use.
- Removed all destructive non-const member functions -- these were dangerous since if you called them without first making a copy of the AddressList, it could mutate earlier copies.
- Made AddressList::Data::head const, so new code added to AddressList cannot inadvertently introduce such dangerous mutations (won't compile).
- Moved the non-trivial constructors and assign methods into factory methods (for added readability)
- Removed the bool parameter from Copy (for added readability).
Review URL: http://codereview.chromium.org/6880302
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85090 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/tcp_server_socket_unittest.cc')
-rw-r--r-- | net/socket/tcp_server_socket_unittest.cc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/net/socket/tcp_server_socket_unittest.cc b/net/socket/tcp_server_socket_unittest.cc index 45297fe..d4abe9d 100644 --- a/net/socket/tcp_server_socket_unittest.cc +++ b/net/socket/tcp_server_socket_unittest.cc @@ -50,14 +50,18 @@ class TCPServerSocketTest : public PlatformTest { return endpoint; } + AddressList local_address_list() const { + return AddressList::CreateFromIPAddress( + local_address_.address(), local_address_.port()); + } + TCPServerSocket socket_; IPEndPoint local_address_; }; TEST_F(TCPServerSocketTest, Accept) { TestCompletionCallback connect_callback; - TCPClientSocket connecting_socket(AddressList(local_address_.address(), - local_address_.port(), false), + TCPClientSocket connecting_socket(local_address_list(), NULL, NetLog::Source()); connecting_socket.Connect(&connect_callback); @@ -85,8 +89,7 @@ TEST_F(TCPServerSocketTest, AcceptAsync) { ASSERT_EQ(ERR_IO_PENDING, socket_.Accept(&accepted_socket, &accept_callback)); TestCompletionCallback connect_callback; - TCPClientSocket connecting_socket(AddressList(local_address_.address(), - local_address_.port(), false), + TCPClientSocket connecting_socket(local_address_list(), NULL, NetLog::Source()); connecting_socket.Connect(&connect_callback); @@ -109,14 +112,12 @@ TEST_F(TCPServerSocketTest, Accept2Connections) { socket_.Accept(&accepted_socket, &accept_callback)); TestCompletionCallback connect_callback; - TCPClientSocket connecting_socket(AddressList(local_address_.address(), - local_address_.port(), false), + TCPClientSocket connecting_socket(local_address_list(), NULL, NetLog::Source()); connecting_socket.Connect(&connect_callback); TestCompletionCallback connect_callback2; - TCPClientSocket connecting_socket2(AddressList(local_address_.address(), - local_address_.port(), false), + TCPClientSocket connecting_socket2(local_address_list(), NULL, NetLog::Source()); connecting_socket2.Connect(&connect_callback2); |