#include <stddef.h>
#include <memory>
#include <tuple>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/process/process_metrics.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/synchronization/waitable_event.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/perf_time_logger.h"
#include "base/test/task_environment.h"
#include "base/threading/thread.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "ipc/ipc_channel_mojo.h"
#include "ipc/ipc_perftest_messages.h"
#include "ipc/ipc_perftest_util.h"
#include "ipc/ipc_sync_channel.h"
#include "ipc/ipc_test.mojom.h"
#include "ipc/ipc_test_base.h"
#include "mojo/core/embedder/embedder.h"
#include "mojo/core/test/mojo_test_base.h"
#include "mojo/core/test/multiprocess_test_helper.h"
#include "mojo/public/cpp/bindings/associated_receiver_set.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/system/message_pipe.h"
namespace IPC {
namespace {
class PerformanceChannelListener : public Listener { … };
class PingPongTestParams { … };
class InterfacePassingTestParams { … };
#ifdef NDEBUG
const int kMultiplier = 100;
#else
const int kMultiplier = …;
#endif
std::vector<PingPongTestParams> GetDefaultTestParams() { … }
std::vector<InterfacePassingTestParams> GetDefaultInterfacePassingTestParams() { … }
class MojoChannelPerfTest : public IPCChannelMojoTestBase { … };
TEST_F(MojoChannelPerfTest, ChannelProxyPingPong) { … }
TEST_F(MojoChannelPerfTest, ChannelProxySyncPing) { … }
MULTIPROCESS_TEST_MAIN(MojoPerfTestClientTestChildMain) { … }
class MojoInterfacePerfTest : public mojo::core::test::MojoTestBase { … };
class InterfacePassingTestDriverImpl : public mojom::InterfacePassingTestDriver,
public mojom::PingReceiver { … };
class MojoInterfacePassingPerfTest : public mojo::core::test::MojoTestBase { … };
DEFINE_TEST_CLIENT_WITH_PIPE(InterfacePassingClient,
MojoInterfacePassingPerfTest,
h) { … }
enum class InProcessMessageMode { … };
template <class TestBase>
class InProcessPerfTest
: public TestBase,
public testing::WithParamInterface<InProcessMessageMode> { … };
MojoInProcessInterfacePerfTest;
MojoInProcessInterfacePassingPerfTest;
DEFINE_TEST_CLIENT_WITH_PIPE(PingPongClient, MojoInterfacePerfTest, h) { … }
TEST_F(MojoInterfacePerfTest, MultiprocessPingPong) { … }
TEST_F(MojoInterfacePerfTest, MultiprocessSyncPing) { … }
TEST_F(MojoInterfacePassingPerfTest, MultiprocessInterfacePassing) { … }
TEST_F(MojoInterfacePassingPerfTest, MultiprocessAssociatedInterfacePassing) { … }
TEST_P(MojoInProcessInterfacePerfTest, MultiThreadPingPong) { … }
TEST_P(MojoInProcessInterfacePerfTest, SingleThreadPingPong) { … }
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(MojoInProcessInterfacePassingPerfTest, MultiThreadInterfacePassing) { … }
TEST_P(MojoInProcessInterfacePassingPerfTest,
MultiThreadAssociatedInterfacePassing) { … }
TEST_P(MojoInProcessInterfacePassingPerfTest, SingleThreadInterfacePassing) { … }
TEST_P(MojoInProcessInterfacePassingPerfTest,
SingleThreadAssociatedInterfacePassing) { … }
INSTANTIATE_TEST_SUITE_P(…);
class CallbackPerfTest : public testing::Test { … };
TEST_F(CallbackPerfTest, MultiThreadPingPong) { … }
TEST_F(CallbackPerfTest, SingleThreadPostTaskPingPong) { … }
TEST_F(CallbackPerfTest, SingleThreadNoPostTaskPingPong) { … }
}
}