Chromium Code Reviews| Index: chrome/browser/extensions/extension_record_api.cc |
| diff --git a/chrome/browser/extensions/extension_record_api.cc b/chrome/browser/extensions/extension_record_api.cc |
| index 035c7982cee9c116f838e5ae232ee347187190b7..1a1dfbd40f221f09035ce9391a408f4317de8872 100644 |
| --- a/chrome/browser/extensions/extension_record_api.cc |
| +++ b/chrome/browser/extensions/extension_record_api.cc |
| @@ -22,6 +22,8 @@ |
| namespace record = extensions::api::experimental_record; |
| +const FilePath::CharType kFirstRunFile[] = FILE_PATH_LITERAL("First Run"); |
| + |
| ProcessStrategy::~ProcessStrategy() {} |
| void ProductionProcessStrategy::RunProcess(const CommandLine& line) { |
| @@ -32,7 +34,7 @@ void ProductionProcessStrategy::RunProcess(const CommandLine& line) { |
| } |
| RunPageCyclerFunction::RunPageCyclerFunction(ProcessStrategy* strategy) |
| - : base_command_line_(*CommandLine::ForCurrentProcess()), |
| + : repeat_count_(1), base_command_line_(*CommandLine::ForCurrentProcess()), |
| process_strategy_(strategy) {} |
| RunPageCyclerFunction::~RunPageCyclerFunction() {} |
| @@ -96,6 +98,19 @@ void RunPageCyclerFunction::RunTestBrowser() { |
| // Add the user-data-dir switch, since this is common to both call types. |
| line.AppendSwitchPath(switches::kUserDataDir, user_data_dir_); |
| + // Test browsers must run as if they are not in first-run mode, so if |
| + // user_data_dir_ doesn't exist, create it and insert "First Run" file |
| + line.AppendSwitch(switches::kNoFirstRun); |
| + |
| + /* |
|
Aaron Boodman
2012/06/05 04:17:04
Kill dead code.
|
| + if (!file_util::PathExists(user_data_dir_)) { |
| + file_util::CreateDirectory(user_data_dir_); |
| + FilePath firstRunFilePath |
| + = user_data_dir_.Append(FilePath::StringType(kFirstRunFile)); |
| + file_util::WriteFile(firstRunFilePath, "", 0); |
| + } |
| + */ |
| + |
| // Do the same for visit-urls, creating a temp file to communicate the |
| // URL list to the test browser. |
| FilePath url_path; |
| @@ -155,6 +170,7 @@ bool CaptureURLsFunction::ParseJSParameters() { |
| url_contents_ = JoinString(params->urls, '\n'); |
| user_data_dir_ = FilePath::FromUTF8Unsafe(params->cache_directory_path); |
| + repeat_count_ = params->repeat_count; |
| return true; |
| } |
| @@ -162,6 +178,9 @@ bool CaptureURLsFunction::ParseJSParameters() { |
| // CaptureURLsFunction adds "record-mode" to sub-browser call, and returns |
| // just the (possibly empty) error list. |
| void CaptureURLsFunction::AddSwitches(CommandLine* line) { |
| + line->AppendSwitchASCII(switches::kVisitURLsCount, |
| + base::Int64ToString(repeat_count_)); |
| + |
| if (!line->HasSwitch(switches::kRecordMode)) |
| line->AppendSwitch(switches::kRecordMode); |
| } |
| @@ -176,12 +195,11 @@ void CaptureURLsFunction::Finish() { |
| ReplayURLsFunction::ReplayURLsFunction() |
| : RunPageCyclerFunction(new ProductionProcessStrategy()), |
| - repeat_count_(1), run_time_ms_(0) { |
| + run_time_ms_(0) { |
| } |
| ReplayURLsFunction::ReplayURLsFunction(ProcessStrategy* strategy) |
| - : RunPageCyclerFunction(strategy), |
| - repeat_count_(1), run_time_ms_(0) { |
| + : RunPageCyclerFunction(strategy), run_time_ms_(0) { |
| } |
| ReplayURLsFunction::~ReplayURLsFunction() {} |
| @@ -195,10 +213,9 @@ bool ReplayURLsFunction::ParseJSParameters() { |
| url_contents_ = JoinString(params->urls, '\n'); |
| user_data_dir_ = FilePath::FromUTF8Unsafe(params->capture_directory_path); |
| + repeat_count_ = params->repeat_count; |
| if (params->details.get()) { |
| - if (params->details->repeat_count.get()) |
| - repeat_count_ = *params->details->repeat_count; |
| if (params->details->extension_path.get()) |
| extension_path_ = |
| FilePath::FromUTF8Unsafe(*params->details->extension_path); |