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 "mojo/edk/test/multiprocess_test_helper.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 int main(int argc, char** argv) { | 13 int main(int argc, char** argv) { |
14 // 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 |
15 // 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). |
16 // 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 |
17 // relies on execve which is not available. | 17 // relies on execve which is not available. |
18 #if !defined(OS_ANDROID) | 18 #if !defined(OS_ANDROID) |
19 testing::GTEST_FLAG(death_test_style) = "threadsafe"; | 19 testing::GTEST_FLAG(death_test_style) = "threadsafe"; |
20 #endif | 20 #endif |
21 base::TestSuite test_suite(argc, argv); | 21 base::TestSuite test_suite(argc, argv); |
22 | 22 |
23 // Must be run before mojo::edk::Init. | 23 // Must be run before mojo::edk::Init. |
24 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 24 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
25 mojo::edk::test::kBrokerHandleSwitch)) { | 25 mojo::edk::test::kBrokerHandleSwitch)) { |
26 mojo::edk::PreInitializeChildProcess(); | 26 mojo::edk::PreInitializeChildProcess(); |
27 } | 27 } |
28 | 28 |
29 mojo::edk::Init(); | |
30 // TODO(use_chrome_edk): temporary to force new EDK. | 29 // TODO(use_chrome_edk): temporary to force new EDK. |
31 base::CommandLine::ForCurrentProcess()->AppendSwitch("--use-new-edk"); | 30 base::CommandLine::ForCurrentProcess()->AppendSwitch("--use-new-edk"); |
32 | 31 |
| 32 mojo::edk::Init(); |
| 33 |
33 return base::LaunchUnitTests( | 34 return base::LaunchUnitTests( |
34 argc, argv, | 35 argc, argv, |
35 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); | 36 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); |
36 } | 37 } |
OLD | NEW |