OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/test/webdriver/webdriver_automation.h" | 5 #include "chrome/test/webdriver/webdriver_automation.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 } | 330 } |
331 }; | 331 }; |
332 | 332 |
333 } // namespace | 333 } // namespace |
334 | 334 |
335 namespace webdriver { | 335 namespace webdriver { |
336 | 336 |
337 Automation::BrowserOptions::BrowserOptions() | 337 Automation::BrowserOptions::BrowserOptions() |
338 : command(CommandLine::NO_PROGRAM), | 338 : command(CommandLine::NO_PROGRAM), |
339 detach_process(false), | 339 detach_process(false), |
340 ignore_certificate_errors(false), | 340 ignore_certificate_errors(false) {} |
341 disable_popup_blocking(false) {} | |
342 | 341 |
343 Automation::BrowserOptions::~BrowserOptions() {} | 342 Automation::BrowserOptions::~BrowserOptions() {} |
344 | 343 |
345 Automation::Automation(const Logger& logger) | 344 Automation::Automation(const Logger& logger) |
346 : logger_(logger), | 345 : logger_(logger), |
347 build_no_(0) {} | 346 build_no_(0) {} |
348 | 347 |
349 Automation::~Automation() {} | 348 Automation::~Automation() {} |
350 | 349 |
351 void Automation::Init( | 350 void Automation::Init( |
352 const BrowserOptions& options, | 351 const BrowserOptions& options, |
353 int* build_no, | 352 int* build_no, |
354 Error** error) { | 353 Error** error) { |
355 // Prepare Chrome's command line. | 354 // Prepare Chrome's command line. |
356 CommandLine command(CommandLine::NO_PROGRAM); | 355 CommandLine command(CommandLine::NO_PROGRAM); |
357 if (CommandLine::ForCurrentProcess()->HasSwitch("no-sandbox")) { | 356 if (CommandLine::ForCurrentProcess()->HasSwitch("no-sandbox")) { |
358 command.AppendSwitch(switches::kNoSandbox); | 357 command.AppendSwitch(switches::kNoSandbox); |
359 } | 358 } |
360 command.AppendSwitch(switches::kDisableHangMonitor); | 359 command.AppendSwitch(switches::kDisableHangMonitor); |
361 command.AppendSwitch(switches::kDisablePromptOnRepost); | 360 command.AppendSwitch(switches::kDisablePromptOnRepost); |
362 command.AppendSwitch(switches::kDomAutomationController); | 361 command.AppendSwitch(switches::kDomAutomationController); |
363 command.AppendSwitch(switches::kFullMemoryCrashReport); | 362 command.AppendSwitch(switches::kFullMemoryCrashReport); |
364 command.AppendSwitch(switches::kNoDefaultBrowserCheck); | 363 command.AppendSwitch(switches::kNoDefaultBrowserCheck); |
365 command.AppendSwitch(switches::kNoFirstRun); | 364 command.AppendSwitch(switches::kNoFirstRun); |
366 if (options.detach_process) | 365 if (options.detach_process) |
367 command.AppendSwitch(switches::kAutomationReinitializeOnChannelError); | 366 command.AppendSwitch(switches::kAutomationReinitializeOnChannelError); |
368 if (options.ignore_certificate_errors) | 367 if (options.ignore_certificate_errors) |
369 command.AppendSwitch(switches::kIgnoreCertificateErrors); | 368 command.AppendSwitch(switches::kIgnoreCertificateErrors); |
370 if (options.disable_popup_blocking) | |
371 command.AppendSwitch(switches::kDisablePopupBlocking); | |
372 if (options.user_data_dir.empty()) | 369 if (options.user_data_dir.empty()) |
373 command.AppendSwitchASCII(switches::kHomePage, chrome::kAboutBlankURL); | 370 command.AppendSwitchASCII(switches::kHomePage, chrome::kAboutBlankURL); |
374 | 371 |
375 command.AppendArguments(options.command, true /* include_program */); | 372 command.AppendArguments(options.command, true /* include_program */); |
376 | 373 |
377 // Find the Chrome binary. | 374 // Find the Chrome binary. |
378 if (command.GetProgram().empty()) { | 375 if (command.GetProgram().empty()) { |
379 FilePath browser_exe; | 376 FilePath browser_exe; |
380 if (!GetDefaultChromeExe(&browser_exe)) { | 377 if (!GetDefaultChromeExe(&browser_exe)) { |
381 *error = new Error(kUnknownError, "Could not find default Chrome binary"); | 378 *error = new Error(kUnknownError, "Could not find default Chrome binary"); |
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1192 } | 1189 } |
1193 | 1190 |
1194 Error* Automation::CheckMaximizeSupported() { | 1191 Error* Automation::CheckMaximizeSupported() { |
1195 const char* message = | 1192 const char* message = |
1196 "Maximize automation interface is not supported for this version of " | 1193 "Maximize automation interface is not supported for this version of " |
1197 "Chrome."; | 1194 "Chrome."; |
1198 return CheckVersion(1160, message); | 1195 return CheckVersion(1160, message); |
1199 } | 1196 } |
1200 | 1197 |
1201 } // namespace webdriver | 1198 } // namespace webdriver |
OLD | NEW |