| Index: mojo/edk/system/message_pipe_perftest.cc
|
| diff --git a/mojo/edk/system/message_pipe_perftest.cc b/mojo/edk/system/message_pipe_perftest.cc
|
| index c0a8fcef5c61a7137e8fc0bc6e70b37756049f8d..569ee1f21272e0951777fb106639164df2f61e67 100644
|
| --- a/mojo/edk/system/message_pipe_perftest.cc
|
| +++ b/mojo/edk/system/message_pipe_perftest.cc
|
| @@ -14,8 +14,8 @@
|
| #include "mojo/edk/embedder/embedder.h"
|
| #include "mojo/edk/embedder/scoped_platform_handle.h"
|
| #include "mojo/edk/system/handle_signals_state.h"
|
| -#include "mojo/edk/system/message_pipe_test_utils.h"
|
| #include "mojo/edk/system/test_utils.h"
|
| +#include "mojo/edk/test/mojo_test_base.h"
|
| #include "mojo/edk/test/test_utils.h"
|
| #include "mojo/public/c/system/functions.h"
|
| #include "mojo/public/cpp/system/message_pipe.h"
|
| @@ -25,8 +25,7 @@ namespace mojo {
|
| namespace edk {
|
| namespace {
|
|
|
| -class MultiprocessMessagePipePerfTest
|
| - : public test::MultiprocessMessagePipeTestBase {
|
| +class MultiprocessMessagePipePerfTest : public test::MojoTestBase {
|
| public:
|
| MultiprocessMessagePipePerfTest()
|
| : message_count_(0),
|
| @@ -89,20 +88,15 @@ class MultiprocessMessagePipePerfTest
|
| // repeated twice, until the other end is closed or it receives "quitquitquit"
|
| // (which it doesn't reply to). It'll return the number of messages received,
|
| // not including any "quitquitquit" message, modulo 100.
|
| -MOJO_MULTIPROCESS_TEST_CHILD_MAIN(PingPongClient) {
|
| - ScopedPlatformHandle client_platform_handle =
|
| - std::move(test::MultiprocessTestHelper::client_platform_handle);
|
| - CHECK(client_platform_handle.is_valid());
|
| - ScopedMessagePipeHandle mp =
|
| - CreateMessagePipe(std::move(client_platform_handle));
|
| -
|
| +DEFINE_TEST_CLIENT_WITH_PIPE(PingPongClient, MultiprocessMessagePipePerfTest,
|
| + h) {
|
| std::string buffer(1000000, '\0');
|
| int rv = 0;
|
| while (true) {
|
| // Wait for our end of the message pipe to be readable.
|
| HandleSignalsState hss;
|
| MojoResult result =
|
| - MojoWait(mp.get().value(), MOJO_HANDLE_SIGNAL_READABLE,
|
| + MojoWait(h, MOJO_HANDLE_SIGNAL_READABLE,
|
| MOJO_DEADLINE_INDEFINITE, &hss);
|
| if (result != MOJO_RESULT_OK) {
|
| rv = result;
|
| @@ -110,7 +104,7 @@ MOJO_MULTIPROCESS_TEST_CHILD_MAIN(PingPongClient) {
|
| }
|
|
|
| uint32_t read_size = static_cast<uint32_t>(buffer.size());
|
| - CHECK_EQ(MojoReadMessage(mp.get().value(), &buffer[0],
|
| + CHECK_EQ(MojoReadMessage(h, &buffer[0],
|
| &read_size, nullptr,
|
| 0, MOJO_READ_MESSAGE_FLAG_NONE),
|
| MOJO_RESULT_OK);
|
| @@ -119,7 +113,7 @@ MOJO_MULTIPROCESS_TEST_CHILD_MAIN(PingPongClient) {
|
| if (read_size == 0)
|
| break;
|
|
|
| - CHECK_EQ(MojoWriteMessage(mp.get().value(), &buffer[0],
|
| + CHECK_EQ(MojoWriteMessage(h, &buffer[0],
|
| read_size,
|
| nullptr, 0, MOJO_WRITE_MESSAGE_FLAG_NONE),
|
| MOJO_RESULT_OK);
|
| @@ -138,22 +132,18 @@ MOJO_MULTIPROCESS_TEST_CHILD_MAIN(PingPongClient) {
|
| #define MAYBE_PingPong PingPong
|
| #endif // defined(OS_ANDROID)
|
| TEST_F(MultiprocessMessagePipePerfTest, MAYBE_PingPong) {
|
| - helper()->StartChild("PingPongClient");
|
| -
|
| - ScopedMessagePipeHandle mp =
|
| - CreateMessagePipe(std::move(helper()->server_platform_handle));
|
| -
|
| - // This values are set to align with one at ipc_pertests.cc for comparison.
|
| - const size_t kMsgSize[5] = {12, 144, 1728, 20736, 248832};
|
| - const int kMessageCount[5] = {50000, 50000, 50000, 12000, 1000};
|
| -
|
| - for (size_t i = 0; i < 5; i++) {
|
| - SetUpMeasurement(kMessageCount[i], kMsgSize[i]);
|
| - Measure(mp.get().value());
|
| - }
|
| + RUN_CHILD_ON_PIPE(PingPongClient, h)
|
| + // This values are set to align with one at ipc_pertests.cc for comparison.
|
| + const size_t kMsgSize[5] = {12, 144, 1728, 20736, 248832};
|
| + const int kMessageCount[5] = {50000, 50000, 50000, 12000, 1000};
|
| +
|
| + for (size_t i = 0; i < 5; i++) {
|
| + SetUpMeasurement(kMessageCount[i], kMsgSize[i]);
|
| + Measure(h);
|
| + }
|
|
|
| - SendQuitMessage(mp.get().value());
|
| - EXPECT_EQ(0, helper()->WaitForChildShutdown());
|
| + SendQuitMessage(h);
|
| + END_CHILD()
|
| }
|
|
|
| } // namespace
|
|
|