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 <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 19 matching lines...) Expand all Loading... |
30 int rtn = ki_ioctl(fd, request, ap); | 30 int rtn = ki_ioctl(fd, request, ap); |
31 va_end(ap); | 31 va_end(ap); |
32 return rtn; | 32 return rtn; |
33 } | 33 } |
34 | 34 |
35 class TtyNodeTest : public ::testing::Test { | 35 class TtyNodeTest : public ::testing::Test { |
36 public: | 36 public: |
37 TtyNodeTest() : fs_(&ppapi_) {} | 37 TtyNodeTest() : fs_(&ppapi_) {} |
38 | 38 |
39 void SetUp() { | 39 void SetUp() { |
40 ASSERT_EQ(0, fs_.Access(Path("/tty"), R_OK | W_OK)); | |
41 ASSERT_EQ(EACCES, fs_.Access(Path("/tty"), X_OK)); | |
42 ASSERT_EQ(0, fs_.Open(Path("/tty"), O_RDWR, &dev_tty_)); | 40 ASSERT_EQ(0, fs_.Open(Path("/tty"), O_RDWR, &dev_tty_)); |
43 ASSERT_NE(NULL_NODE, dev_tty_.get()); | 41 ASSERT_NE(NULL_NODE, dev_tty_.get()); |
| 42 struct stat buf; |
| 43 ASSERT_EQ(0, dev_tty_->GetStat(&buf)); |
| 44 ASSERT_EQ(S_IRUSR | S_IWUSR, buf.st_mode & S_IRWXU); |
44 } | 45 } |
45 | 46 |
46 protected: | 47 protected: |
47 FakePepperInterface ppapi_; | 48 FakePepperInterface ppapi_; |
48 DevFsForTesting fs_; | 49 DevFsForTesting fs_; |
49 ScopedNode dev_tty_; | 50 ScopedNode dev_tty_; |
50 }; | 51 }; |
51 | 52 |
52 class TtyTest : public ::testing::Test { | 53 class TtyTest : public ::testing::Test { |
53 public: | 54 public: |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 timeout.tv_sec = 20; | 371 timeout.tv_sec = 20; |
371 timeout.tv_usec = 0; | 372 timeout.tv_usec = 0; |
372 | 373 |
373 int rtn = ki_select(tty_fd + 1, &readfds, NULL, &errorfds, &timeout); | 374 int rtn = ki_select(tty_fd + 1, &readfds, NULL, &errorfds, &timeout); |
374 pthread_join(resize_thread, NULL); | 375 pthread_join(resize_thread, NULL); |
375 | 376 |
376 ASSERT_EQ(1, rtn); | 377 ASSERT_EQ(1, rtn); |
377 } | 378 } |
378 | 379 |
379 } // namespace | 380 } // namespace |
OLD | NEW |