| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 elif browser == 'ff': | 166 elif browser == 'ff': |
| 167 script_dir = os.path.dirname(os.path.abspath(__file__)) | 167 script_dir = os.path.dirname(os.path.abspath(__file__)) |
| 168 profile = selenium.webdriver.firefox.firefox_profile.FirefoxProfile() | 168 profile = selenium.webdriver.firefox.firefox_profile.FirefoxProfile() |
| 169 profile.set_preference('dom.max_script_run_time', 0) | 169 profile.set_preference('dom.max_script_run_time', 0) |
| 170 profile.set_preference('dom.max_chrome_script_run_time', 0) | 170 profile.set_preference('dom.max_chrome_script_run_time', 0) |
| 171 profile.set_preference('app.update.auto', True) | 171 profile.set_preference('app.update.auto', True) |
| 172 profile.set_preference('app.update.enabled', True) | 172 profile.set_preference('app.update.enabled', True) |
| 173 xpi = os.path.join(script_dir, 'extensions', 'firefox',
'ConsoleCollector.xpi') | 173 xpi = os.path.join(script_dir, 'extensions', 'firefox',
'ConsoleCollector.xpi') |
| 174 profile.add_extension(xpi); | 174 profile.add_extension(xpi); |
| 175 return selenium.webdriver.Firefox(firefox_profile=profile) | 175 return selenium.webdriver.Firefox(firefox_profile=profile) |
| 176 elif browser == 'ie9' and platform.system() == 'Windows': | 176 elif ((browser == 'ie9' or browser == 'ie10') and |
| 177 platform.system() == 'Windows'): |
| 177 return selenium.webdriver.Ie() | 178 return selenium.webdriver.Ie() |
| 178 elif browser == 'safari' and platform.system() == 'Darwin': | 179 elif browser == 'safari' and platform.system() == 'Darwin': |
| 179 # TODO(efortuna): Ensure our preferences (no pop-up blocking) file is the | 180 # TODO(efortuna): Ensure our preferences (no pop-up blocking) file is the |
| 180 # same (Safari auto-deletes when it has too many "crashes," or in our case, | 181 # same (Safari auto-deletes when it has too many "crashes," or in our case, |
| 181 # timeouts). Come up with a less hacky way to do this. | 182 # timeouts). Come up with a less hacky way to do this. |
| 182 backup_safari_prefs = os.path.dirname(__file__) + '/com.apple.Safari.plist' | 183 backup_safari_prefs = os.path.dirname(__file__) + '/com.apple.Safari.plist' |
| 183 if os.path.exists(backup_safari_prefs): | 184 if os.path.exists(backup_safari_prefs): |
| 184 shutil.copy(backup_safari_prefs, | 185 shutil.copy(backup_safari_prefs, |
| 185 '/Library/Preferences/com.apple.Safari.plist') | 186 '/Library/Preferences/com.apple.Safari.plist') |
| 186 sel = selenium.selenium('localhost', 4444, "*safari", 'file://' + html_out) | 187 sel = selenium.selenium('localhost', 4444, "*safari", 'file://' + html_out) |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 browser = start_browser(browser_name, executable_path, html_out) | 338 browser = start_browser(browser_name, executable_path, html_out) |
| 338 | 339 |
| 339 try: | 340 try: |
| 340 output = run_test_in_browser(browser, html_out, timeout, mode) | 341 output = run_test_in_browser(browser, html_out, timeout, mode) |
| 341 return report_results(mode, output, browser) | 342 return report_results(mode, output, browser) |
| 342 finally: | 343 finally: |
| 343 close_browser(browser) | 344 close_browser(browser) |
| 344 | 345 |
| 345 if __name__ == "__main__": | 346 if __name__ == "__main__": |
| 346 sys.exit(main(sys.argv)) | 347 sys.exit(main(sys.argv)) |
| OLD | NEW |