OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/test/launcher/unit_test_launcher.h" | 6 #include "base/test/launcher/unit_test_launcher.h" |
7 #include "base/test/multiprocess_test.h" | 7 #include "base/test/multiprocess_test.h" |
8 #include "base/test/test_io_thread.h" | 8 #include "base/test/test_io_thread.h" |
9 #include "base/test/test_suite.h" | 9 #include "base/test/test_suite.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "mojo/edk/embedder/embedder.h" | 11 #include "mojo/edk/embedder/embedder.h" |
12 #include "mojo/edk/test/scoped_ipc_support.h" | 12 #include "mojo/edk/test/scoped_ipc_support.h" |
13 | 13 |
14 #if defined(OS_MACOSX) && !defined(OS_IOS) | 14 #if defined(OS_MACOSX) && !defined(OS_IOS) |
15 #include "base/mac/mach_port_broker.h" | 15 #include "base/mac/mach_port_broker.h" |
16 #endif | 16 #endif |
17 | 17 |
| 18 #if defined(OS_ANDROID) |
| 19 #include "base/test/android/android_main_function_thunk.h" |
| 20 |
| 21 int main(int argc, char** argv); |
| 22 namespace { |
| 23 // Needed for multiprocess tests to find the main function. |
| 24 base::android::AndroidMainFunctionThunk main_thunk(&main); |
| 25 } |
| 26 #endif |
| 27 |
18 int main(int argc, char** argv) { | 28 int main(int argc, char** argv) { |
19 #if defined(OS_ANDROID) | |
20 base::InitAndroidMultiProcessTestHelper(main); | |
21 #endif | |
22 base::TestSuite test_suite(argc, argv); | 29 base::TestSuite test_suite(argc, argv); |
23 mojo::edk::Init(); | 30 mojo::edk::Init(); |
24 base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart); | 31 base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart); |
25 // Leak this because its destructor calls mojo::edk::ShutdownIPCSupport which | 32 // Leak this because its destructor calls mojo::edk::ShutdownIPCSupport which |
26 // really does nothing in the new EDK but does depend on the current message | 33 // really does nothing in the new EDK but does depend on the current message |
27 // loop, which is destructed inside base::LaunchUnitTests. | 34 // loop, which is destructed inside base::LaunchUnitTests. |
28 new mojo::edk::test::ScopedIPCSupport(test_io_thread.task_runner()); | 35 new mojo::edk::test::ScopedIPCSupport(test_io_thread.task_runner()); |
29 | 36 |
30 #if defined(OS_MACOSX) && !defined(OS_IOS) | 37 #if defined(OS_MACOSX) && !defined(OS_IOS) |
31 base::MachPortBroker mach_broker("mojo_test"); | 38 base::MachPortBroker mach_broker("mojo_test"); |
32 CHECK(mach_broker.Init()); | 39 CHECK(mach_broker.Init()); |
33 mojo::edk::SetMachPortProvider(&mach_broker); | 40 mojo::edk::SetMachPortProvider(&mach_broker); |
34 #endif | 41 #endif |
35 | 42 |
36 return base::LaunchUnitTests( | 43 return base::LaunchUnitTests( |
37 argc, argv, | 44 argc, argv, |
38 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); | 45 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); |
39 } | 46 } |
OLD | NEW |