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 "mojo/edk/embedder/embedder.h" | 5 #include "mojo/edk/embedder/embedder.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string.h> | 9 #include <string.h> |
10 | 10 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // 6. (close) | 191 // 6. (close) |
192 // 7. "baz" | 192 // 7. "baz" |
193 // 8. (closed) | 193 // 8. (closed) |
194 // 9. "quux"+mp2 | 194 // 9. "quux"+mp2 |
195 // 10. (close) | 195 // 10. (close) |
196 // 11. (wait/cl.) | 196 // 11. (wait/cl.) |
197 // 12. (wait/cl.) | 197 // 12. (wait/cl.) |
198 | 198 |
199 #if !defined(OS_IOS) | 199 #if !defined(OS_IOS) |
200 | 200 |
201 #if defined(OS_ANDROID) | 201 TEST_F(EmbedderTest, MultiprocessChannels) { |
202 // Android multi-process tests are not executing the new process. This is flaky. | |
203 #define MAYBE_MultiprocessChannels DISABLED_MultiprocessChannels | |
204 #else | |
205 #define MAYBE_MultiprocessChannels MultiprocessChannels | |
206 #endif // defined(OS_ANDROID) | |
207 TEST_F(EmbedderTest, MAYBE_MultiprocessChannels) { | |
208 RUN_CHILD_ON_PIPE(MultiprocessChannelsClient, server_mp) | 202 RUN_CHILD_ON_PIPE(MultiprocessChannelsClient, server_mp) |
209 // 1. Write a message to |server_mp| (attaching nothing). | 203 // 1. Write a message to |server_mp| (attaching nothing). |
210 WriteMessage(server_mp, "hello"); | 204 WriteMessage(server_mp, "hello"); |
211 | 205 |
212 // 2. Read a message from |server_mp|. | 206 // 2. Read a message from |server_mp|. |
213 EXPECT_EQ("world!", ReadMessage(server_mp)); | 207 EXPECT_EQ("world!", ReadMessage(server_mp)); |
214 | 208 |
215 // 3. Create a new message pipe (endpoints |mp0| and |mp1|). | 209 // 3. Create a new message pipe (endpoints |mp0| and |mp1|). |
216 MojoHandle mp0, mp1; | 210 MojoHandle mp0, mp1; |
217 CreateMessagePipe(&mp0, &mp1); | 211 CreateMessagePipe(&mp0, &mp1); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 // 10. Wait on |mp1| (which should eventually fail) and then close it. | 277 // 10. Wait on |mp1| (which should eventually fail) and then close it. |
284 MojoHandleSignalsState state; | 278 MojoHandleSignalsState state; |
285 ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION, | 279 ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION, |
286 MojoWait(mp1, MOJO_HANDLE_SIGNAL_READABLE, | 280 MojoWait(mp1, MOJO_HANDLE_SIGNAL_READABLE, |
287 MOJO_DEADLINE_INDEFINITE, &state)); | 281 MOJO_DEADLINE_INDEFINITE, &state)); |
288 ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, state.satisfied_signals); | 282 ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, state.satisfied_signals); |
289 ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, state.satisfiable_signals); | 283 ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, state.satisfiable_signals); |
290 ASSERT_EQ(MOJO_RESULT_OK, MojoClose(mp1)); | 284 ASSERT_EQ(MOJO_RESULT_OK, MojoClose(mp1)); |
291 } | 285 } |
292 | 286 |
293 #if defined(OS_ANDROID) | 287 TEST_F(EmbedderTest, MultiprocessBaseSharedMemory) { |
294 // Android multi-process tests are not executing the new process. This is flaky. | |
295 #define MAYBE_MultiprocessBaseSharedMemory DISABLED_MultiprocessBaseSharedMemory | |
296 #else | |
297 #define MAYBE_MultiprocessBaseSharedMemory MultiprocessBaseSharedMemory | |
298 #endif // defined(OS_ANDROID) | |
299 TEST_F(EmbedderTest, MAYBE_MultiprocessBaseSharedMemory) { | |
300 RUN_CHILD_ON_PIPE(MultiprocessSharedMemoryClient, server_mp) | 288 RUN_CHILD_ON_PIPE(MultiprocessSharedMemoryClient, server_mp) |
301 // 1. Create a base::SharedMemory object and create a mojo shared buffer | 289 // 1. Create a base::SharedMemory object and create a mojo shared buffer |
302 // from it. | 290 // from it. |
303 base::SharedMemoryCreateOptions options; | 291 base::SharedMemoryCreateOptions options; |
304 options.size = 123; | 292 options.size = 123; |
305 base::SharedMemory shared_memory; | 293 base::SharedMemory shared_memory; |
306 ASSERT_TRUE(shared_memory.Create(options)); | 294 ASSERT_TRUE(shared_memory.Create(options)); |
307 base::SharedMemoryHandle shm_handle = base::SharedMemory::DuplicateHandle( | 295 base::SharedMemoryHandle shm_handle = base::SharedMemory::DuplicateHandle( |
308 shared_memory.handle()); | 296 shared_memory.handle()); |
309 MojoHandle sb1; | 297 MojoHandle sb1; |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 500 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
513 | 501 |
514 // TODO(vtl): Test immediate write & close. | 502 // TODO(vtl): Test immediate write & close. |
515 // TODO(vtl): Test broken-connection cases. | 503 // TODO(vtl): Test broken-connection cases. |
516 | 504 |
517 #endif // !defined(OS_IOS) | 505 #endif // !defined(OS_IOS) |
518 | 506 |
519 } // namespace | 507 } // namespace |
520 } // namespace edk | 508 } // namespace edk |
521 } // namespace mojo | 509 } // namespace mojo |
OLD | NEW |