diff options
author | amistry <amistry@chromium.org> | 2016-03-07 12:51:15 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-07 20:52:19 +0000 |
commit | ff49509e51de30ed6406875175ab644435077403 (patch) | |
tree | 1b7cf25365295c4dd81db7b8a3f8ec4aac2f5e46 | |
parent | 945e2bc8771685c37cfcb0fa6b855d2afefc05ed (diff) | |
download | chromium_src-ff49509e51de30ed6406875175ab644435077403.zip chromium_src-ff49509e51de30ed6406875175ab644435077403.tar.gz chromium_src-ff49509e51de30ed6406875175ab644435077403.tar.bz2 |
Fix mojo_public_bindings_perftests and add GN build rules.
BUG=582823
Review URL: https://codereview.chromium.org/1768883002
Cr-Commit-Position: refs/heads/master@{#379633}
-rw-r--r-- | mojo/BUILD.gn | 1 | ||||
-rw-r--r-- | mojo/edk/test/BUILD.gn | 8 | ||||
-rw-r--r-- | mojo/mojo_edk_tests.gyp | 2 | ||||
-rw-r--r-- | mojo/public/cpp/bindings/tests/bindings_perftest.cc | 12 |
4 files changed, 18 insertions, 5 deletions
diff --git a/mojo/BUILD.gn b/mojo/BUILD.gn index 4d2d4b3..7c2b9d2 100644 --- a/mojo/BUILD.gn +++ b/mojo/BUILD.gn @@ -37,6 +37,7 @@ group("tests") { "//mojo/edk/js/test:js_unittests", "//mojo/edk/system:mojo_message_pipe_perftests", "//mojo/edk/system:mojo_system_unittests", + "//mojo/edk/test:mojo_public_bindings_perftests", "//mojo/edk/test:mojo_public_bindings_unittests", "//mojo/edk/test:mojo_public_environment_unittests", "//mojo/edk/test:mojo_public_system_perftests", diff --git a/mojo/edk/test/BUILD.gn b/mojo/edk/test/BUILD.gn index e84b32e..d81ff02 100644 --- a/mojo/edk/test/BUILD.gn +++ b/mojo/edk/test/BUILD.gn @@ -99,6 +99,14 @@ group("public_tests") { ] } +test("mojo_public_bindings_perftests") { + deps = [ + ":run_all_perftests", + "//mojo/edk/test:test_support", + "//mojo/public/cpp/bindings/tests:perftests", + ] +} + test("mojo_public_bindings_unittests") { deps = [ ":run_all_unittests", diff --git a/mojo/mojo_edk_tests.gyp b/mojo/mojo_edk_tests.gyp index 755ee40..0ace217 100644 --- a/mojo/mojo_edk_tests.gyp +++ b/mojo/mojo_edk_tests.gyp @@ -110,7 +110,7 @@ 'dependencies': [ '../testing/gtest.gyp:gtest', 'mojo_base.gyp:mojo_common_lib', - 'mojo_edk.gyp:mojo_run_all_unittests', + 'mojo_edk.gyp:mojo_run_all_perftests', 'mojo_public.gyp:mojo_cpp_bindings', 'mojo_public.gyp:mojo_environment_standalone', 'mojo_public.gyp:mojo_message_pump_lib', diff --git a/mojo/public/cpp/bindings/tests/bindings_perftest.cc b/mojo/public/cpp/bindings/tests/bindings_perftest.cc index 8162f81..93f00cf 100644 --- a/mojo/public/cpp/bindings/tests/bindings_perftest.cc +++ b/mojo/public/cpp/bindings/tests/bindings_perftest.cc @@ -6,11 +6,11 @@ #include <utility> #include "base/message_loop/message_loop.h" +#include "base/run_loop.h" #include "mojo/message_pump/message_pump_mojo.h" #include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/test_support/test_support.h" #include "mojo/public/cpp/test_support/test_utils.h" -#include "mojo/public/cpp/utility/run_loop.h" #include "mojo/public/interfaces/bindings/tests/ping_service.mojom.h" #include "testing/gtest/include/gtest/gtest.h" @@ -25,7 +25,7 @@ double MojoTicksToSeconds(MojoTimeTicks ticks) { class PingServiceImpl : public test::PingService { public: - explicit PingServiceImpl() {} + PingServiceImpl() {} ~PingServiceImpl() override {} // |PingService| methods: @@ -52,6 +52,8 @@ class PingPongTest { unsigned int iterations_to_run_; unsigned int current_iterations_; + base::Closure quit_closure_; + DISALLOW_COPY_AND_ASSIGN(PingPongTest); }; @@ -62,14 +64,16 @@ void PingPongTest::Run(unsigned int iterations) { iterations_to_run_ = iterations; current_iterations_ = 0; + base::RunLoop run_loop; + quit_closure_ = run_loop.QuitClosure(); service_->Ping([this]() { OnPingDone(); }); - RunLoop::current()->Run(); + run_loop.Run(); } void PingPongTest::OnPingDone() { current_iterations_++; if (current_iterations_ >= iterations_to_run_) { - RunLoop::current()->Quit(); + quit_closure_.Run(); return; } |