OLD | NEW |
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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 | 577 |
578 free(inbuf); | 578 free(inbuf); |
579 free(outbuf); | 579 free(outbuf); |
580 } | 580 } |
581 | 581 |
582 TEST_F(SocketTestUDP, Listen) { | 582 TEST_F(SocketTestUDP, Listen) { |
583 EXPECT_EQ(-1, ki_listen(sock1_, 10)); | 583 EXPECT_EQ(-1, ki_listen(sock1_, 10)); |
584 EXPECT_EQ(errno, ENOTSUP); | 584 EXPECT_EQ(errno, ENOTSUP); |
585 } | 585 } |
586 | 586 |
587 // Temporarily disable the TCP Listen test on PNaCl; | 587 TEST_F(SocketTestTCP, Listen) { |
588 // TODO(sbc): Re-enable once we fix the issue: http://crbug/377084 | |
589 #ifdef __pnacl__ | |
590 #define MAYBE_Listen DISABLED_Listen | |
591 #else | |
592 #define MAYBE_Listen Listen | |
593 #endif | |
594 | |
595 TEST_F(SocketTestTCP, MAYBE_Listen) { | |
596 sockaddr_in addr; | 588 sockaddr_in addr; |
597 socklen_t addrlen = sizeof(addr); | 589 socklen_t addrlen = sizeof(addr); |
598 const char* client_greeting = "hello"; | 590 const char* client_greeting = "hello"; |
599 const char* server_reply = "reply"; | 591 const char* server_reply = "reply"; |
600 const int greeting_len = strlen(client_greeting); | 592 const int greeting_len = strlen(client_greeting); |
601 const int reply_len = strlen(server_reply); | 593 const int reply_len = strlen(server_reply); |
602 | 594 |
603 int server_sock = sock1_; | 595 int server_sock = sock1_; |
604 | 596 |
605 // Accept before listen should fail | 597 // Accept before listen should fail |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 while (remainder > 0) { | 806 while (remainder > 0) { |
815 int rtn = ki_recv(new_sock, buffer, remainder, 0); | 807 int rtn = ki_recv(new_sock, buffer, remainder, 0); |
816 ASSERT_GT(rtn, 0); | 808 ASSERT_GT(rtn, 0); |
817 remainder -= rtn; | 809 remainder -= rtn; |
818 } | 810 } |
819 | 811 |
820 ASSERT_EQ(0, ki_close(new_sock)); | 812 ASSERT_EQ(0, ki_close(new_sock)); |
821 } | 813 } |
822 | 814 |
823 #endif // PROVIDES_SOCKET_API | 815 #endif // PROVIDES_SOCKET_API |
OLD | NEW |