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

Unified Diff: native_client_sdk/src/tests/nacl_io_socket_test/socket_test.cc

Issue 458563002: [NaCl SDK] Fix bug in TCPNode::Connect (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | « native_client_sdk/src/libraries/nacl_io/socket/tcp_node.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/tests/nacl_io_socket_test/socket_test.cc
diff --git a/native_client_sdk/src/tests/nacl_io_socket_test/socket_test.cc b/native_client_sdk/src/tests/nacl_io_socket_test/socket_test.cc
index 850fde92bc4c1623eca20a5045da82e1fcea615d..b9e2adcb114f47d6e2f003f7a5560abde857fb46 100644
--- a/native_client_sdk/src/tests/nacl_io_socket_test/socket_test.cc
+++ b/native_client_sdk/src/tests/nacl_io_socket_test/socket_test.cc
@@ -392,6 +392,16 @@ TEST_F(SocketTestWithServer, TCPConnectNonBlock) {
// And SO_ERROR should be 0.
}
+TEST_F(SocketTestTCP, TCPConnectFails) {
+ sockaddr_in addr;
+ socklen_t addrlen = sizeof(addr);
+
+ // 10 is an unassigned well-known port, nothing should be bound to it.
+ IP4ToSockAddr(LOCAL_HOST, 10, &addr);
+ ASSERT_EQ(-1, ki_connect(sock1_, (sockaddr*) &addr, addrlen));
+ ASSERT_EQ(ECONNREFUSED, errno);
+}
+
TEST_F(SocketTest, Getsockopt) {
sock1_ = ki_socket(AF_INET, SOCK_STREAM, 0);
EXPECT_GT(sock1_, -1);
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/socket/tcp_node.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698