| 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 "third_party/mojo/src/mojo/edk/embedder/embedder.h" | 5 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 EmbedderTest() : test_io_thread_(base::TestIOThread::kAutoStart) {} | 129 EmbedderTest() : test_io_thread_(base::TestIOThread::kAutoStart) {} |
| 130 ~EmbedderTest() override {} | 130 ~EmbedderTest() override {} |
| 131 | 131 |
| 132 protected: | 132 protected: |
| 133 base::TestIOThread& test_io_thread() { return test_io_thread_; } | 133 base::TestIOThread& test_io_thread() { return test_io_thread_; } |
| 134 scoped_refptr<base::TaskRunner> test_io_task_runner() { | 134 scoped_refptr<base::TaskRunner> test_io_task_runner() { |
| 135 return test_io_thread_.task_runner(); | 135 return test_io_thread_.task_runner(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 private: | 138 private: |
| 139 void SetUp() override { test::InitWithSimplePlatformSupport(); } | 139 void SetUp() override { Init(); } |
| 140 | 140 |
| 141 void TearDown() override { EXPECT_TRUE(test::Shutdown()); } | 141 void TearDown() override { EXPECT_TRUE(test::Shutdown()); } |
| 142 | 142 |
| 143 base::TestIOThread test_io_thread_; | 143 base::TestIOThread test_io_thread_; |
| 144 | 144 |
| 145 MOJO_DISALLOW_COPY_AND_ASSIGN(EmbedderTest); | 145 MOJO_DISALLOW_COPY_AND_ASSIGN(EmbedderTest); |
| 146 }; | 146 }; |
| 147 | 147 |
| 148 TEST_F(EmbedderTest, ChannelsBasic) { | 148 TEST_F(EmbedderTest, ChannelsBasic) { |
| 149 mojo::test::ScopedIPCSupport ipc_support(test_io_task_runner()); | 149 mojo::test::ScopedIPCSupport ipc_support(test_io_task_runner()); |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 MojoClose(passing_handle); | 492 MojoClose(passing_handle); |
| 493 } | 493 } |
| 494 } | 494 } |
| 495 | 495 |
| 496 MOJO_MULTIPROCESS_TEST_CHILD_TEST(MultiprocessMasterSlave) { | 496 MOJO_MULTIPROCESS_TEST_CHILD_TEST(MultiprocessMasterSlave) { |
| 497 ScopedPlatformHandle client_platform_handle = | 497 ScopedPlatformHandle client_platform_handle = |
| 498 mojo::test::MultiprocessTestHelper::client_platform_handle.Pass(); | 498 mojo::test::MultiprocessTestHelper::client_platform_handle.Pass(); |
| 499 EXPECT_TRUE(client_platform_handle.is_valid()); | 499 EXPECT_TRUE(client_platform_handle.is_valid()); |
| 500 | 500 |
| 501 base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart); | 501 base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart); |
| 502 test::InitWithSimplePlatformSupport(); | 502 Init(); |
| 503 | 503 |
| 504 { | 504 { |
| 505 mojo::test::ScopedSlaveIPCSupport ipc_support( | 505 mojo::test::ScopedSlaveIPCSupport ipc_support( |
| 506 test_io_thread.task_runner(), client_platform_handle.Pass()); | 506 test_io_thread.task_runner(), client_platform_handle.Pass()); |
| 507 | 507 |
| 508 const base::CommandLine& command_line = | 508 const base::CommandLine& command_line = |
| 509 *base::CommandLine::ForCurrentProcess(); | 509 *base::CommandLine::ForCurrentProcess(); |
| 510 ASSERT_TRUE(command_line.HasSwitch(kConnectionIdFlag)); | 510 ASSERT_TRUE(command_line.HasSwitch(kConnectionIdFlag)); |
| 511 std::string connection_id = | 511 std::string connection_id = |
| 512 command_line.GetSwitchValueASCII(kConnectionIdFlag); | 512 command_line.GetSwitchValueASCII(kConnectionIdFlag); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 | 687 |
| 688 EXPECT_TRUE(multiprocess_test_helper.WaitForChildTestShutdown()); | 688 EXPECT_TRUE(multiprocess_test_helper.WaitForChildTestShutdown()); |
| 689 } | 689 } |
| 690 | 690 |
| 691 MOJO_MULTIPROCESS_TEST_CHILD_TEST(MultiprocessChannelsClient) { | 691 MOJO_MULTIPROCESS_TEST_CHILD_TEST(MultiprocessChannelsClient) { |
| 692 ScopedPlatformHandle client_platform_handle = | 692 ScopedPlatformHandle client_platform_handle = |
| 693 mojo::test::MultiprocessTestHelper::client_platform_handle.Pass(); | 693 mojo::test::MultiprocessTestHelper::client_platform_handle.Pass(); |
| 694 EXPECT_TRUE(client_platform_handle.is_valid()); | 694 EXPECT_TRUE(client_platform_handle.is_valid()); |
| 695 | 695 |
| 696 base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart); | 696 base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart); |
| 697 test::InitWithSimplePlatformSupport(); | 697 Init(); |
| 698 | 698 |
| 699 { | 699 { |
| 700 // TODO(vtl): This should eventually initialize a slave process instead, | 700 // TODO(vtl): This should eventually initialize a slave process instead, |
| 701 // probably. | 701 // probably. |
| 702 mojo::test::ScopedIPCSupport ipc_support(test_io_thread.task_runner()); | 702 mojo::test::ScopedIPCSupport ipc_support(test_io_thread.task_runner()); |
| 703 | 703 |
| 704 ScopedTestChannel client_channel(client_platform_handle.Pass()); | 704 ScopedTestChannel client_channel(client_platform_handle.Pass()); |
| 705 MojoHandle client_mp = client_channel.bootstrap_message_pipe(); | 705 MojoHandle client_mp = client_channel.bootstrap_message_pipe(); |
| 706 EXPECT_NE(client_mp, MOJO_HANDLE_INVALID); | 706 EXPECT_NE(client_mp, MOJO_HANDLE_INVALID); |
| 707 client_channel.WaitForChannelCreationCompletion(); | 707 client_channel.WaitForChannelCreationCompletion(); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 | 806 |
| 807 EXPECT_TRUE(test::Shutdown()); | 807 EXPECT_TRUE(test::Shutdown()); |
| 808 } | 808 } |
| 809 | 809 |
| 810 // TODO(vtl): Test immediate write & close. | 810 // TODO(vtl): Test immediate write & close. |
| 811 // TODO(vtl): Test broken-connection cases. | 811 // TODO(vtl): Test broken-connection cases. |
| 812 | 812 |
| 813 } // namespace | 813 } // namespace |
| 814 } // namespace embedder | 814 } // namespace embedder |
| 815 } // namespace mojo | 815 } // namespace mojo |
| OLD | NEW |