jmadill | 027aa7048 | 2015-03-24 22:01:26 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "base/at_exit.h" |
| 6 | #include "base/bind.h" |
| 7 | #include "base/command_line.h" |
| 8 | #include "base/message_loop/message_loop.h" |
| 9 | #include "base/test/launcher/unit_test_launcher.h" |
| 10 | #include "base/test/test_suite.h" |
| 11 | |
| 12 | namespace { |
| 13 | |
| 14 | int RunHelper(base::TestSuite* test_suite) { |
| 15 | base::MessageLoopForIO message_loop; |
| 16 | return test_suite->Run(); |
| 17 | } |
| 18 | |
| 19 | } // namespace |
| 20 | |
Jamie Madill | 9cddc99 | 2017-09-26 03:19:21 | [diff] [blame] | 21 | extern bool g_OnlyOneRunFrame; |
| 22 | |
jmadill | 027aa7048 | 2015-03-24 22:01:26 | [diff] [blame] | 23 | int main(int argc, char** argv) { |
Jamie Madill | 9cddc99 | 2017-09-26 03:19:21 | [diff] [blame] | 24 | for (int i = 0; i < argc; ++i) { |
| 25 | if (strcmp("--one-frame-only", argv[i]) == 0) { |
| 26 | g_OnlyOneRunFrame = true; |
| 27 | } |
| 28 | } |
| 29 | |
jmadill | 027aa7048 | 2015-03-24 22:01:26 | [diff] [blame] | 30 | base::CommandLine::Init(argc, argv); |
| 31 | base::TestSuite test_suite(argc, argv); |
| 32 | int rt = base::LaunchUnitTestsSerially( |
| 33 | argc, |
| 34 | argv, |
| 35 | base::Bind(&RunHelper, base::Unretained(&test_suite))); |
| 36 | return rt; |
| 37 | } |