| Index: chrome/test/webdriver/automation.cc
|
| diff --git a/chrome/test/webdriver/automation.cc b/chrome/test/webdriver/automation.cc
|
| index 6b2449eb097b4ecae48bef0e1c1e74c09514bc7c..acca8e85ec3ae644d3792eadc62c02275fb470e7 100644
|
| --- a/chrome/test/webdriver/automation.cc
|
| +++ b/chrome/test/webdriver/automation.cc
|
| @@ -184,7 +184,7 @@ bool GetDefaultChromeExe(FilePath* browser_exe) {
|
| namespace webdriver {
|
|
|
| Automation::BrowserOptions::BrowserOptions()
|
| - : cmdline(CommandLine::NO_PROGRAM) {}
|
| + : command(CommandLine::NO_PROGRAM) {}
|
|
|
| Automation::BrowserOptions::~BrowserOptions() {}
|
|
|
| @@ -193,48 +193,51 @@ Automation::Automation() {}
|
| Automation::~Automation() {}
|
|
|
| void Automation::Init(const BrowserOptions& options, Error** error) {
|
| - CommandLine cmdline = options.cmdline;
|
| - if (cmdline.GetProgram().empty()) {
|
| + // Prepare Chrome's command line.
|
| + CommandLine command(CommandLine::NO_PROGRAM);
|
| + command.AppendSwitch(switches::kDisableHangMonitor);
|
| + command.AppendSwitch(switches::kDisablePromptOnRepost);
|
| + command.AppendSwitch(switches::kDomAutomationController);
|
| + command.AppendSwitch(switches::kFullMemoryCrashReport);
|
| + command.AppendSwitch(switches::kNoDefaultBrowserCheck);
|
| + command.AppendSwitch(switches::kNoFirstRun);
|
| + if (options.user_data_dir.empty())
|
| + command.AppendSwitchASCII(switches::kHomePage, chrome::kAboutBlankURL);
|
| +
|
| + command.AppendArguments(options.command, true /* include_program */);
|
| +
|
| + // Find the Chrome binary.
|
| + if (command.GetProgram().empty()) {
|
| FilePath browser_exe;
|
| if (!GetDefaultChromeExe(&browser_exe)) {
|
| *error = new Error(kUnknownError, "Could not find default Chrome binary");
|
| return;
|
| }
|
| - cmdline.SetProgram(browser_exe);
|
| + command.SetProgram(browser_exe);
|
| }
|
| - if (!file_util::PathExists(cmdline.GetProgram())) {
|
| + if (!file_util::PathExists(command.GetProgram())) {
|
| std::string message = base::StringPrintf(
|
| "Could not find Chrome binary at: %" PRFilePath,
|
| - cmdline.GetProgram().value().c_str());
|
| + command.GetProgram().value().c_str());
|
| *error = new Error(kUnknownError, message);
|
| return;
|
| }
|
| std::string chrome_details = base::StringPrintf(
|
| "Using Chrome binary at: %" PRFilePath,
|
| - cmdline.GetProgram().value().c_str());
|
| + command.GetProgram().value().c_str());
|
| LOG(INFO) << chrome_details;
|
|
|
| - cmdline.AppendSwitch(switches::kDisableHangMonitor);
|
| - cmdline.AppendSwitch(switches::kDisablePromptOnRepost);
|
| - cmdline.AppendSwitch(switches::kDomAutomationController);
|
| - cmdline.AppendSwitch(switches::kFullMemoryCrashReport);
|
| - cmdline.AppendSwitch(switches::kNoDefaultBrowserCheck);
|
| - cmdline.AppendSwitch(switches::kNoFirstRun);
|
| -
|
| - if (options.user_data_dir.empty())
|
| - cmdline.AppendSwitchASCII(switches::kHomePage, chrome::kAboutBlankURL);
|
| -
|
| + // Create the ProxyLauncher and launch Chrome.
|
| if (options.channel_id.empty()) {
|
| launcher_.reset(new AnonymousProxyLauncher(false));
|
| } else {
|
| launcher_.reset(new NamedProxyLauncher(options.channel_id, false, false));
|
| }
|
| -
|
| ProxyLauncher::LaunchState launch_props = {
|
| false, // clear_profile
|
| options.user_data_dir, // template_user_data
|
| base::Closure(),
|
| - cmdline,
|
| + command,
|
| true, // include_testing_id
|
| true // show_window
|
| };
|
| @@ -251,6 +254,7 @@ void Automation::Init(const BrowserOptions& options, Error** error) {
|
| LOG(INFO) << "Chrome launched successfully. Version: "
|
| << automation()->server_version();
|
|
|
| + // Check the version of Chrome is compatible with this ChromeDriver.
|
| chrome_details += ", version (" + automation()->server_version() + ")";
|
| int version = 0;
|
| std::string error_msg;
|
|
|