OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/test/browser/browser_test_runner.h" | 5 #include "chrome/test/browser/browser_test_runner.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/process_util.h" | 11 #include "base/process_util.h" |
12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 const wchar_t* const kGTestListTestsFlag = L"gtest_list_tests"; | 17 const wchar_t* const kGTestListTestsFlag = L"gtest_list_tests"; |
| 18 const wchar_t* const kGTestRunDisabledTestsFlag = |
| 19 L"gtest_also_run_disabled_tests"; |
18 | 20 |
19 // Retrieves the list of tests to run by running gtest with the | 21 // Retrieves the list of tests to run by running gtest with the |
20 // --gtest_list_tests flag in a forked process and parsing its output. | 22 // --gtest_list_tests flag in a forked process and parsing its output. |
21 // |command_line| should contain the command line used to start the browser | 23 // |command_line| should contain the command line used to start the browser |
22 // test launcher, it is expected that it does not contain the | 24 // test launcher, it is expected that it does not contain the |
23 // --gtest_list_tests flag already. | 25 // --gtest_list_tests flag already. |
24 // Note: we cannot implement this in-process for InProcessBrowserTestRunner as | 26 // Note: we cannot implement this in-process for InProcessBrowserTestRunner as |
25 // GTest prints to the stdout and there are no good way of temporarily | 27 // GTest prints to the stdout and there are no good way of temporarily |
26 // redirecting outputs. | 28 // redirecting outputs. |
27 bool GetTestList(const CommandLine& command_line, | 29 bool GetTestList(const CommandLine& command_line, |
(...skipping 23 matching lines...) Expand all Loading... |
51 std::string line = *iter; | 53 std::string line = *iter; |
52 if (line.empty()) | 54 if (line.empty()) |
53 continue; // Just ignore empty lines if any. | 55 continue; // Just ignore empty lines if any. |
54 | 56 |
55 if (line[line.size() - 1] == '.') { | 57 if (line[line.size() - 1] == '.') { |
56 // This is a new test case. | 58 // This is a new test case. |
57 test_case = line; | 59 test_case = line; |
58 continue; | 60 continue; |
59 } | 61 } |
60 | 62 |
61 if (line.find("DISABLED") != std::string::npos) | 63 if (!command_line.HasSwitch(kGTestRunDisabledTestsFlag) && |
| 64 line.find("DISABLED") != std::string::npos) |
62 continue; // Skip disabled tests. | 65 continue; // Skip disabled tests. |
63 | 66 |
64 // We are dealing with a test. | 67 // We are dealing with a test. |
65 test_list->push_back(test_case + line); | 68 test_list->push_back(test_case + line); |
66 } | 69 } |
67 return true; | 70 return true; |
68 } | 71 } |
69 | 72 |
70 } // namespace | 73 } // namespace |
71 | 74 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 printf("Failing tests:\n"); | 124 printf("Failing tests:\n"); |
122 for (std::vector<std::string>::const_iterator iter = failed_tests.begin(); | 125 for (std::vector<std::string>::const_iterator iter = failed_tests.begin(); |
123 iter != failed_tests.end(); ++iter) { | 126 iter != failed_tests.end(); ++iter) { |
124 printf("%s\n", iter->c_str()); | 127 printf("%s\n", iter->c_str()); |
125 } | 128 } |
126 | 129 |
127 return false; | 130 return false; |
128 } | 131 } |
129 | 132 |
130 } // namespace | 133 } // namespace |
OLD | NEW |