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" |
11 #include "base/environment.h" | 11 #include "base/environment.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/files/scoped_temp_dir.h" |
13 #include "base/hash_tables.h" | 14 #include "base/hash_tables.h" |
14 #include "base/logging.h" | 15 #include "base/logging.h" |
15 #include "base/memory/linked_ptr.h" | 16 #include "base/memory/linked_ptr.h" |
16 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
17 #include "base/process_util.h" | 18 #include "base/process_util.h" |
18 #include "base/scoped_temp_dir.h" | |
19 #include "base/string_number_conversions.h" | 19 #include "base/string_number_conversions.h" |
20 #include "base/string_util.h" | 20 #include "base/string_util.h" |
21 #include "base/test/test_suite.h" | 21 #include "base/test/test_suite.h" |
22 #include "base/test/test_timeouts.h" | 22 #include "base/test/test_timeouts.h" |
23 #include "base/time.h" | 23 #include "base/time.h" |
24 #include "base/utf_string_conversions.h" | 24 #include "base/utf_string_conversions.h" |
25 #include "content/public/app/content_main.h" | 25 #include "content/public/app/content_main.h" |
26 #include "content/public/app/content_main_delegate.h" | 26 #include "content/public/app/content_main_delegate.h" |
27 #include "content/public/app/startup_helper_win.h" | 27 #include "content/public/app/startup_helper_win.h" |
28 #include "content/public/common/content_switches.h" | 28 #include "content/public/common/content_switches.h" |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 | 441 |
442 for (CommandLine::SwitchMap::const_iterator iter = switches.begin(); | 442 for (CommandLine::SwitchMap::const_iterator iter = switches.begin(); |
443 iter != switches.end(); ++iter) { | 443 iter != switches.end(); ++iter) { |
444 new_cmd_line.AppendSwitchNative((*iter).first, (*iter).second); | 444 new_cmd_line.AppendSwitchNative((*iter).first, (*iter).second); |
445 } | 445 } |
446 | 446 |
447 // Do not let the child ignore failures. We need to propagate the | 447 // Do not let the child ignore failures. We need to propagate the |
448 // failure status back to the parent. | 448 // failure status back to the parent. |
449 new_cmd_line.AppendSwitch(base::TestSuite::kStrictFailureHandling); | 449 new_cmd_line.AppendSwitch(base::TestSuite::kStrictFailureHandling); |
450 | 450 |
451 ScopedTempDir temp_dir; | 451 base::ScopedTempDir temp_dir; |
452 // Create a new data dir and pass it to the child. | 452 // Create a new data dir and pass it to the child. |
453 if (!temp_dir.CreateUniqueTempDir() || !temp_dir.IsValid()) { | 453 if (!temp_dir.CreateUniqueTempDir() || !temp_dir.IsValid()) { |
454 LOG(ERROR) << "Error creating temp data directory"; | 454 LOG(ERROR) << "Error creating temp data directory"; |
455 return -1; | 455 return -1; |
456 } | 456 } |
457 | 457 |
458 if (!launcher_delegate->AdjustChildProcessCommandLine(&new_cmd_line, | 458 if (!launcher_delegate->AdjustChildProcessCommandLine(&new_cmd_line, |
459 temp_dir.path())) { | 459 temp_dir.path())) { |
460 return -1; | 460 return -1; |
461 } | 461 } |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 cycles--; | 773 cycles--; |
774 } | 774 } |
775 return exit_code; | 775 return exit_code; |
776 } | 776 } |
777 | 777 |
778 TestLauncherDelegate* GetCurrentTestLauncherDelegate() { | 778 TestLauncherDelegate* GetCurrentTestLauncherDelegate() { |
779 return g_launcher_delegate; | 779 return g_launcher_delegate; |
780 } | 780 } |
781 | 781 |
782 } // namespace content | 782 } // namespace content |
OLD | NEW |