| 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 "ipc/ipc_channel_mojo.h" | 5 #include "ipc/ipc_channel_mojo.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 #include "ipc/ipc_test_channel_listener.h" | 39 #include "ipc/ipc_test_channel_listener.h" |
| 40 #include "mojo/edk/test/mojo_test_base.h" | 40 #include "mojo/edk/test/mojo_test_base.h" |
| 41 #include "mojo/edk/test/multiprocess_test_helper.h" | 41 #include "mojo/edk/test/multiprocess_test_helper.h" |
| 42 #include "testing/gtest/include/gtest/gtest.h" | 42 #include "testing/gtest/include/gtest/gtest.h" |
| 43 | 43 |
| 44 #if defined(OS_POSIX) | 44 #if defined(OS_POSIX) |
| 45 #include "base/file_descriptor_posix.h" | 45 #include "base/file_descriptor_posix.h" |
| 46 #include "ipc/ipc_platform_file_attachment_posix.h" | 46 #include "ipc/ipc_platform_file_attachment_posix.h" |
| 47 #endif | 47 #endif |
| 48 | 48 |
| 49 #define DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(client_name, test_base) \ | 49 #define DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(client_name, test_base) \ |
| 50 class client_name##_MainFixture : public test_base { \ | 50 class client_name##_MainFixture : public test_base { \ |
| 51 public: \ | 51 public: \ |
| 52 void Main(); \ | 52 void Main(); \ |
| 53 }; \ | 53 }; \ |
| 54 MULTIPROCESS_TEST_MAIN_WITH_SETUP( \ | 54 MULTIPROCESS_TEST_MAIN_WITH_SETUP( \ |
| 55 client_name##TestChildMain, \ | 55 client_name##TestChildMain, \ |
| 56 ::mojo::edk::test::MultiprocessTestHelper::ChildSetup) { \ | 56 ::mojo::edk::test::MultiprocessTestHelper::ChildSetup) { \ |
| 57 CHECK(!mojo::edk::test::MultiprocessTestHelper::primordial_pipe_token \ | 57 client_name##_MainFixture test; \ |
| 58 .empty()); \ | 58 test.Init( \ |
| 59 client_name##_MainFixture test; \ | 59 std::move(mojo::edk::test::MultiprocessTestHelper::primordial_pipe)); \ |
| 60 test.Init(mojo::edk::CreateChildMessagePipe( \ | 60 test.Main(); \ |
| 61 mojo::edk::test::MultiprocessTestHelper::primordial_pipe_token)); \ | 61 return (::testing::Test::HasFatalFailure() || \ |
| 62 test.Main(); \ | 62 ::testing::Test::HasNonfatalFailure()) \ |
| 63 return (::testing::Test::HasFatalFailure() || \ | 63 ? 1 \ |
| 64 ::testing::Test::HasNonfatalFailure()) \ | 64 : 0; \ |
| 65 ? 1 \ | 65 } \ |
| 66 : 0; \ | |
| 67 } \ | |
| 68 void client_name##_MainFixture::Main() | 66 void client_name##_MainFixture::Main() |
| 69 | 67 |
| 70 namespace { | 68 namespace { |
| 71 | 69 |
| 72 void SendString(IPC::Sender* sender, const std::string& str) { | 70 void SendString(IPC::Sender* sender, const std::string& str) { |
| 73 IPC::Message* message = new IPC::Message(0, 2, IPC::Message::PRIORITY_NORMAL); | 71 IPC::Message* message = new IPC::Message(0, 2, IPC::Message::PRIORITY_NORMAL); |
| 74 message->WriteString(str); | 72 message->WriteString(str); |
| 75 ASSERT_TRUE(sender->Send(message)); | 73 ASSERT_TRUE(sender->Send(message)); |
| 76 } | 74 } |
| 77 | 75 |
| (...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1316 Connect(&listener); | 1314 Connect(&listener); |
| 1317 | 1315 |
| 1318 base::MessageLoop::current()->Run(); | 1316 base::MessageLoop::current()->Run(); |
| 1319 | 1317 |
| 1320 Close(); | 1318 Close(); |
| 1321 } | 1319 } |
| 1322 | 1320 |
| 1323 #endif // OS_LINUX | 1321 #endif // OS_LINUX |
| 1324 | 1322 |
| 1325 } // namespace | 1323 } // namespace |
| OLD | NEW |