Prevent hanging if selenium cannot close browser.

Review URL: https://codereview.chromium.org//11275125

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14511 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
ahe@google.com
2012-11-05 06:17:33 +00:00
parent 9f1fa8b10e
commit a57b4fbf71
+20 -1
View File
@@ -40,6 +40,7 @@ import socket
import sys
import time
import urllib2
import threading
TIMEOUT_ERROR_MSG = 'FAIL (timeout)'
@@ -315,9 +316,27 @@ def run_batch_tests():
print '>>> TEST FAIL'
sys.stdout.flush()
finally:
sys.stdin.close()
print("Closing browser");
close_browser(browser)
def close_output_streams:
sys.stdout.flush()
sys.stdout.close()
sys.stderr.flush()
sys.stderr.close()
def close_and_exit:
print("Timed out waiting for browser to close")
close_output_streams()
exit(1)
timer = threading.Timer(5.0, close_and_exit)
timer.start()
try:
close_browser(browser)
timer.cancel()
finally:
close_output_streams()
def main(args):
# Run in batch mode if the --batch flag is passed.