Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3945)

Unified Diff: chrome/browser/extensions/extension_record_api.cc

Issue 10386134: Record API fix adding FirstRun, and allowing repeat-count in capture (plus some browsertests along … (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Retrying due to patch failure Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..000d24bd9ae48598292a5ad888c304c39e84445a 100644
--- a/chrome/browser/extensions/extension_record_api.cc
+++ b/chrome/browser/extensions/extension_record_api.cc
@@ -32,7 +32,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,8 +96,11 @@ void RunPageCyclerFunction::RunTestBrowser() {
// Add the user-data-dir switch, since this is common to both call types.
line.AppendSwitchPath(switches::kUserDataDir, user_data_dir_);
- // Do the same for visit-urls, creating a temp file to communicate the
- // URL list to the test browser.
+ // Test browsers must run as if they are not in first-run mode
+ line.AppendSwitch(switches::kNoFirstRun);
+
+ // Create and fill a temp file to communicate the URL list to the test
+ // browser.
FilePath url_path;
file_util::CreateTemporaryFile(&url_path);
file_util::WriteFile(url_path, url_contents_.c_str(), url_contents_.size());
@@ -155,6 +158,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 +166,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 +183,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 +201,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);
« no previous file with comments | « chrome/browser/extensions/extension_record_api.h ('k') | chrome/browser/extensions/extension_record_api_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698