Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(678)

Side by Side Diff: ipc/mojo/run_all_unittests.cc

Issue 1910233003: Implement a new child test helper for Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ipc/mojo/ipc_channel_mojo_unittest.cc ('k') | mojo/edk/embedder/embedder_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 }
OLDNEW
« no previous file with comments | « ipc/mojo/ipc_channel_mojo_unittest.cc ('k') | mojo/edk/embedder/embedder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698