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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 148 |
149 // Send the message via ioctl | 149 // Send the message via ioctl |
150 int rtn = pipe_dev_->Ioctl(NACL_IOC_HANDLEMESSAGE, &message); | 150 int rtn = pipe_dev_->Ioctl(NACL_IOC_HANDLEMESSAGE, &message); |
151 | 151 |
152 // Release message | 152 // Release message |
153 ppapi_.GetVarInterface()->Release(message); | 153 ppapi_.GetVarInterface()->Release(message); |
154 return rtn; | 154 return rtn; |
155 } | 155 } |
156 | 156 |
157 // Verify the contents of the jspipe mesage, which should be | 157 // Verify the contents of the jspipe mesage, which should be |
158 // {'<pipe_name>' : ['<command_name>', payload] } | 158 // { |
| 159 // "pipe": '<pipe_name>', |
| 160 // "operation": '<command_name>', |
| 161 // "payload": payload |
| 162 // } |
159 void VerifyPipeMessage(PP_Var message, | 163 void VerifyPipeMessage(PP_Var message, |
160 const char* pipe_name, | 164 const char* pipe_name, |
161 const char* operation, | 165 const char* operation, |
162 const char* payload, | 166 const char* payload, |
163 int payload_length, | 167 int payload_length, |
164 int32_t int_payload=0) { | 168 int32_t int_payload=0) { |
165 VarArrayInterface* array_iface = ppapi_.GetVarArrayInterface(); | 169 VarArrayInterface* array_iface = ppapi_.GetVarArrayInterface(); |
166 VarDictionaryInterface* dict_iface = ppapi_.GetVarDictionaryInterface(); | 170 VarDictionaryInterface* dict_iface = ppapi_.GetVarDictionaryInterface(); |
167 VarInterface* var_iface = ppapi_.GetVarInterface(); | 171 VarInterface* var_iface = ppapi_.GetVarInterface(); |
168 VarArrayBufferInterface* buffer_iface = ppapi_.GetVarArrayBufferInterface(); | 172 VarArrayBufferInterface* buffer_iface = ppapi_.GetVarArrayBufferInterface(); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 ASSERT_EQ(0, ki_ioctl_wrapper(pipe_fd, NACL_IOC_HANDLEMESSAGE, &message)); | 467 ASSERT_EQ(0, ki_ioctl_wrapper(pipe_fd, NACL_IOC_HANDLEMESSAGE, &message)); |
464 ppapi_.GetVarInterface()->Release(message); | 468 ppapi_.GetVarInterface()->Release(message); |
465 | 469 |
466 // Pipe should now be readable | 470 // Pipe should now be readable |
467 ASSERT_EQ(1, IsReadable(pipe_fd)); | 471 ASSERT_EQ(1, IsReadable(pipe_fd)); |
468 | 472 |
469 ki_close(pipe_fd); | 473 ki_close(pipe_fd); |
470 } | 474 } |
471 | 475 |
472 } | 476 } |
OLD | NEW |