1 // Copyright 2013 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "base/base_switches.h" 6 #include "base/command_line.h" 7 #include "base/functional/bind.h" 8 #include "base/test/launcher/unit_test_launcher.h" 9 #include "base/test/multiprocess_test.h" 10 #include "base/test/test_io_thread.h" 11 #include "base/test/test_suite.h" 12 #include "mojo/core/embedder/embedder.h" 13 #include "mojo/core/embedder/scoped_ipc_support.h" 14 #include "third_party/ipcz/src/test/multinode_test.h" 15 #include "third_party/ipcz/src/test_buildflags.h" 16 17 #if BUILDFLAG(ENABLE_IPCZ_MULTIPROCESS_TESTS) 18 #include "third_party/ipcz/src/test/test_child_launcher.h" 19 #endif 20 main(int argc,char ** argv)21int main(int argc, char** argv) { 22 #if BUILDFLAG(ENABLE_IPCZ_MULTIPROCESS_TESTS) 23 ipcz::test::TestChildLauncher::Initialize(argc, argv); 24 #endif 25 26 base::TestSuite test_suite(argc, argv); 27 ipcz::test::RegisterMultinodeTests(); 28 29 mojo::core::Init(mojo::core::Configuration{ 30 .is_broker_process = !base::CommandLine::ForCurrentProcess()->HasSwitch( 31 switches::kTestChildProcess), 32 }); 33 base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart); 34 mojo::core::ScopedIPCSupport ipc_support( 35 test_io_thread.task_runner(), 36 mojo::core::ScopedIPCSupport::ShutdownPolicy::CLEAN); 37 38 return base::LaunchUnitTests( 39 argc, argv, 40 base::BindOnce(&base::TestSuite::Run, base::Unretained(&test_suite))); 41 } 42