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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 FakePepperInterface ppapi_; | 115 FakePepperInterface ppapi_; |
116 KernelProxy kp_; | 116 KernelProxy kp_; |
117 }; | 117 }; |
118 | 118 |
119 class JSPipeNodeTest : public ::testing::Test { | 119 class JSPipeNodeTest : public ::testing::Test { |
120 public: | 120 public: |
121 JSPipeNodeTest() : fs_(&ppapi_) {} | 121 JSPipeNodeTest() : fs_(&ppapi_) {} |
122 | 122 |
123 void SetUp() { | 123 void SetUp() { |
124 name_ = "jspipe1"; | 124 name_ = "jspipe1"; |
125 ASSERT_EQ(0, fs_.Access(Path("/jspipe1"), R_OK | W_OK)); | |
126 ASSERT_EQ(EACCES, fs_.Access(Path("/jspipe1"), X_OK)); | |
127 ASSERT_EQ(0, fs_.Open(Path("/jspipe1"), O_RDWR, &pipe_dev_)); | 125 ASSERT_EQ(0, fs_.Open(Path("/jspipe1"), O_RDWR, &pipe_dev_)); |
128 ASSERT_NE(NULL_NODE, pipe_dev_.get()); | 126 ASSERT_NE(NULL_NODE, pipe_dev_.get()); |
| 127 struct stat buf; |
| 128 ASSERT_EQ(0, pipe_dev_->GetStat(&buf)); |
| 129 ASSERT_EQ(S_IRUSR | S_IWUSR, buf.st_mode & S_IRWXU); |
129 } | 130 } |
130 | 131 |
131 /** | 132 /** |
132 * Create a PP_Var message in the same way that we expect | 133 * Create a PP_Var message in the same way that we expect |
133 * JavaScript code to, and send it to the pipe using ioctl() | 134 * JavaScript code to, and send it to the pipe using ioctl() |
134 */ | 135 */ |
135 int JSPipeInject(const char* string, int length=-1) { | 136 int JSPipeInject(const char* string, int length=-1) { |
136 PP_Var message = CreateWriteMessage(&ppapi_, name_, string, length); | 137 PP_Var message = CreateWriteMessage(&ppapi_, name_, string, length); |
137 | 138 |
138 // Send the message via ioctl | 139 // Send the message via ioctl |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 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)); |
468 ppapi_.GetVarInterface()->Release(message); | 469 ppapi_.GetVarInterface()->Release(message); |
469 | 470 |
470 // Pipe should now be readable | 471 // Pipe should now be readable |
471 ASSERT_EQ(1, IsReadable(pipe_fd)); | 472 ASSERT_EQ(1, IsReadable(pipe_fd)); |
472 | 473 |
473 ki_close(pipe_fd); | 474 ki_close(pipe_fd); |
474 } | 475 } |
475 | 476 |
476 } | 477 } |
OLD | NEW |