| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 # test cases pass. | 235 # test cases pass. |
| 236 if 'FAIL' not in source and 'PASS' in source: | 236 if 'FAIL' not in source and 'PASS' in source: |
| 237 print 'Content-Type: text/plain\nPASS' | 237 print 'Content-Type: text/plain\nPASS' |
| 238 return 0 | 238 return 0 |
| 239 else: | 239 else: |
| 240 #The hacky way to get document.getElementById('body').innerHTML for this | 240 #The hacky way to get document.getElementById('body').innerHTML for this |
| 241 # webpage, without the JavaScript. | 241 # webpage, without the JavaScript. |
| 242 #TODO(efortuna): Access these elements in a nicer way using DOM parser. | 242 #TODO(efortuna): Access these elements in a nicer way using DOM parser. |
| 243 index = source.find('<body>') | 243 index = source.find('<body>') |
| 244 index += len('<body>') | 244 index += len('<body>') |
| 245 end_index = source.find('<script') | 245 end_index = source.find('</body') |
| 246 print unicode(source[index : end_index]).encode("utf-8") | 246 print unicode(source[index : end_index]).encode("utf-8") |
| 247 return 1 | 247 return 1 |
| 248 | 248 |
| 249 | 249 |
| 250 def run_batch_tests(): | 250 def run_batch_tests(): |
| 251 ''' | 251 ''' |
| 252 Runs a batch of in-browser tests in the same browser process. Batching | 252 Runs a batch of in-browser tests in the same browser process. Batching |
| 253 gives faster throughput and makes tests less subject to browser starting | 253 gives faster throughput and makes tests less subject to browser starting |
| 254 flakiness, issues with too many browser processes running, etc. | 254 flakiness, issues with too many browser processes running, etc. |
| 255 | 255 |
| (...skipping 73 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 |