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

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

Issue 304373008: Add support for modifying TCP and UDP socket buffer size in nacl_io (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added unit tests Created 6 years, 7 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/udp_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 5dfe0046fc166424f76b5f33e2af73f37ba95f5a..267ee5bf598030449ccbcf82124bd723bb63d657 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
@@ -511,6 +511,28 @@ TEST_F(SocketTest, Sockopt_REUSEADDR) {
ASSERT_EQ(sizeof(int), len);
}
+TEST_F(SocketTest, Sockopt_BUFSIZE) {
+ int option = 1024*1024;
+ socklen_t len = sizeof(option);
+
+ sock1_ = ki_socket(AF_INET, SOCK_DGRAM, 0);
+ ASSERT_GT(sock1_, -1);
+ ASSERT_EQ(0, Bind(sock1_, LOCAL_HOST, PORT1));
+ ASSERT_EQ(0, ki_setsockopt(sock1_, SOL_SOCKET, SO_RCVBUF, &option, len))
+ << "failed with: " << strerror(errno);
+ ASSERT_EQ(0, ki_setsockopt(sock1_, SOL_SOCKET, SO_SNDBUF, &option, len))
+ << "failed with: " << strerror(errno);
+
+ sock2_ = socket(AF_INET, SOCK_STREAM, 0);
CodeByThePound 2014/06/02 19:38:18 I think you meant to call ki_socket here, instead
+ ASSERT_GT(sock2_, -1);
+ ASSERT_EQ(0, Bind(sock2_, LOCAL_HOST, PORT2));
+
+ ASSERT_EQ(0, ki_setsockopt(sock2_, SOL_SOCKET, SO_RCVBUF, &option, len))
+ << "failed with: " << strerror(errno);
+ ASSERT_EQ(0, ki_setsockopt(sock2_, SOL_SOCKET, SO_SNDBUF, &option, len))
+ << "failed with: " << strerror(errno);
+}
+
// The size of the data to send is deliberately chosen to be
// larger than the TCP buffer in nacl_io.
// TODO(sbc): use ioctl to discover the actual buffer size at
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/socket/udp_node.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698