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