diff options
author | amistry <amistry@chromium.org> | 2016-03-07 19:36:08 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-08 03:37:45 +0000 |
commit | 379dad6a6204d1d13270bc95e6c2e89148ca1616 (patch) | |
tree | 504bb68944bf65bf920021b0ad46cbee4c36f027 /mojo/edk | |
parent | 0599b75469cb6edec440ec4c6ec1f3bc29b383f6 (diff) | |
download | chromium_src-379dad6a6204d1d13270bc95e6c2e89148ca1616.zip chromium_src-379dad6a6204d1d13270bc95e6c2e89148ca1616.tar.gz chromium_src-379dad6a6204d1d13270bc95e6c2e89148ca1616.tar.bz2 |
Add an end-to-end, multi-process perftest of using Mojo with the C++ bindings.
BUG=582823
Review URL: https://codereview.chromium.org/1764023002
Cr-Commit-Position: refs/heads/master@{#379717}
Diffstat (limited to 'mojo/edk')
-rw-r--r-- | mojo/edk/test/mojo_test_base.h | 29 | ||||
-rw-r--r-- | mojo/edk/test/scoped_ipc_support.cc | 9 | ||||
-rw-r--r-- | mojo/edk/test/scoped_ipc_support.h | 2 |
3 files changed, 25 insertions, 15 deletions
diff --git a/mojo/edk/test/mojo_test_base.h b/mojo/edk/test/mojo_test_base.h index 71c9276..1dcadf1 100644 --- a/mojo/edk/test/mojo_test_base.h +++ b/mojo/edk/test/mojo_test_base.h @@ -188,14 +188,13 @@ class MojoTestBase : public testing::Test { }; \ MULTIPROCESS_TEST_MAIN_WITH_SETUP( \ client_name##TestChildMain, \ - test::MultiprocessTestHelper::ChildSetup) { \ - client_name##_MainFixture test; \ - return test::MultiprocessTestHelper::RunClientMain( \ - base::Bind(&client_name##_MainFixture::Main, \ - base::Unretained(&test))); \ - } \ - int client_name##_MainFixture::Main(MojoHandle pipe_name) - + ::mojo::edk::test::MultiprocessTestHelper::ChildSetup) { \ + client_name##_MainFixture test; \ + return ::mojo::edk::test::MultiprocessTestHelper::RunClientMain( \ + base::Bind(&client_name##_MainFixture::Main, \ + base::Unretained(&test))); \ + } \ + int client_name##_MainFixture::Main(MojoHandle pipe_name) // This is a version of DEFINE_TEST_CLIENT_WITH_PIPE which can be used with // gtest ASSERT/EXPECT macros. @@ -207,13 +206,13 @@ class MojoTestBase : public testing::Test { }; \ MULTIPROCESS_TEST_MAIN_WITH_SETUP( \ client_name##TestChildMain, \ - test::MultiprocessTestHelper::ChildSetup) { \ - client_name##_MainFixture test; \ - return test::MultiprocessTestHelper::RunClientTestMain( \ - base::Bind(&client_name##_MainFixture::Main, \ - base::Unretained(&test))); \ - } \ - void client_name##_MainFixture::Main(MojoHandle pipe_name) + ::mojo::edk::test::MultiprocessTestHelper::ChildSetup) { \ + client_name##_MainFixture test; \ + return ::mojo::edk::test::MultiprocessTestHelper::RunClientTestMain( \ + base::Bind(&client_name##_MainFixture::Main, \ + base::Unretained(&test))); \ + } \ + void client_name##_MainFixture::Main(MojoHandle pipe_name) #else // !defined(OS_IOS) #define DEFINE_TEST_CLIENT_WITH_PIPE(client_name, test_base, pipe_name) #define DEFINE_TEST_CLIENT_TEST_WITH_PIPE(client_name, test_base, pipe_name) diff --git a/mojo/edk/test/scoped_ipc_support.cc b/mojo/edk/test/scoped_ipc_support.cc index d7ff28b..7dc7c99 100644 --- a/mojo/edk/test/scoped_ipc_support.cc +++ b/mojo/edk/test/scoped_ipc_support.cc @@ -13,6 +13,14 @@ namespace mojo { namespace edk { namespace test { +namespace { +base::TaskRunner* g_io_task_runner = nullptr; +} + +base::TaskRunner* GetIoTaskRunner() { + return g_io_task_runner; +} + namespace internal { ScopedIPCSupportHelper::ScopedIPCSupportHelper() { @@ -38,6 +46,7 @@ void ScopedIPCSupportHelper::OnShutdownCompleteImpl() { ScopedIPCSupport::ScopedIPCSupport( scoped_refptr<base::TaskRunner> io_thread_task_runner) { + g_io_task_runner = io_thread_task_runner.get(); helper_.Init(this, std::move(io_thread_task_runner)); } diff --git a/mojo/edk/test/scoped_ipc_support.h b/mojo/edk/test/scoped_ipc_support.h index bb1f458..ff2f558 100644 --- a/mojo/edk/test/scoped_ipc_support.h +++ b/mojo/edk/test/scoped_ipc_support.h @@ -17,6 +17,8 @@ namespace mojo { namespace edk { namespace test { +base::TaskRunner* GetIoTaskRunner(); + namespace internal { class ScopedIPCSupportHelper { |