Index: content/public/test/test_launcher.cc |
=================================================================== |
--- content/public/test/test_launcher.cc (revision 152131) |
+++ content/public/test/test_launcher.cc (working copy) |
@@ -61,6 +61,10 @@ |
// add a new binary that must be compiled on all builds. |
const char kManualTestPrefix[] = "MANUAL_"; |
+// Tests with this suffix are expected to crash, so it won't count as a failure. |
+// A test that uses this must have a PRE_ prefix. |
+const char kCrashTestSuffix[] = "_CRASH"; |
+ |
TestLauncherDelegate* g_launcher_delegate; |
} |
@@ -331,8 +335,10 @@ |
if (cur_test_name == pre_test_name) { |
int exit_code = RunTestInternal(test_case, pre_test_name, command_line, |
default_timeout, was_timeout); |
- if (exit_code != 0) |
+ if (exit_code != 0 && |
+ !EndsWith(pre_test_name, kCrashTestSuffix, true)) { |
return exit_code; |
+ } |
} |
} |
} |
@@ -440,9 +446,18 @@ |
// failure status back to the parent. |
new_cmd_line.AppendSwitch(base::TestSuite::kStrictFailureHandling); |
- if (!launcher_delegate->AdjustChildProcessCommandLine(&new_cmd_line)) |
+ ScopedTempDir temp_dir; |
+ // Create a new data dir and pass it to the child. |
+ if (!temp_dir.CreateUniqueTempDir() || !temp_dir.IsValid()) { |
+ LOG(ERROR) << "Error creating temp data directory"; |
return -1; |
+ } |
+ if (!launcher_delegate->AdjustChildProcessCommandLine(&new_cmd_line, |
+ temp_dir.path())) { |
+ return -1; |
+ } |
+ |
return RunTestInternal( |
test_case, test_name, &new_cmd_line, default_timeout, was_timeout); |
} |