| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/message_loop/message_loop.h" | |
| 6 #include "base/test/launcher/unit_test_launcher.h" | |
| 7 #include "base/test/test_suite.h" | 5 #include "base/test/test_suite.h" |
| 8 #include "base/threading/thread.h" | 6 #include "services/service_manager/public/cpp/test/common_initialization.h" |
| 9 #include "base/values.h" | |
| 10 #include "mojo/edk/embedder/embedder.h" | |
| 11 #include "mojo/edk/embedder/scoped_ipc_support.h" | |
| 12 #include "services/catalog/catalog.h" | |
| 13 #include "services/service_manager/public/cpp/test/service_test_catalog.h" | |
| 14 | |
| 15 #if defined(OS_ANDROID) | |
| 16 #include "base/android/jni_android.h" | |
| 17 #include "mojo/android/system/mojo_jni_registrar.h" | |
| 18 #endif | |
| 19 | |
| 20 #if defined(OS_MACOSX) && !defined(OS_IOS) | |
| 21 #include "services/service_manager/public/cpp/standalone_service/mach_broker.h" | |
| 22 #endif | |
| 23 | 7 |
| 24 int main(int argc, char** argv) { | 8 int main(int argc, char** argv) { |
| 25 base::TestSuite test_suite(argc, argv); | 9 base::TestSuite test_suite(argc, argv); |
| 26 | 10 |
| 27 catalog::Catalog::SetDefaultCatalogManifest( | 11 return service_manager::InitializeAndLaunchUnitTests( |
| 28 service_manager::test::CreateTestCatalog()); | |
| 29 | |
| 30 mojo::edk::Init(); | |
| 31 | |
| 32 #if defined(OS_MACOSX) && !defined(OS_IOS) | |
| 33 mojo::edk::SetMachPortProvider( | |
| 34 service_manager::MachBroker::GetInstance()->port_provider()); | |
| 35 #endif | |
| 36 | |
| 37 #if defined(OS_ANDROID) | |
| 38 mojo::android::RegisterSystemJni(base::android::AttachCurrentThread()); | |
| 39 #endif | |
| 40 | |
| 41 base::Thread ipc_thread("IPC thread"); | |
| 42 ipc_thread.StartWithOptions( | |
| 43 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); | |
| 44 mojo::edk::ScopedIPCSupport ipc_support( | |
| 45 ipc_thread.task_runner(), | |
| 46 mojo::edk::ScopedIPCSupport::ShutdownPolicy::CLEAN); | |
| 47 | |
| 48 return base::LaunchUnitTests( | |
| 49 argc, argv, | 12 argc, argv, |
| 50 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); | 13 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); |
| 51 } | 14 } |
| OLD | NEW |