OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/shared_memory.h" | 7 #include "base/shared_memory.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/test/multiprocess_test.h" | 9 #include "base/test/multiprocess_test.h" |
10 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 struct CrudeIpc { | 387 struct CrudeIpc { |
388 uint8 ready; | 388 uint8 ready; |
389 CrossProcessNotification::IPCHandle handle_1; | 389 CrossProcessNotification::IPCHandle handle_1; |
390 CrossProcessNotification::IPCHandle handle_2; | 390 CrossProcessNotification::IPCHandle handle_2; |
391 }; | 391 }; |
392 } // end namespace | 392 } // end namespace |
393 | 393 |
394 // The main routine of the child process. Waits for the parent process | 394 // The main routine of the child process. Waits for the parent process |
395 // to copy handles over to the child and then uses a CrossProcessNotification to | 395 // to copy handles over to the child and then uses a CrossProcessNotification to |
396 // wait and signal to the parent process. | 396 // wait and signal to the parent process. |
397 MULTIPROCESS_TEST_MAIN(CrossProcessNotificationChildMain) { | 397 MULTIPROCESS_TEST_MAIN(CrossProcessNotificationChildMain, NULL) { |
398 base::SharedMemory mem; | 398 base::SharedMemory mem; |
399 bool ok = mem.CreateNamed( | 399 bool ok = mem.CreateNamed( |
400 CrossProcessNotificationMultiProcessTest::kSharedMemName, | 400 CrossProcessNotificationMultiProcessTest::kSharedMemName, |
401 true, | 401 true, |
402 CrossProcessNotificationMultiProcessTest::kSharedMemSize); | 402 CrossProcessNotificationMultiProcessTest::kSharedMemSize); |
403 DCHECK(ok); | 403 DCHECK(ok); |
404 if (!ok) { | 404 if (!ok) { |
405 LOG(ERROR) << "Failed to open shared memory segment."; | 405 LOG(ERROR) << "Failed to open shared memory segment."; |
406 return -1; | 406 return -1; |
407 } | 407 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 | 456 |
457 ipc->ready = true; | 457 ipc->ready = true; |
458 | 458 |
459 a.Signal(); | 459 a.Signal(); |
460 a.Wait(); | 460 a.Wait(); |
461 | 461 |
462 int exit_code = -1; | 462 int exit_code = -1; |
463 base::WaitForExitCode(process, &exit_code); | 463 base::WaitForExitCode(process, &exit_code); |
464 EXPECT_EQ(0, exit_code); | 464 EXPECT_EQ(0, exit_code); |
465 } | 465 } |
OLD | NEW |