| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/public/test/test_launcher.h" | 5 #include "content/public/test/test_launcher.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "content/common/sandbox_policy.h" | 34 #include "content/common/sandbox_policy.h" |
| 35 #include "sandbox/src/dep.h" | 35 #include "sandbox/src/dep.h" |
| 36 #include "sandbox/src/sandbox_factory.h" | 36 #include "sandbox/src/sandbox_factory.h" |
| 37 #include "sandbox/src/sandbox_types.h" | 37 #include "sandbox/src/sandbox_types.h" |
| 38 #elif defined(OS_MACOSX) | 38 #elif defined(OS_MACOSX) |
| 39 #include "base/mac/scoped_nsautorelease_pool.h" | 39 #include "base/mac/scoped_nsautorelease_pool.h" |
| 40 #endif | 40 #endif |
| 41 | 41 |
| 42 namespace test_launcher { | 42 namespace test_launcher { |
| 43 | 43 |
| 44 namespace { |
| 45 TestLauncherDelegate* g_launcher_delegate; |
| 46 } |
| 47 |
| 44 // The environment variable name for the total number of test shards. | 48 // The environment variable name for the total number of test shards. |
| 45 const char kTestTotalShards[] = "GTEST_TOTAL_SHARDS"; | 49 const char kTestTotalShards[] = "GTEST_TOTAL_SHARDS"; |
| 46 // The environment variable name for the test shard index. | 50 // The environment variable name for the test shard index. |
| 47 const char kTestShardIndex[] = "GTEST_SHARD_INDEX"; | 51 const char kTestShardIndex[] = "GTEST_SHARD_INDEX"; |
| 48 | 52 |
| 49 // The default output file for XML output. | 53 // The default output file for XML output. |
| 50 const FilePath::CharType kDefaultOutputFile[] = FILE_PATH_LITERAL( | 54 const FilePath::CharType kDefaultOutputFile[] = FILE_PATH_LITERAL( |
| 51 "test_detail.xml"); | 55 "test_detail.xml"); |
| 52 | 56 |
| 53 // Quit test execution after this number of tests has timed out. | 57 // Quit test execution after this number of tests has timed out. |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 const char kHelpFlag[] = "help"; | 570 const char kHelpFlag[] = "help"; |
| 567 | 571 |
| 568 const char kWarmupFlag[] = "warmup"; | 572 const char kWarmupFlag[] = "warmup"; |
| 569 | 573 |
| 570 TestLauncherDelegate::~TestLauncherDelegate() { | 574 TestLauncherDelegate::~TestLauncherDelegate() { |
| 571 } | 575 } |
| 572 | 576 |
| 573 int LaunchTests(TestLauncherDelegate* launcher_delegate, | 577 int LaunchTests(TestLauncherDelegate* launcher_delegate, |
| 574 int argc, | 578 int argc, |
| 575 char** argv) { | 579 char** argv) { |
| 580 DCHECK(!g_launcher_delegate); |
| 581 g_launcher_delegate = launcher_delegate; |
| 576 launcher_delegate->EarlyInitialize(); | 582 launcher_delegate->EarlyInitialize(); |
| 577 | 583 |
| 578 CommandLine::Init(argc, argv); | 584 CommandLine::Init(argc, argv); |
| 579 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 585 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 580 | 586 |
| 581 if (command_line->HasSwitch(kHelpFlag)) { | 587 if (command_line->HasSwitch(kHelpFlag)) { |
| 582 PrintUsage(); | 588 PrintUsage(); |
| 583 return 0; | 589 return 0; |
| 584 } | 590 } |
| 585 | 591 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 break; | 663 break; |
| 658 } | 664 } |
| 659 | 665 |
| 660 // Special value "-1" means "repeat indefinitely". | 666 // Special value "-1" means "repeat indefinitely". |
| 661 if (cycles != -1) | 667 if (cycles != -1) |
| 662 cycles--; | 668 cycles--; |
| 663 } | 669 } |
| 664 return exit_code; | 670 return exit_code; |
| 665 } | 671 } |
| 666 | 672 |
| 673 TestLauncherDelegate* GetCurrentTestLauncherDelegate() { |
| 674 return g_launcher_delegate; |
| 675 } |
| 676 |
| 667 } // namespace test_launcher | 677 } // namespace test_launcher |
| OLD | NEW |