Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(748)

Side by Side Diff: native_client_sdk/src/tests/nacl_io_test/jspipe_test.cc

Issue 547053002: [NaCl SDK] nacl_io: Remove Node::Access method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@http_fs_root
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698