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_suite.h" | 9 #include "base/test/test_suite.h" |
9 #include "build/build_config.h" | 10 #include "build/build_config.h" |
10 #include "mojo/edk/embedder/embedder.h" | 11 #include "mojo/edk/embedder/embedder.h" |
| 12 #include "mojo/edk/test/scoped_ipc_support.h" |
11 | 13 |
12 #if defined(OS_ANDROID) | 14 #if defined(OS_ANDROID) |
13 #include "base/android/jni_android.h" | 15 #include "base/android/jni_android.h" |
14 #include "base/test/test_file_util.h" | 16 #include "base/test/test_file_util.h" |
15 #endif | 17 #endif |
16 | 18 |
| 19 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 20 #include "base/mac/mach_port_broker.h" |
| 21 #endif |
| 22 |
17 int main(int argc, char** argv) { | 23 int main(int argc, char** argv) { |
18 #if defined(OS_ANDROID) | 24 #if defined(OS_ANDROID) |
19 base::InitAndroidMultiProcessTestHelper(main); | 25 base::InitAndroidMultiProcessTestHelper(main); |
20 | 26 |
21 JNIEnv* env = base::android::AttachCurrentThread(); | 27 JNIEnv* env = base::android::AttachCurrentThread(); |
22 base::RegisterContentUriTestUtils(env); | 28 base::RegisterContentUriTestUtils(env); |
23 #endif | 29 #endif |
| 30 base::TestSuite test_suite(argc, argv); |
24 mojo::edk::Init(); | 31 mojo::edk::Init(); |
25 base::TestSuite test_suite(argc, argv); | 32 base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart); |
| 33 // Leak this because its destructor calls mojo::edk::ShutdownIPCSupport which |
| 34 // really does nothing in the new EDK but does depend on the current message |
| 35 // loop, which is destructed inside base::LaunchUnitTests. |
| 36 new mojo::edk::test::ScopedIPCSupport(test_io_thread.task_runner()); |
| 37 |
| 38 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 39 base::MachPortBroker mach_broker("mojo_test"); |
| 40 CHECK(mach_broker.Init()); |
| 41 mojo::edk::SetMachPortProvider(&mach_broker); |
| 42 #endif |
| 43 |
26 return base::LaunchUnitTests( | 44 return base::LaunchUnitTests( |
27 argc, argv, | 45 argc, argv, |
28 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); | 46 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); |
29 } | 47 } |
OLD | NEW |