| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
| 5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
| 6 # | 6 # |
| 7 | 7 |
| 8 """Script to actually open a browser and perform the test, and reports back with | 8 """Script to actually open a browser and perform the test, and reports back with |
| 9 the result. It uses Selenium WebDriver when possible for running the tests. It | 9 the result. It uses Selenium WebDriver when possible for running the tests. It |
| 10 uses Selenium RC for Safari. | 10 uses Selenium RC for Safari. |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 elif platform.system() == 'Darwin': | 160 elif platform.system() == 'Darwin': |
| 161 options.binary_location = os.path.join(dartium_dir, 'Chromium.app', | 161 options.binary_location = os.path.join(dartium_dir, 'Chromium.app', |
| 162 'Contents', 'MacOS', 'Chromium') | 162 'Contents', 'MacOS', 'Chromium') |
| 163 else: | 163 else: |
| 164 options.binary_location = os.path.join(dartium_dir, 'chrome') | 164 options.binary_location = os.path.join(dartium_dir, 'chrome') |
| 165 return selenium.webdriver.Chrome(chrome_options=options) | 165 return selenium.webdriver.Chrome(chrome_options=options) |
| 166 elif browser == 'ff': | 166 elif browser == 'ff': |
| 167 profile = selenium.webdriver.firefox.firefox_profile.FirefoxProfile() | 167 profile = selenium.webdriver.firefox.firefox_profile.FirefoxProfile() |
| 168 profile.set_preference('dom.max_script_run_time', 0) | 168 profile.set_preference('dom.max_script_run_time', 0) |
| 169 profile.set_preference('dom.max_chrome_script_run_time', 0) | 169 profile.set_preference('dom.max_chrome_script_run_time', 0) |
| 170 profile.set_preference('app.update.auto', True) |
| 171 profile.set_preference('app.update.enabled', True) |
| 170 return selenium.webdriver.Firefox(firefox_profile=profile) | 172 return selenium.webdriver.Firefox(firefox_profile=profile) |
| 171 elif browser == 'ie' and platform.system() == 'Windows': | 173 elif browser == 'ie' and platform.system() == 'Windows': |
| 172 return selenium.webdriver.Ie() | 174 return selenium.webdriver.Ie() |
| 173 elif browser == 'safari' and platform.system() == 'Darwin': | 175 elif browser == 'safari' and platform.system() == 'Darwin': |
| 174 # TODO(efortuna): Ensure our preferences (no pop-up blocking) file is the | 176 # TODO(efortuna): Ensure our preferences (no pop-up blocking) file is the |
| 175 # same (Safari auto-deletes when it has too many "crashes," or in our case, | 177 # same (Safari auto-deletes when it has too many "crashes," or in our case, |
| 176 # timeouts). Come up with a less hacky way to do this. | 178 # timeouts). Come up with a less hacky way to do this. |
| 177 backup_safari_prefs = os.path.dirname(__file__) + '/com.apple.Safari.plist' | 179 backup_safari_prefs = os.path.dirname(__file__) + '/com.apple.Safari.plist' |
| 178 if os.path.exists(backup_safari_prefs): | 180 if os.path.exists(backup_safari_prefs): |
| 179 shutil.copy(backup_safari_prefs, | 181 shutil.copy(backup_safari_prefs, |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 browser = start_browser(browser_name, executable_path, html_out) | 329 browser = start_browser(browser_name, executable_path, html_out) |
| 328 | 330 |
| 329 try: | 331 try: |
| 330 output = run_test_in_browser(browser, html_out, timeout, mode) | 332 output = run_test_in_browser(browser, html_out, timeout, mode) |
| 331 return report_results(mode, output) | 333 return report_results(mode, output) |
| 332 finally: | 334 finally: |
| 333 close_browser(browser) | 335 close_browser(browser) |
| 334 | 336 |
| 335 if __name__ == "__main__": | 337 if __name__ == "__main__": |
| 336 sys.exit(main(sys.argv)) | 338 sys.exit(main(sys.argv)) |
| OLD | NEW |