OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 #include "base/test/test_suite.h" | 10 #include "base/test/test_suite.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 59 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
60 // Construct the new command line. Strip out gtest_output flag if | 60 // Construct the new command line. Strip out gtest_output flag if |
61 // it has been given because otherwise each test outputs the same file | 61 // it has been given because otherwise each test outputs the same file |
62 // over and over overriding the previous one every time. | 62 // over and over overriding the previous one every time. |
63 // We will generate the final output file later in RunTests(). | 63 // We will generate the final output file later in RunTests(). |
64 CommandLine new_cmd_line(cmd_line->GetProgram()); | 64 CommandLine new_cmd_line(cmd_line->GetProgram()); |
65 CommandLine::SwitchMap switches = cmd_line->GetSwitches(); | 65 CommandLine::SwitchMap switches = cmd_line->GetSwitches(); |
66 switches.erase(kGTestOutputFlag); | 66 switches.erase(kGTestOutputFlag); |
67 for (CommandLine::SwitchMap::const_iterator iter = switches.begin(); | 67 for (CommandLine::SwitchMap::const_iterator iter = switches.begin(); |
68 iter != switches.end(); ++iter) { | 68 iter != switches.end(); ++iter) { |
69 new_cmd_line.AppendSwitchWithValue((*iter).first, (*iter).second); | 69 new_cmd_line.AppendSwitchNative((*iter).first, (*iter).second); |
70 } | 70 } |
71 | 71 |
72 // Always enable disabled tests. This method is not called with disabled | 72 // Always enable disabled tests. This method is not called with disabled |
73 // tests unless this flag was specified to the browser test executable. | 73 // tests unless this flag was specified to the browser test executable. |
74 new_cmd_line.AppendSwitch("gtest_also_run_disabled_tests"); | 74 new_cmd_line.AppendSwitch("gtest_also_run_disabled_tests"); |
75 new_cmd_line.AppendSwitchWithValue("gtest_filter", test_name); | 75 new_cmd_line.AppendSwitchASCII("gtest_filter", test_name); |
76 new_cmd_line.AppendSwitch(kChildProcessFlag); | 76 new_cmd_line.AppendSwitch(kChildProcessFlag); |
77 | 77 |
78 // Do not let the child ignore failures. We need to propagate the | 78 // Do not let the child ignore failures. We need to propagate the |
79 // failure status back to the parent. | 79 // failure status back to the parent. |
80 new_cmd_line.AppendSwitch(kStrictFailureHandling); | 80 new_cmd_line.AppendSwitch(kStrictFailureHandling); |
81 | 81 |
82 base::ProcessHandle process_handle; | 82 base::ProcessHandle process_handle; |
83 if (!base::LaunchApp(new_cmd_line, false, false, &process_handle)) | 83 if (!base::LaunchApp(new_cmd_line, false, false, &process_handle)) |
84 return false; | 84 return false; |
85 | 85 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 "Starting tests...\n" | 201 "Starting tests...\n" |
202 "IMPORTANT DEBUGGING NOTE: each test is run inside its own process.\n" | 202 "IMPORTANT DEBUGGING NOTE: each test is run inside its own process.\n" |
203 "For debugging a test inside a debugger, use the\n" | 203 "For debugging a test inside a debugger, use the\n" |
204 "--gtest_filter=<your_test_name> flag along with either\n" | 204 "--gtest_filter=<your_test_name> flag along with either\n" |
205 "--single_process (to run all tests in one launcher/browser process) or\n" | 205 "--single_process (to run all tests in one launcher/browser process) or\n" |
206 "--single-process (to do the above, and also run Chrome in single-\n" | 206 "--single-process (to do the above, and also run Chrome in single-\n" |
207 "process mode).\n"); | 207 "process mode).\n"); |
208 OutOfProcTestRunnerFactory test_runner_factory; | 208 OutOfProcTestRunnerFactory test_runner_factory; |
209 return tests::RunTests(test_runner_factory) ? 0 : 1; | 209 return tests::RunTests(test_runner_factory) ? 0 : 1; |
210 } | 210 } |
OLD | NEW |