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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/test/launcher/unit_test_launcher.h" | 7 #include "base/test/launcher/unit_test_launcher.h" |
8 #include "base/test/test_suite.h" | 8 #include "base/test/test_suite.h" |
9 #include "mojo/edk/embedder/embedder.h" | 9 #include "mojo/edk/embedder/embedder.h" |
| 10 #include "mojo/edk/test/multiprocess_test_helper.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
11 | 12 |
12 int main(int argc, char** argv) { | 13 int main(int argc, char** argv) { |
13 // Silence death test thread warnings on Linux. We can afford to run our death | 14 // Silence death test thread warnings on Linux. We can afford to run our death |
14 // tests a little more slowly (< 10 ms per death test on a Z620). | 15 // tests a little more slowly (< 10 ms per death test on a Z620). |
15 // On android, we need to run in the default mode, as the threadsafe mode | 16 // On android, we need to run in the default mode, as the threadsafe mode |
16 // relies on execve which is not available. | 17 // relies on execve which is not available. |
17 #if !defined(OS_ANDROID) | 18 #if !defined(OS_ANDROID) |
18 testing::GTEST_FLAG(death_test_style) = "threadsafe"; | 19 testing::GTEST_FLAG(death_test_style) = "threadsafe"; |
19 #endif | 20 #endif |
| 21 base::TestSuite test_suite(argc, argv); |
| 22 |
| 23 // Must be run before mojo::edk::Init. |
| 24 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 25 mojo::edk::test::kBrokerHandleSwitch)) { |
| 26 mojo::edk::PreInitializeChildProcess(); |
| 27 } |
| 28 |
20 mojo::edk::Init(); | 29 mojo::edk::Init(); |
21 base::TestSuite test_suite(argc, argv); | |
22 // TODO(use_chrome_edk): temporary to force new EDK. | 30 // TODO(use_chrome_edk): temporary to force new EDK. |
23 base::CommandLine::ForCurrentProcess()->AppendSwitch("--use-new-edk"); | 31 base::CommandLine::ForCurrentProcess()->AppendSwitch("--use-new-edk"); |
24 | 32 |
25 return base::LaunchUnitTests( | 33 return base::LaunchUnitTests( |
26 argc, argv, | 34 argc, argv, |
27 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); | 35 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); |
28 } | 36 } |
OLD | NEW |