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

Side by Side Diff: native_client_sdk/src/tests/nacl_io_test/socket_test.cc

Issue 804993008: nacl_io: accept now allows addr and len to be NULL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove incorrect tests Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « native_client_sdk/src/tests/nacl_io_socket_test/socket_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <arpa/inet.h> 5 #include <arpa/inet.h>
6 #include <errno.h> 6 #include <errno.h>
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <netinet/in.h> 8 #include <netinet/in.h>
9 #include <pthread.h> 9 #include <pthread.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 protected: 43 protected:
44 KernelProxy kp_; 44 KernelProxy kp_;
45 }; 45 };
46 46
47 } // namespace 47 } // namespace
48 48
49 TEST_F(SocketTest, Accept) { 49 TEST_F(SocketTest, Accept) {
50 struct sockaddr addr = {}; 50 struct sockaddr addr = {};
51 socklen_t len = 0; 51 socklen_t len = 0;
52 52
53 EXPECT_LT(ki_accept(123, NULL, &len), 0); 53 // accept() should allow NULL args for addr and len
54 EXPECT_EQ(errno, EFAULT); 54 // https://code.google.com/p/chromium/issues/detail?id=442164
55 EXPECT_LT(ki_accept(123, &addr, NULL), 0); 55 // EXPECT_LT(ki_accept(123, NULL, &len), 0);
56 EXPECT_EQ(errno, EFAULT); 56 // EXPECT_EQ(errno, EFAULT);
57 EXPECT_LT(ki_accept(123, NULL, NULL), 0); 57 // EXPECT_LT(ki_accept(123, &addr, NULL), 0);
58 EXPECT_EQ(errno, EFAULT); 58 // EXPECT_EQ(errno, EFAULT);
59 // EXPECT_LT(ki_accept(123, NULL, NULL), 0);
60 // EXPECT_EQ(errno, EFAULT);
59 EXPECT_LT(ki_accept(-1, &addr, &len), 0); 61 EXPECT_LT(ki_accept(-1, &addr, &len), 0);
60 EXPECT_EQ(errno, EBADF); 62 EXPECT_EQ(errno, EBADF);
61 EXPECT_LT(ki_accept(0, &addr, &len), 0); 63 EXPECT_LT(ki_accept(0, &addr, &len), 0);
62 EXPECT_EQ(errno, ENOTSOCK); 64 EXPECT_EQ(errno, ENOTSOCK);
63 } 65 }
64 66
65 TEST_F(SocketTest, Bind) { 67 TEST_F(SocketTest, Bind) {
66 const struct sockaddr const_addr = {}; 68 const struct sockaddr const_addr = {};
67 socklen_t len = 0; 69 socklen_t len = 0;
68 70
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 530
529 TEST(SocketUtilityFunctions, Ntohl) { 531 TEST(SocketUtilityFunctions, Ntohl) {
530 uint8_t network_bytes[4] = { 0x44, 0x33, 0x22, 0x11 }; 532 uint8_t network_bytes[4] = { 0x44, 0x33, 0x22, 0x11 };
531 uint32_t network_long; 533 uint32_t network_long;
532 memcpy(&network_long, network_bytes, 4); 534 memcpy(&network_long, network_bytes, 4);
533 uint32_t host_long = ntohl(network_long); 535 uint32_t host_long = ntohl(network_long);
534 EXPECT_EQ(host_long, 0x44332211); 536 EXPECT_EQ(host_long, 0x44332211);
535 } 537 }
536 538
537 #endif // PROVIDES_SOCKETPAIR_API 539 #endif // PROVIDES_SOCKETPAIR_API
OLDNEW
« no previous file with comments | « native_client_sdk/src/tests/nacl_io_socket_test/socket_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698