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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 | 615 |
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); |
| 626 |
625 // Make sure the entire browser code is loaded into memory. Reading it | 627 // Make sure the entire browser code is loaded into memory. Reading it |
626 // from disk may be slow on a busy bot, and can easily exceed the default | 628 // from disk may be slow on a busy bot, and can easily exceed the default |
627 // timeout causing flaky test failures. Use an empty test that only starts | 629 // timeout causing flaky test failures. Use an empty test that only starts |
628 // and closes a browser with a long timeout to avoid those problems. | 630 // and closes a browser with a long timeout to avoid those problems. |
629 RunTest(kEmptyTestName, TestTimeouts::large_test_timeout_ms()); | 631 RunTest(kEmptyTestName, TestTimeouts::large_test_timeout_ms()); |
630 | 632 |
631 int cycles = 1; | 633 int cycles = 1; |
632 if (command_line->HasSwitch(kGTestRepeatFlag)) { | 634 if (command_line->HasSwitch(kGTestRepeatFlag)) { |
633 base::StringToInt(command_line->GetSwitchValueASCII(kGTestRepeatFlag), | 635 base::StringToInt(command_line->GetSwitchValueASCII(kGTestRepeatFlag), |
634 &cycles); | 636 &cycles); |
635 } | 637 } |
636 | 638 |
637 int exit_code = 0; | 639 int exit_code = 0; |
638 while (cycles != 0) { | 640 while (cycles != 0) { |
639 if (!RunTests(should_shard, total_shards, shard_index)) { | 641 if (!RunTests(should_shard, total_shards, shard_index)) { |
640 exit_code = 1; | 642 exit_code = 1; |
641 break; | 643 break; |
642 } | 644 } |
643 | 645 |
644 // Special value "-1" means "repeat indefinitely". | 646 // Special value "-1" means "repeat indefinitely". |
645 if (cycles != -1) | 647 if (cycles != -1) |
646 cycles--; | 648 cycles--; |
647 } | 649 } |
648 return exit_code; | 650 return exit_code; |
649 } | 651 } |
OLD | NEW |