Index: mojo/edk/test/run_all_perftests.cc |
diff --git a/mojo/edk/test/run_all_perftests.cc b/mojo/edk/test/run_all_perftests.cc |
index d700bc3a6f6719e34f1c287de231d56845e7a121..c277a385ff18406d270b0cfdd50796064acb0559 100644 |
--- a/mojo/edk/test/run_all_perftests.cc |
+++ b/mojo/edk/test/run_all_perftests.cc |
@@ -4,17 +4,32 @@ |
#include "base/command_line.h" |
#include "base/test/perf_test_suite.h" |
+#include "base/test/test_io_thread.h" |
#include "mojo/edk/embedder/embedder.h" |
+#include "mojo/edk/test/multiprocess_test_helper.h" |
+#include "mojo/edk/test/scoped_ipc_support.h" |
#include "mojo/edk/test/test_support_impl.h" |
#include "mojo/public/tests/test_support_private.h" |
int main(int argc, char** argv) { |
- mojo::edk::Init(); |
- mojo::test::TestSupport::Init(new mojo::edk::test::TestSupportImpl()); |
+ base::PerfTestSuite test(argc, argv); |
+ |
+ // Must be run before mojo::edk::Init. |
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ mojo::edk::test::kBrokerHandleSwitch)) { |
+ mojo::edk::PreInitializeChildProcess(); |
+ } |
// TODO(use_chrome_edk): temporary to force new EDK. |
- base::PerfTestSuite test(argc, argv); |
base::CommandLine::ForCurrentProcess()->AppendSwitch("--use-new-edk"); |
+ mojo::edk::Init(); |
+ base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart); |
+ // Leak this because its destructor calls mojo::edk::ShutdownIPCSupport which |
+ // really does nothing in the new EDK but does depend on the current message |
+ // loop, which is destructed inside base::LaunchUnitTests. |
yzshen1
2015/12/04 05:57:05
where is base::LaunchUnitTests called?
|
+ new mojo::edk::test::ScopedIPCSupport(test_io_thread.task_runner()); |
+ mojo::test::TestSupport::Init(new mojo::edk::test::TestSupportImpl()); |
+ |
return test.Run(); |
} |