OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/test/launcher/unit_test_launcher.h" | 7 #include "base/test/launcher/unit_test_launcher.h" |
| 8 #include "base/test/multiprocess_test.h" |
8 #include "base/test/test_io_thread.h" | 9 #include "base/test/test_io_thread.h" |
9 #include "base/test/test_suite.h" | 10 #include "base/test/test_suite.h" |
10 #include "build/build_config.h" | 11 #include "build/build_config.h" |
11 #include "mojo/edk/embedder/embedder.h" | 12 #include "mojo/edk/embedder/embedder.h" |
12 #include "mojo/edk/test/scoped_ipc_support.h" | 13 #include "mojo/edk/test/scoped_ipc_support.h" |
13 | 14 |
14 #if defined(OS_ANDROID) | 15 #if defined(OS_ANDROID) |
15 #include "base/android/jni_android.h" | 16 #include "base/android/jni_android.h" |
16 #include "base/test/test_file_util.h" | 17 #include "base/test/test_file_util.h" |
17 #endif | 18 #endif |
18 | 19 |
19 int main(int argc, char** argv) { | 20 int main(int argc, char** argv) { |
20 #if defined(OS_ANDROID) | 21 #if defined(OS_ANDROID) |
| 22 // Enable the alternate test child implementation. This is needed because Mojo |
| 23 // tests need to spawn test children after initialising the Mojo system. |
| 24 base::InitAndroidMultiProcessTestHelper(main); |
| 25 |
21 JNIEnv* env = base::android::AttachCurrentThread(); | 26 JNIEnv* env = base::android::AttachCurrentThread(); |
22 base::RegisterContentUriTestUtils(env); | 27 base::RegisterContentUriTestUtils(env); |
23 #endif | 28 #endif |
24 base::TestSuite test_suite(argc, argv); | 29 base::TestSuite test_suite(argc, argv); |
25 mojo::edk::Init(); | 30 mojo::edk::Init(); |
26 base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart); | 31 base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart); |
27 // Leak this because its destructor calls mojo::edk::ShutdownIPCSupport which | 32 // Leak this because its destructor calls mojo::edk::ShutdownIPCSupport which |
28 // 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 |
29 // loop, which is destructed inside base::LaunchUnitTests. | 34 // loop, which is destructed inside base::LaunchUnitTests. |
30 new mojo::edk::test::ScopedIPCSupport(test_io_thread.task_runner()); | 35 new mojo::edk::test::ScopedIPCSupport(test_io_thread.task_runner()); |
31 return base::LaunchUnitTestsSerially( | 36 return base::LaunchUnitTestsSerially( |
32 argc, argv, | 37 argc, argv, |
33 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); | 38 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); |
34 } | 39 } |
OLD | NEW |