| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 if args.executable and args.browser != 'dartium': | 128 if args.executable and args.browser != 'dartium': |
| 129 print 'Executable path only supported when browser=dartium.' | 129 print 'Executable path only supported when browser=dartium.' |
| 130 sys.exit(1) | 130 sys.exit(1) |
| 131 return args.out, args.browser, args.executable, args.timeout, args.mode | 131 return args.out, args.browser, args.executable, args.timeout, args.mode |
| 132 | 132 |
| 133 def print_server_error(): | 133 def print_server_error(): |
| 134 """Provide the user an informative error message if we attempt to connect to | 134 """Provide the user an informative error message if we attempt to connect to |
| 135 the Selenium remote control server, but cannot access it. Then exit the | 135 the Selenium remote control server, but cannot access it. Then exit the |
| 136 program.""" | 136 program.""" |
| 137 print ('ERROR: Could not connect to Selenium RC server. Are you running' | 137 print ('ERROR: Could not connect to Selenium RC server. Are you running' |
| 138 ' java -jar selenium-server-standalone-*.jar? If not, start ' | 138 ' java -jar tools/testing/selenium-server-standalone-*.jar? If not, ' |
| 139 'it before running this test.') | 139 'start it before running this test.') |
| 140 sys.exit(1) | 140 sys.exit(1) |
| 141 | 141 |
| 142 def start_browser(browser, executable_path, html_out): | 142 def start_browser(browser, executable_path, html_out): |
| 143 if browser == 'chrome': | 143 if browser == 'chrome': |
| 144 # Note: you need ChromeDriver *in your path* to run Chrome, in addition to | 144 # Note: you need ChromeDriver *in your path* to run Chrome, in addition to |
| 145 # installing Chrome. Also note that the build bot runs have a different path | 145 # installing Chrome. Also note that the build bot runs have a different path |
| 146 # from a normal user -- check the build logs. | 146 # from a normal user -- check the build logs. |
| 147 return selenium.webdriver.Chrome() | 147 return selenium.webdriver.Chrome() |
| 148 elif browser == 'dartium': | 148 elif browser == 'dartium': |
| 149 script_dir = os.path.dirname(os.path.abspath(__file__)) | 149 script_dir = os.path.dirname(os.path.abspath(__file__)) |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 browser = start_browser(browser_name, executable_path, html_out) | 329 browser = start_browser(browser_name, executable_path, html_out) |
| 330 | 330 |
| 331 try: | 331 try: |
| 332 output = run_test_in_browser(browser, html_out, timeout, mode) | 332 output = run_test_in_browser(browser, html_out, timeout, mode) |
| 333 return report_results(mode, output) | 333 return report_results(mode, output) |
| 334 finally: | 334 finally: |
| 335 close_browser(browser) | 335 close_browser(browser) |
| 336 | 336 |
| 337 if __name__ == "__main__": | 337 if __name__ == "__main__": |
| 338 sys.exit(main(sys.argv)) | 338 sys.exit(main(sys.argv)) |
| OLD | NEW |