Index: chrome/browser/chrome_browser_main.cc |
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc |
index 0956c90b6bcefb1b99207d169e15e42ca7950048..e05723bea76f1770f530a8c0fd7a52efd21e9719 100644 |
--- a/chrome/browser/chrome_browser_main.cc |
+++ b/chrome/browser/chrome_browser_main.cc |
@@ -58,6 +58,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" |
@@ -1362,12 +1363,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.ReplaceExtension(".errors"), |
+ command_line->GetSwitchValuePath(switches::kRecordStats)); |
+ } else { |
+ page_cycler = new PageCycler(browser, |
+ input_file, |
+ input_file.ReplaceExtension(".errors")); |
+ } |
+ if (command_line->HasSwitch(switches::kVisitURLsCount)) { |
+ unsigned int iterations = 0; |
Aaron Boodman
2012/03/20 19:28:16
We don't use unsigned integers in Chrome, except f
|
+ CHECK(base::StringToUint( |
+ command_line->GetSwitchValueNative(switches::kVisitURLsCount), |
+ &iterations)); |
+ page_cycler->Run(iterations); |
Aaron Boodman
2012/03/20 19:28:16
Nit: define interations outside the check for kVis
|
+ } else { |
+ page_cycler->Run(1); |
+ } |
+} |
+ |
int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { |
// Now that the file thread has been started, start recording. |
StartMetricsRecording(); |