| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/system/ipc_support.h" | 5 #include "mojo/edk/system/ipc_support.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 std::unique_ptr<TestSlave> slave_; | 365 std::unique_ptr<TestSlave> slave_; |
| 366 scoped_refptr<MessagePipeDispatcher> slave_mp_; | 366 scoped_refptr<MessagePipeDispatcher> slave_mp_; |
| 367 | 367 |
| 368 MOJO_DISALLOW_COPY_AND_ASSIGN(TestSlaveSetup); | 368 MOJO_DISALLOW_COPY_AND_ASSIGN(TestSlaveSetup); |
| 369 }; | 369 }; |
| 370 | 370 |
| 371 class IPCSupportTest : public testing::Test { | 371 class IPCSupportTest : public testing::Test { |
| 372 public: | 372 public: |
| 373 // Note: Run master process delegate methods on the I/O thread. | 373 // Note: Run master process delegate methods on the I/O thread. |
| 374 IPCSupportTest() | 374 IPCSupportTest() |
| 375 : test_io_thread_(TestIOThread::kAutoStart), | 375 : test_io_thread_(TestIOThread::StartMode::AUTO), |
| 376 master_ipc_support_(&platform_support_, | 376 master_ipc_support_(&platform_support_, |
| 377 embedder::ProcessType::MASTER, | 377 embedder::ProcessType::MASTER, |
| 378 test_io_thread_.task_runner(), | 378 test_io_thread_.task_runner(), |
| 379 &master_process_delegate_, | 379 &master_process_delegate_, |
| 380 test_io_thread_.task_runner(), | 380 test_io_thread_.task_runner(), |
| 381 embedder::ScopedPlatformHandle()) {} | 381 embedder::ScopedPlatformHandle()) {} |
| 382 ~IPCSupportTest() override {} | 382 ~IPCSupportTest() override {} |
| 383 | 383 |
| 384 std::unique_ptr<TestSlaveSetup> SetupSlave() { | 384 std::unique_ptr<TestSlaveSetup> SetupSlave() { |
| 385 std::unique_ptr<TestSlaveSetup> s( | 385 std::unique_ptr<TestSlaveSetup> s( |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 | 679 |
| 680 ShutdownMasterIPCSupport(); | 680 ShutdownMasterIPCSupport(); |
| 681 } | 681 } |
| 682 | 682 |
| 683 MOJO_MULTIPROCESS_TEST_CHILD_TEST(MultiprocessMasterSlaveInternal) { | 683 MOJO_MULTIPROCESS_TEST_CHILD_TEST(MultiprocessMasterSlaveInternal) { |
| 684 embedder::ScopedPlatformHandle client_platform_handle = | 684 embedder::ScopedPlatformHandle client_platform_handle = |
| 685 mojo::test::MultiprocessTestHelper::client_platform_handle.Pass(); | 685 mojo::test::MultiprocessTestHelper::client_platform_handle.Pass(); |
| 686 ASSERT_TRUE(client_platform_handle.is_valid()); | 686 ASSERT_TRUE(client_platform_handle.is_valid()); |
| 687 | 687 |
| 688 embedder::SimplePlatformSupport platform_support; | 688 embedder::SimplePlatformSupport platform_support; |
| 689 TestIOThread test_io_thread(TestIOThread::kAutoStart); | 689 TestIOThread test_io_thread(TestIOThread::StartMode::AUTO); |
| 690 TestSlaveProcessDelegate slave_process_delegate; | 690 TestSlaveProcessDelegate slave_process_delegate; |
| 691 // Note: Run process delegate methods on the I/O thread. | 691 // Note: Run process delegate methods on the I/O thread. |
| 692 IPCSupport ipc_support(&platform_support, embedder::ProcessType::SLAVE, | 692 IPCSupport ipc_support(&platform_support, embedder::ProcessType::SLAVE, |
| 693 test_io_thread.task_runner(), &slave_process_delegate, | 693 test_io_thread.task_runner(), &slave_process_delegate, |
| 694 test_io_thread.task_runner(), | 694 test_io_thread.task_runner(), |
| 695 client_platform_handle.Pass()); | 695 client_platform_handle.Pass()); |
| 696 | 696 |
| 697 const base::CommandLine& command_line = | 697 const base::CommandLine& command_line = |
| 698 *base::CommandLine::ForCurrentProcess(); | 698 *base::CommandLine::ForCurrentProcess(); |
| 699 ASSERT_TRUE(command_line.HasSwitch(kConnectionIdFlag)); | 699 ASSERT_TRUE(command_line.HasSwitch(kConnectionIdFlag)); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 722 test_io_thread.PostTaskAndWait(FROM_HERE, | 722 test_io_thread.PostTaskAndWait(FROM_HERE, |
| 723 base::Bind(&IPCSupport::ShutdownOnIOThread, | 723 base::Bind(&IPCSupport::ShutdownOnIOThread, |
| 724 base::Unretained(&ipc_support))); | 724 base::Unretained(&ipc_support))); |
| 725 } | 725 } |
| 726 | 726 |
| 727 // TODO(vtl): Also test the case of the master "dying" before the slave. (The | 727 // TODO(vtl): Also test the case of the master "dying" before the slave. (The |
| 728 // slave should get OnMasterDisconnect(), which we currently don't test.) | 728 // slave should get OnMasterDisconnect(), which we currently don't test.) |
| 729 | 729 |
| 730 } // namespace system | 730 } // namespace system |
| 731 } // namespace mojo | 731 } // namespace mojo |
| OLD | NEW |