| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 # TODO(efortuna): Put this back up to be more than the default timeout in | 120 # TODO(efortuna): Put this back up to be more than the default timeout in |
| 121 # test.dart. Right now it needs to be less than 60 so that when test.dart | 121 # test.dart. Right now it needs to be less than 60 so that when test.dart |
| 122 # times out, this script also closes the browser windows. | 122 # times out, this script also closes the browser windows. |
| 123 parser.add_option('--timeout', dest = 'timeout', | 123 parser.add_option('--timeout', dest = 'timeout', |
| 124 help = 'Amount of time (seconds) to wait before timeout', type = 'int', | 124 help = 'Amount of time (seconds) to wait before timeout', type = 'int', |
| 125 action = 'store', default=58) | 125 action = 'store', default=58) |
| 126 parser.add_option('--mode', dest = 'mode', | 126 parser.add_option('--mode', dest = 'mode', |
| 127 help = 'The type of test we are running', | 127 help = 'The type of test we are running', |
| 128 action = 'store', default='correctness') | 128 action = 'store', default='correctness') |
| 129 args, _ = parser.parse_args(args=args) | 129 args, _ = parser.parse_args(args=args) |
| 130 args.out = args.out.strip('"') |
| 130 if args.executable and args.browser != 'dartium': | 131 if args.executable and args.browser != 'dartium': |
| 131 print 'Executable path only supported when browser=dartium.' | 132 print 'Executable path only supported when browser=dartium.' |
| 132 sys.exit(1) | 133 sys.exit(1) |
| 133 return args.out, args.browser, args.executable, args.timeout, args.mode | 134 return args.out, args.browser, args.executable, args.timeout, args.mode |
| 134 | 135 |
| 135 def start_browser(browser, executable_path, html_out): | 136 def start_browser(browser, executable_path, html_out): |
| 136 if browser == 'chrome': | 137 if browser == 'chrome': |
| 137 # Note: you need ChromeDriver *in your path* to run Chrome, in addition to | 138 # Note: you need ChromeDriver *in your path* to run Chrome, in addition to |
| 138 # installing Chrome. Also note that the build bot runs have a different path | 139 # installing Chrome. Also note that the build bot runs have a different path |
| 139 # from a normal user -- check the build logs. | 140 # from a normal user -- check the build logs. |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 browser = start_browser(browser_name, executable_path, html_out) | 306 browser = start_browser(browser_name, executable_path, html_out) |
| 306 | 307 |
| 307 try: | 308 try: |
| 308 output = run_test_in_browser(browser, html_out, timeout, mode) | 309 output = run_test_in_browser(browser, html_out, timeout, mode) |
| 309 return report_results(mode, output) | 310 return report_results(mode, output) |
| 310 finally: | 311 finally: |
| 311 close_browser(browser) | 312 close_browser(browser) |
| 312 | 313 |
| 313 if __name__ == "__main__": | 314 if __name__ == "__main__": |
| 314 sys.exit(main(sys.argv)) | 315 sys.exit(main(sys.argv)) |
| OLD | NEW |