Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(780)

Unified Diff: net/socket/tcp_client_socket_unittest.cc

Issue 10803027: Fix TCPClientSocket::GetLocalAddress() to work when socket is not connected. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/socket/tcp_client_socket_libevent.cc ('k') | net/socket/tcp_client_socket_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/tcp_client_socket_unittest.cc
diff --git a/net/socket/tcp_client_socket_unittest.cc b/net/socket/tcp_client_socket_unittest.cc
index c2589b81923a0922c44fd38633249b17205f05cf..ce0c53559f862a50d0f5562c0759defa309a878f 100644
--- a/net/socket/tcp_client_socket_unittest.cc
+++ b/net/socket/tcp_client_socket_unittest.cc
@@ -34,6 +34,10 @@ TEST(TCPClientSocketTest, BindLoopbackToLoopback) {
EXPECT_EQ(OK, socket.Bind(IPEndPoint(lo_address, 0)));
+ IPEndPoint local_address_result;
+ EXPECT_EQ(OK, socket.GetLocalAddress(&local_address_result));
+ EXPECT_EQ(lo_address, local_address_result.address());
+
TestCompletionCallback connect_callback;
EXPECT_EQ(ERR_IO_PENDING, socket.Connect(connect_callback.callback()));
@@ -45,6 +49,12 @@ TEST(TCPClientSocketTest, BindLoopbackToLoopback) {
ASSERT_EQ(OK, result);
EXPECT_EQ(OK, connect_callback.WaitForResult());
+
+ EXPECT_TRUE(socket.IsConnected());
+ socket.Disconnect();
+ EXPECT_FALSE(socket.IsConnected());
+ EXPECT_EQ(ERR_SOCKET_NOT_CONNECTED,
+ socket.GetLocalAddress(&local_address_result));
}
// Try to bind socket to the loopback interface and connect to an
« no previous file with comments | « net/socket/tcp_client_socket_libevent.cc ('k') | net/socket/tcp_client_socket_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698