OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 fprintf(stdout, | 616 fprintf(stdout, |
617 "Starting tests...\n" | 617 "Starting tests...\n" |
618 "IMPORTANT DEBUGGING NOTE: each test is run inside its own process.\n" | 618 "IMPORTANT DEBUGGING NOTE: each test is run inside its own process.\n" |
619 "For debugging a test inside a debugger, use the\n" | 619 "For debugging a test inside a debugger, use the\n" |
620 "--gtest_filter=<your_test_name> flag along with either\n" | 620 "--gtest_filter=<your_test_name> flag along with either\n" |
621 "--single_process (to run all tests in one launcher/browser process) or\n" | 621 "--single_process (to run all tests in one launcher/browser process) or\n" |
622 "--single-process (to do the above, and also run Chrome in single-\n" | 622 "--single-process (to do the above, and also run Chrome in single-\n" |
623 "process mode).\n"); | 623 "process mode).\n"); |
624 | 624 |
625 testing::InitGoogleTest(&argc, argv); | 625 testing::InitGoogleTest(&argc, argv); |
| 626 TestTimeouts::Initialize(); |
626 | 627 |
627 // Make sure the entire browser code is loaded into memory. Reading it | 628 // Make sure the entire browser code is loaded into memory. Reading it |
628 // from disk may be slow on a busy bot, and can easily exceed the default | 629 // from disk may be slow on a busy bot, and can easily exceed the default |
629 // timeout causing flaky test failures. Use an empty test that only starts | 630 // timeout causing flaky test failures. Use an empty test that only starts |
630 // and closes a browser with a long timeout to avoid those problems. | 631 // and closes a browser with a long timeout to avoid those problems. |
631 RunTest(kEmptyTestName, TestTimeouts::large_test_timeout_ms()); | 632 RunTest(kEmptyTestName, TestTimeouts::large_test_timeout_ms()); |
632 | 633 |
633 int cycles = 1; | 634 int cycles = 1; |
634 if (command_line->HasSwitch(kGTestRepeatFlag)) { | 635 if (command_line->HasSwitch(kGTestRepeatFlag)) { |
635 base::StringToInt(command_line->GetSwitchValueASCII(kGTestRepeatFlag), | 636 base::StringToInt(command_line->GetSwitchValueASCII(kGTestRepeatFlag), |
636 &cycles); | 637 &cycles); |
637 } | 638 } |
638 | 639 |
639 int exit_code = 0; | 640 int exit_code = 0; |
640 while (cycles != 0) { | 641 while (cycles != 0) { |
641 if (!RunTests(should_shard, total_shards, shard_index)) { | 642 if (!RunTests(should_shard, total_shards, shard_index)) { |
642 exit_code = 1; | 643 exit_code = 1; |
643 break; | 644 break; |
644 } | 645 } |
645 | 646 |
646 // Special value "-1" means "repeat indefinitely". | 647 // Special value "-1" means "repeat indefinitely". |
647 if (cycles != -1) | 648 if (cycles != -1) |
648 cycles--; | 649 cycles--; |
649 } | 650 } |
650 return exit_code; | 651 return exit_code; |
651 } | 652 } |
OLD | NEW |