OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "base/bind.h" | |
6 #include "base/command_line.h" | |
7 #include "base/test/launcher/unit_test_launcher.h" | |
8 #include "base/test/test_io_thread.h" | |
9 #include "base/test/test_suite.h" | |
10 #include "mojo/edk/embedder/embedder.h" | |
11 #include "mojo/edk/test/multiprocess_test_helper.h" | |
12 #include "mojo/edk/test/scoped_ipc_support.h" | |
13 #include "testing/gtest/include/gtest/gtest.h" | |
14 | |
15 int main(int argc, char** argv) { | |
16 // Silence death test thread warnings on Linux. We can afford to run our death | |
17 // tests a little more slowly (< 10 ms per death test on a Z620). | |
18 // On android, we need to run in the default mode, as the threadsafe mode | |
19 // relies on execve which is not available. | |
20 #if !defined(OS_ANDROID) | |
21 testing::GTEST_FLAG(death_test_style) = "threadsafe"; | |
22 #endif | |
23 base::TestSuite test_suite(argc, argv); | |
24 | |
25 // Must be run before mojo::edk::Init. | |
26 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | |
27 mojo::edk::test::kBrokerHandleSwitch)) { | |
28 mojo::edk::PreInitializeChildProcess(); | |
29 } | |
30 | |
31 // TODO(use_chrome_edk): temporary to force new EDK. | |
32 base::CommandLine::ForCurrentProcess()->AppendSwitch("--use-new-edk"); | |
33 | |
34 mojo::edk::Init(); | |
35 | |
36 base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart); | |
37 // Leak this because its destructor calls mojo::edk::ShutdownIPCSupport which | |
38 // really does nothing in the new EDK but does depend on the current message | |
39 // loop, which is destructed inside base::LaunchUnitTests. | |
40 new mojo::edk::test::ScopedIPCSupport(test_io_thread.task_runner()); | |
41 | |
42 return base::LaunchUnitTests( | |
43 argc, argv, | |
44 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); | |
45 } | |
OLD | NEW |