| 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 print '>>> TEST PASS' | 312 print '>>> TEST PASS' |
| 313 elif source == TIMEOUT_ERROR_MSG: | 313 elif source == TIMEOUT_ERROR_MSG: |
| 314 print '>>> TEST TIMEOUT' | 314 print '>>> TEST TIMEOUT' |
| 315 else: | 315 else: |
| 316 print '>>> TEST FAIL' | 316 print '>>> TEST FAIL' |
| 317 sys.stdout.flush() | 317 sys.stdout.flush() |
| 318 finally: | 318 finally: |
| 319 sys.stdin.close() | 319 sys.stdin.close() |
| 320 print("Closing browser"); | 320 print("Closing browser"); |
| 321 | 321 |
| 322 def close_output_streams: | 322 def close_output_streams(): |
| 323 sys.stdout.flush() | 323 sys.stdout.flush() |
| 324 sys.stdout.close() | 324 sys.stdout.close() |
| 325 sys.stderr.flush() | 325 sys.stderr.flush() |
| 326 sys.stderr.close() | 326 sys.stderr.close() |
| 327 | 327 |
| 328 def close_and_exit: | 328 def close_and_exit(): |
| 329 print("Timed out waiting for browser to close") | 329 print("Timed out waiting for browser to close") |
| 330 close_output_streams() | 330 close_output_streams() |
| 331 exit(1) | 331 exit(1) |
| 332 | 332 |
| 333 timer = threading.Timer(5.0, close_and_exit) | 333 timer = threading.Timer(5.0, close_and_exit) |
| 334 timer.start() | 334 timer.start() |
| 335 try: | 335 try: |
| 336 close_browser(browser) | 336 close_browser(browser) |
| 337 timer.cancel() | 337 timer.cancel() |
| 338 finally: | 338 finally: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 349 browser = start_browser(browser_name, executable_path, html_out) | 349 browser = start_browser(browser_name, executable_path, html_out) |
| 350 | 350 |
| 351 try: | 351 try: |
| 352 output = run_test_in_browser(browser, html_out, timeout, mode) | 352 output = run_test_in_browser(browser, html_out, timeout, mode) |
| 353 return report_results(mode, output, browser) | 353 return report_results(mode, output, browser) |
| 354 finally: | 354 finally: |
| 355 close_browser(browser) | 355 close_browser(browser) |
| 356 | 356 |
| 357 if __name__ == "__main__": | 357 if __name__ == "__main__": |
| 358 sys.exit(main(sys.argv)) | 358 sys.exit(main(sys.argv)) |
| OLD | NEW |