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

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

Issue 657933002: [NaCl SDK] nacl_io: getsockname() should return non-zero port after bind. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 b9e2adcb114f47d6e2f003f7a5560abde857fb46..6f4dbe8fcfbff96d9e7b8d82ecdd9bf61912d7ae 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
@@ -679,6 +679,16 @@ TEST_F(SocketTestTCP, Listen) {
ASSERT_EQ(0, ki_close(new_socket));
}
+TEST_F(SocketTestTCP, BindAndGetSockName) {
+ sockaddr_in addr;
+ socklen_t addrlen = sizeof(addr);
+
+ // Bind
+ ASSERT_EQ(0, Bind(sock1_, LOCAL_HOST, 0));
+ EXPECT_EQ(0, ki_getsockname(sock1_, (struct sockaddr*)&addr, &addrlen));
+ EXPECT_NE(0, addr.sin_port);
+}
+
TEST_F(SocketTestTCP, ListenNonBlocking) {
int server_sock = sock1_;
« 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