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 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/linked_ptr.h" | 10 #include "base/linked_ptr.h" |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 // Create a new user data dir and pass it to the child. | 268 // Create a new user data dir and pass it to the child. |
269 ScopedTempDir temp_dir; | 269 ScopedTempDir temp_dir; |
270 if (!temp_dir.CreateUniqueTempDir() || !temp_dir.IsValid()) { | 270 if (!temp_dir.CreateUniqueTempDir() || !temp_dir.IsValid()) { |
271 LOG(ERROR) << "Error creating temp profile directory"; | 271 LOG(ERROR) << "Error creating temp profile directory"; |
272 return false; | 272 return false; |
273 } | 273 } |
274 new_cmd_line.AppendSwitchPath(switches::kUserDataDir, temp_dir.path()); | 274 new_cmd_line.AppendSwitchPath(switches::kUserDataDir, temp_dir.path()); |
275 | 275 |
276 base::ProcessHandle process_handle; | 276 base::ProcessHandle process_handle; |
277 #if defined(OS_POSIX) | 277 #if defined(OS_POSIX) |
| 278 const char* browser_wrapper = getenv("BROWSER_WRAPPER"); |
| 279 if (browser_wrapper) { |
| 280 new_cmd_line.PrependWrapper(browser_wrapper); |
| 281 VLOG(1) << "BROWSER_WRAPPER was set, prefixing command_line with " |
| 282 << browser_wrapper; |
| 283 } |
| 284 |
278 // On POSIX, we launch the test in a new process group with pgid equal to | 285 // On POSIX, we launch the test in a new process group with pgid equal to |
279 // its pid. Any child processes that the test may create will inherit the | 286 // its pid. Any child processes that the test may create will inherit the |
280 // same pgid. This way, if the test is abruptly terminated, we can clean up | 287 // same pgid. This way, if the test is abruptly terminated, we can clean up |
281 // any orphaned child processes it may have left behind. | 288 // any orphaned child processes it may have left behind. |
282 base::environment_vector no_env; | 289 base::environment_vector no_env; |
283 base::file_handle_mapping_vector no_files; | 290 base::file_handle_mapping_vector no_files; |
284 if (!base::LaunchAppInNewProcessGroup(new_cmd_line.argv(), no_env, no_files, | 291 if (!base::LaunchAppInNewProcessGroup(new_cmd_line.argv(), no_env, no_files, |
285 false, &process_handle)) | 292 false, &process_handle)) |
286 return false; | 293 return false; |
287 #else | 294 #else |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 exit_code = 1; | 506 exit_code = 1; |
500 break; | 507 break; |
501 } | 508 } |
502 | 509 |
503 // Special value "-1" means "repeat indefinitely". | 510 // Special value "-1" means "repeat indefinitely". |
504 if (cycles != -1) | 511 if (cycles != -1) |
505 cycles--; | 512 cycles--; |
506 } | 513 } |
507 return exit_code; | 514 return exit_code; |
508 } | 515 } |
OLD | NEW |