Index: chrome/tools/crash_service/crash_service.cc |
diff --git a/chrome/tools/crash_service/crash_service.cc b/chrome/tools/crash_service/crash_service.cc |
index ed311070389804bec1f9b104a27e0e0fca5b8a07..660a8882c716fd04baf6b537c4848928a4e604f2 100644 |
--- a/chrome/tools/crash_service/crash_service.cc |
+++ b/chrome/tools/crash_service/crash_service.cc |
@@ -149,6 +149,8 @@ struct DumpJobInfo { |
const char CrashService::kMaxReports[] = "max-reports"; |
const char CrashService::kNoWindow[] = "no-window"; |
const char CrashService::kReporterTag[] = "reporter"; |
+const char CrashService::kDumpsDir[] = "dumps-dir"; |
+const char CrashService::kPipeName[] = "pipe-name"; |
CrashService::CrashService(const std::wstring& report_dir) |
: report_path_(report_dir), |
@@ -172,7 +174,7 @@ bool CrashService::Initialize(const std::wstring& command_line) { |
using google_breakpad::CrashReportSender; |
using google_breakpad::CrashGenerationServer; |
- const wchar_t* pipe_name = kTestPipeName; |
+ std::wstring pipe_name = kTestPipeName; |
int max_reports = -1; |
// The checkpoint file allows CrashReportSender to enforce the the maximum |
@@ -189,18 +191,26 @@ bool CrashService::Initialize(const std::wstring& command_line) { |
} |
report_path_ = user_data_dir.Append(chrome::kCrashReportLog); |
+ CommandLine cmd_line = CommandLine::FromString(command_line); |
+ |
FilePath dumps_path; |
- if (!PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path)) { |
- LOG(ERROR) << "could not get DIR_CRASH_DUMPS"; |
- return false; |
+ if (cmd_line.HasSwitch(kDumpsDir)) { |
+ dumps_path = FilePath(cmd_line.GetSwitchValueNative(kDumpsDir)); |
+ } else { |
+ if (!PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path)) { |
+ LOG(ERROR) << "could not get DIR_CRASH_DUMPS"; |
+ return false; |
+ } |
} |
- CommandLine cmd_line = CommandLine::FromString(command_line); |
- |
// We can override the send reports quota with a command line switch. |
if (cmd_line.HasSwitch(kMaxReports)) |
max_reports = _wtoi(cmd_line.GetSwitchValueNative(kMaxReports).c_str()); |
+ // Allow the global pipe name to be overridden for better testability. |
+ if (cmd_line.HasSwitch(kPipeName)) |
+ pipe_name = cmd_line.GetSwitchValueNative(kPipeName); |
+ |
if (max_reports > 0) { |
// Create the http sender object. |
sender_ = new CrashReportSender(checkpoint_path.value()); |