xref: /aosp_15_r20/external/libchrome/ipc/run_all_unittests.cc (revision 635a864187cb8b6c713ff48b7e790a6b21769273)
1*635a8641SAndroid Build Coastguard Worker // Copyright 2013 The Chromium Authors. All rights reserved.
2*635a8641SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
3*635a8641SAndroid Build Coastguard Worker // found in the LICENSE file.
4*635a8641SAndroid Build Coastguard Worker 
5*635a8641SAndroid Build Coastguard Worker #include "base/bind.h"
6*635a8641SAndroid Build Coastguard Worker #include "base/test/launcher/unit_test_launcher.h"
7*635a8641SAndroid Build Coastguard Worker #include "base/test/multiprocess_test.h"
8*635a8641SAndroid Build Coastguard Worker #include "base/test/test_io_thread.h"
9*635a8641SAndroid Build Coastguard Worker #include "base/test/test_suite.h"
10*635a8641SAndroid Build Coastguard Worker #include "build/build_config.h"
11*635a8641SAndroid Build Coastguard Worker #include "mojo/core/embedder/embedder.h"
12*635a8641SAndroid Build Coastguard Worker #include "mojo/core/embedder/scoped_ipc_support.h"
13*635a8641SAndroid Build Coastguard Worker 
14*635a8641SAndroid Build Coastguard Worker #if defined(OS_MACOSX) && !defined(OS_IOS)
15*635a8641SAndroid Build Coastguard Worker #include "base/mac/mach_port_broker.h"
16*635a8641SAndroid Build Coastguard Worker #endif
17*635a8641SAndroid Build Coastguard Worker 
main(int argc,char ** argv)18*635a8641SAndroid Build Coastguard Worker int main(int argc, char** argv) {
19*635a8641SAndroid Build Coastguard Worker   base::TestSuite test_suite(argc, argv);
20*635a8641SAndroid Build Coastguard Worker   mojo::core::Init();
21*635a8641SAndroid Build Coastguard Worker   base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart);
22*635a8641SAndroid Build Coastguard Worker   mojo::core::ScopedIPCSupport ipc_support(
23*635a8641SAndroid Build Coastguard Worker       test_io_thread.task_runner(),
24*635a8641SAndroid Build Coastguard Worker       mojo::core::ScopedIPCSupport::ShutdownPolicy::CLEAN);
25*635a8641SAndroid Build Coastguard Worker 
26*635a8641SAndroid Build Coastguard Worker #if defined(OS_MACOSX) && !defined(OS_IOS)
27*635a8641SAndroid Build Coastguard Worker   base::MachPortBroker mach_broker("mojo_test");
28*635a8641SAndroid Build Coastguard Worker   CHECK(mach_broker.Init());
29*635a8641SAndroid Build Coastguard Worker   mojo::core::SetMachPortProvider(&mach_broker);
30*635a8641SAndroid Build Coastguard Worker #endif
31*635a8641SAndroid Build Coastguard Worker 
32*635a8641SAndroid Build Coastguard Worker   return base::LaunchUnitTests(
33*635a8641SAndroid Build Coastguard Worker       argc, argv,
34*635a8641SAndroid Build Coastguard Worker       base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite)));
35*635a8641SAndroid Build Coastguard Worker }
36