| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 backup_safari_prefs = os.path.dirname(__file__) + '/com.apple.Safari.plist' | 136 backup_safari_prefs = os.path.dirname(__file__) + '/com.apple.Safari.plist' |
| 137 if os.path.exists(backup_safari_prefs): | 137 if os.path.exists(backup_safari_prefs): |
| 138 shutil.copy(backup_safari_prefs, | 138 shutil.copy(backup_safari_prefs, |
| 139 '/Library/Preferences/com.apple.Safari.plist') | 139 '/Library/Preferences/com.apple.Safari.plist') |
| 140 sel = selenium.selenium('localhost', 4444, "*safari", 'file://' + html_out) | 140 sel = selenium.selenium('localhost', 4444, "*safari", 'file://' + html_out) |
| 141 try: | 141 try: |
| 142 sel.start() | 142 sel.start() |
| 143 return sel | 143 return sel |
| 144 except socket.error: | 144 except socket.error: |
| 145 print 'ERROR: Could not connect to Selenium RC server. Are you running' +\ | 145 print 'ERROR: Could not connect to Selenium RC server. Are you running' +\ |
| 146 ' java -jar selenium-server-standalone-2.15.0.jar? If not, start ' + \ | 146 ' java -jar selenium-server-standalone-*.jar? If not, start ' + \ |
| 147 'it before running this test.' | 147 'it before running this test.' |
| 148 sys.exit(1) | 148 sys.exit(1) |
| 149 else: | 149 else: |
| 150 raise Exception('Incompatible browser and platform combination.') | 150 raise Exception('Incompatible browser and platform combination.') |
| 151 | 151 |
| 152 def close_browser(browser): | 152 def close_browser(browser): |
| 153 if browser is None: | 153 if browser is None: |
| 154 return | 154 return |
| 155 if isinstance(browser, selenium.selenium): | 155 if isinstance(browser, selenium.selenium): |
| 156 browser.stop() | 156 browser.stop() |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 browser = start_browser(browser_name, html_out) | 271 browser = start_browser(browser_name, html_out) |
| 272 | 272 |
| 273 try: | 273 try: |
| 274 output = run_test_in_browser(browser, html_out, timeout, is_perf) | 274 output = run_test_in_browser(browser, html_out, timeout, is_perf) |
| 275 return report_results(is_perf, output) | 275 return report_results(is_perf, output) |
| 276 finally: | 276 finally: |
| 277 close_browser(browser) | 277 close_browser(browser) |
| 278 | 278 |
| 279 if __name__ == "__main__": | 279 if __name__ == "__main__": |
| 280 sys.exit(main(sys.argv)) | 280 sys.exit(main(sys.argv)) |
| OLD | NEW |