OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <errno.h> | 5 #include <errno.h> |
6 #include <fcntl.h> | 6 #include <fcntl.h> |
7 #include <string.h> | 7 #include <string.h> |
8 #include <sys/ioctl.h> | 8 #include <sys/ioctl.h> |
9 #include <sys/select.h> | 9 #include <sys/select.h> |
10 #include <sys/stat.h> | 10 #include <sys/stat.h> |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 return -3; // error | 427 return -3; // error |
428 return 1; // readable | 428 return 1; // readable |
429 } | 429 } |
430 | 430 |
431 TEST_F(JSPipeTest, JSPipeSelect) { | 431 TEST_F(JSPipeTest, JSPipeSelect) { |
432 struct timeval timeout; | 432 struct timeval timeout; |
433 fd_set readfds; | 433 fd_set readfds; |
434 fd_set writefds; | 434 fd_set writefds; |
435 fd_set errorfds; | 435 fd_set errorfds; |
436 | 436 |
437 int pipe_fd = ki_open("/dev/jspipe1", O_RDONLY); | 437 int pipe_fd = ki_open("/dev/jspipe1", O_RDONLY, 0); |
438 ASSERT_GT(pipe_fd, 0) << "jspipe1 open failed: " << errno; | 438 ASSERT_GT(pipe_fd, 0) << "jspipe1 open failed: " << errno; |
439 | 439 |
440 FD_ZERO(&readfds); | 440 FD_ZERO(&readfds); |
441 FD_ZERO(&errorfds); | 441 FD_ZERO(&errorfds); |
442 FD_SET(pipe_fd, &readfds); | 442 FD_SET(pipe_fd, &readfds); |
443 FD_SET(pipe_fd, &errorfds); | 443 FD_SET(pipe_fd, &errorfds); |
444 // 10 millisecond timeout | 444 // 10 millisecond timeout |
445 timeout.tv_sec = 0; | 445 timeout.tv_sec = 0; |
446 timeout.tv_usec = 10 * 1000; | 446 timeout.tv_usec = 10 * 1000; |
447 // Should timeout when no input is available. | 447 // Should timeout when no input is available. |
(...skipping 20 matching lines...) Expand all Loading... |
468 ASSERT_EQ(0, ki_ioctl_wrapper(pipe_fd, NACL_IOC_HANDLEMESSAGE, &message)); | 468 ASSERT_EQ(0, ki_ioctl_wrapper(pipe_fd, NACL_IOC_HANDLEMESSAGE, &message)); |
469 ppapi_.GetVarInterface()->Release(message); | 469 ppapi_.GetVarInterface()->Release(message); |
470 | 470 |
471 // Pipe should now be readable | 471 // Pipe should now be readable |
472 ASSERT_EQ(1, IsReadable(pipe_fd)); | 472 ASSERT_EQ(1, IsReadable(pipe_fd)); |
473 | 473 |
474 ki_close(pipe_fd); | 474 ki_close(pipe_fd); |
475 } | 475 } |
476 | 476 |
477 } | 477 } |
OLD | NEW |