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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 &thread_buffer_); | 532 &thread_buffer_); |
533 return NULL; | 533 return NULL; |
534 } | 534 } |
535 | 535 |
536 protected: | 536 protected: |
537 Buffer thread_buffer_; | 537 Buffer thread_buffer_; |
538 }; | 538 }; |
539 | 539 |
540 } // namespace | 540 } // namespace |
541 | 541 |
542 TEST_F(UnixSocketMultithreadedTest, DISABLED_SendRecv) { | 542 TEST_F(UnixSocketMultithreadedTest, SendRecv) { |
543 pthread_t thread = CreateThread(); | 543 pthread_t thread = CreateThread(); |
544 | 544 |
545 uint8_t pattern[] = {0xA5, 0x00, 0xC3, 0xFF}; | 545 uint8_t pattern[] = {0xA5, 0x00, 0xC3, 0xFF}; |
546 size_t pattern_size = sizeof(pattern); | 546 size_t pattern_size = sizeof(pattern); |
547 Buffer main_read_buf; | 547 Buffer main_read_buf; |
548 | 548 |
549 ReadWriteSocket(sv_[0], pattern, pattern_size, kMainSendSize, &main_read_buf); | 549 ReadWriteSocket(sv_[0], pattern, pattern_size, kMainSendSize, &main_read_buf); |
550 | 550 |
551 pthread_join(thread, NULL); | 551 pthread_join(thread, NULL); |
552 | 552 |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 | 830 |
831 TEST(SocketUtilityFunctions, Ntohl) { | 831 TEST(SocketUtilityFunctions, Ntohl) { |
832 uint8_t network_bytes[4] = { 0x44, 0x33, 0x22, 0x11 }; | 832 uint8_t network_bytes[4] = { 0x44, 0x33, 0x22, 0x11 }; |
833 uint32_t network_long; | 833 uint32_t network_long; |
834 memcpy(&network_long, network_bytes, 4); | 834 memcpy(&network_long, network_bytes, 4); |
835 uint32_t host_long = ntohl(network_long); | 835 uint32_t host_long = ntohl(network_long); |
836 EXPECT_EQ(host_long, 0x44332211); | 836 EXPECT_EQ(host_long, 0x44332211); |
837 } | 837 } |
838 | 838 |
839 #endif // PROVIDES_SOCKETPAIR_API | 839 #endif // PROVIDES_SOCKETPAIR_API |
OLD | NEW |