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

Unified Diff: chrome/browser/chrome_browser_main.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: Refined version with overlooked browsertest also fixed. Created 8 years, 7 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/chrome_browser_main.cc
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index 87d77dbe372f6ccd21b6de9447bf7c8dbab42897..51a661d91d2c6f6a2865ebd5292e5fe0d927090d 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -59,6 +59,7 @@
#include "chrome/browser/net/chrome_net_log.h"
#include "chrome/browser/net/predictor.h"
#include "chrome/browser/notifications/desktop_notification_service.h"
+#include "chrome/browser/page_cycler/page_cycler.h"
#include "chrome/browser/notifications/desktop_notification_service_factory.h"
#include "chrome/browser/plugin_prefs.h"
#include "chrome/browser/prefs/pref_service.h"
@@ -1451,12 +1452,44 @@ void ChromeBrowserMainParts::PreBrowserStart() {
}
void ChromeBrowserMainParts::PostBrowserStart() {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kVisitURLs))
+ RunPageCycler();
+
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PostBrowserStart();
// Allow ProcessSingleton to process messages.
process_singleton_->Unlock();
}
+void ChromeBrowserMainParts::RunPageCycler() {
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+ Browser* browser = BrowserList::GetLastActive();
+ DCHECK(browser);
+ PageCycler* page_cycler = NULL;
+ FilePath input_file =
+ command_line->GetSwitchValuePath(switches::kVisitURLs);
+ if (command_line->HasSwitch(switches::kRecordStats)) {
+ page_cycler = new PageCycler(
+ browser,
+ input_file,
+ input_file.AddExtension(FILE_PATH_LITERAL(".errors")));
+ page_cycler->set_stats_file(
+ command_line->GetSwitchValuePath(switches::kRecordStats));
+ } else {
+ page_cycler = new PageCycler(
+ browser,
+ input_file,
+ input_file.AddExtension(FILE_PATH_LITERAL(".errors")));
+ }
+ int iterations = 1;
+ if (command_line->HasSwitch(switches::kVisitURLsCount)) {
+ CHECK(base::StringToInt(
+ command_line->GetSwitchValueNative(switches::kVisitURLsCount),
+ &iterations));
+ }
+ page_cycler->Run(iterations);
+}
+
int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
// Now that the file thread has been started, start recording.
StartMetricsRecording();

Powered by Google App Engine
This is Rietveld 408576698