| 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 <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 TestLauncherDelegate* g_launcher_delegate; | 62 TestLauncherDelegate* g_launcher_delegate; |
| 63 | 63 |
| 64 std::string RemoveAnyPrePrefixes(const std::string& test_name) { | 64 std::string RemoveAnyPrePrefixes(const std::string& test_name) { |
| 65 std::string result(test_name); | 65 std::string result(test_name); |
| 66 ReplaceSubstringsAfterOffset(&result, 0, kPreTestPrefix, std::string()); | 66 ReplaceSubstringsAfterOffset(&result, 0, kPreTestPrefix, std::string()); |
| 67 return result; | 67 return result; |
| 68 } | 68 } |
| 69 | 69 |
| 70 void PrintUsage() { | 70 void PrintUsage() { |
| 71 fprintf(stdout, | 71 fprintf(stdout, |
| 72 "Runs tests using the gtest framework, each test being run in its own\n" | 72 "Runs tests using the gtest framework, each batch of tests being\n" |
| 73 "process. Any gtest flags can be specified.\n" | 73 "run in their own process. Supported command-line flags:\n" |
| 74 " --single_process\n" | 74 "\n" |
| 75 " Runs the tests and the launcher in the same process. Useful for \n" | 75 " Common flags:\n" |
| 76 " debugging a specific test in a debugger.\n" | 76 " --gtest_filter=...\n" |
| 77 " --single-process\n" | 77 " Runs a subset of tests (see --gtest_help for more info).\n" |
| 78 " Same as above, and also runs Chrome in single-process mode.\n" | 78 "\n" |
| 79 " --help\n" | 79 " --help\n" |
| 80 " Shows this message.\n" | 80 " Shows this message.\n" |
| 81 " --gtest_help\n" | 81 "\n" |
| 82 " Shows the gtest help message.\n"); | 82 " --gtest_help\n" |
| 83 " Shows the gtest help message.\n" |
| 84 "\n" |
| 85 " --test-launcher-jobs=N\n" |
| 86 " Sets the number of parallel test jobs to N.\n" |
| 87 "\n" |
| 88 " --single_process\n" |
| 89 " Runs the tests and the launcher in the same process. Useful\n" |
| 90 " for debugging a specific test in a debugger.\n" |
| 91 "\n" |
| 92 " Other flags:\n" |
| 93 " --test-launcher-retry-limit=N\n" |
| 94 " Sets the limit of test retries on failures to N.\n" |
| 95 "\n" |
| 96 " --test-launcher-summary-output=PATH\n" |
| 97 " Saves a JSON machine-readable summary of the run.\n" |
| 98 "\n" |
| 99 " --test-launcher-print-test-stdio=auto|always|never\n" |
| 100 " Controls when full test output is printed.\n" |
| 101 " auto means to print it when the test failed.\n" |
| 102 "\n" |
| 103 " --test-launcher-total-shards=N\n" |
| 104 " Sets the total number of shards to N.\n" |
| 105 "\n" |
| 106 " --test-launcher-shard-index=N\n" |
| 107 " Sets the shard index to run to N (from 0 to TOTAL - 1).\n"); |
| 83 } | 108 } |
| 84 | 109 |
| 85 // Implementation of base::TestLauncherDelegate. This is also a test launcher, | 110 // Implementation of base::TestLauncherDelegate. This is also a test launcher, |
| 86 // wrapping a lower-level test launcher with content-specific code. | 111 // wrapping a lower-level test launcher with content-specific code. |
| 87 class WrapperTestLauncherDelegate : public base::TestLauncherDelegate { | 112 class WrapperTestLauncherDelegate : public base::TestLauncherDelegate { |
| 88 public: | 113 public: |
| 89 explicit WrapperTestLauncherDelegate( | 114 explicit WrapperTestLauncherDelegate( |
| 90 content::TestLauncherDelegate* launcher_delegate) | 115 content::TestLauncherDelegate* launcher_delegate) |
| 91 : launcher_delegate_(launcher_delegate) { | 116 : launcher_delegate_(launcher_delegate) { |
| 92 CHECK(temp_dir_.CreateUniqueTempDir()); | 117 CHECK(temp_dir_.CreateUniqueTempDir()); |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 base::TestLauncher launcher(&delegate, default_jobs); | 520 base::TestLauncher launcher(&delegate, default_jobs); |
| 496 bool success = launcher.Run(argc, argv); | 521 bool success = launcher.Run(argc, argv); |
| 497 return (success ? 0 : 1); | 522 return (success ? 0 : 1); |
| 498 } | 523 } |
| 499 | 524 |
| 500 TestLauncherDelegate* GetCurrentTestLauncherDelegate() { | 525 TestLauncherDelegate* GetCurrentTestLauncherDelegate() { |
| 501 return g_launcher_delegate; | 526 return g_launcher_delegate; |
| 502 } | 527 } |
| 503 | 528 |
| 504 } // namespace content | 529 } // namespace content |
| OLD | NEW |