| 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 <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 | 433 |
| 434 for (CommandLine::SwitchMap::const_iterator iter = switches.begin(); | 434 for (CommandLine::SwitchMap::const_iterator iter = switches.begin(); |
| 435 iter != switches.end(); ++iter) { | 435 iter != switches.end(); ++iter) { |
| 436 new_cmd_line.AppendSwitchNative((*iter).first, (*iter).second); | 436 new_cmd_line.AppendSwitchNative((*iter).first, (*iter).second); |
| 437 } | 437 } |
| 438 | 438 |
| 439 // Do not let the child ignore failures. We need to propagate the | 439 // Do not let the child ignore failures. We need to propagate the |
| 440 // failure status back to the parent. | 440 // failure status back to the parent. |
| 441 new_cmd_line.AppendSwitch(base::TestSuite::kStrictFailureHandling); | 441 new_cmd_line.AppendSwitch(base::TestSuite::kStrictFailureHandling); |
| 442 | 442 |
| 443 if (!launcher_delegate->AdjustChildProcessCommandLine(&new_cmd_line)) | 443 ScopedTempDir temp_dir; |
| 444 // Create a new data dir and pass it to the child. |
| 445 if (!temp_dir.CreateUniqueTempDir() || !temp_dir.IsValid()) { |
| 446 LOG(ERROR) << "Error creating temp data directory"; |
| 444 return -1; | 447 return -1; |
| 448 } |
| 449 |
| 450 if (!launcher_delegate->AdjustChildProcessCommandLine(&new_cmd_line, |
| 451 temp_dir.path())) { |
| 452 return -1; |
| 453 } |
| 445 | 454 |
| 446 return RunTestInternal( | 455 return RunTestInternal( |
| 447 test_case, test_name, &new_cmd_line, default_timeout, was_timeout); | 456 test_case, test_name, &new_cmd_line, default_timeout, was_timeout); |
| 448 } | 457 } |
| 449 | 458 |
| 450 bool RunTests(TestLauncherDelegate* launcher_delegate, | 459 bool RunTests(TestLauncherDelegate* launcher_delegate, |
| 451 bool should_shard, | 460 bool should_shard, |
| 452 int total_shards, | 461 int total_shards, |
| 453 int shard_index) { | 462 int shard_index) { |
| 454 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 463 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 cycles--; | 737 cycles--; |
| 729 } | 738 } |
| 730 return exit_code; | 739 return exit_code; |
| 731 } | 740 } |
| 732 | 741 |
| 733 TestLauncherDelegate* GetCurrentTestLauncherDelegate() { | 742 TestLauncherDelegate* GetCurrentTestLauncherDelegate() { |
| 734 return g_launcher_delegate; | 743 return g_launcher_delegate; |
| 735 } | 744 } |
| 736 | 745 |
| 737 } // namespace test_launcher | 746 } // namespace test_launcher |
| OLD | NEW |