| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 #TODO(efortuna): Access these elements in a nicer way using DOM parser. | 51 #TODO(efortuna): Access these elements in a nicer way using DOM parser. |
| 52 string = '<div id="status">' | 52 string = '<div id="status">' |
| 53 index = source.find(string) | 53 index = source.find(string) |
| 54 end_index = source.find('</div>', index+1) | 54 end_index = source.find('</div>', index+1) |
| 55 source = source[index + len(string):end_index] | 55 source = source[index + len(string):end_index] |
| 56 return 'Score:' in source | 56 return 'Score:' in source |
| 57 | 57 |
| 58 def dromaeo_test_done(source): | 58 def dromaeo_test_done(source): |
| 59 """Tests to see if our performance test is done by printing a score.""" | 59 """Tests to see if our performance test is done by printing a score.""" |
| 60 #TODO(efortuna): Access these elements in a nicer way using DOM parser. | 60 #TODO(efortuna): Access these elements in a nicer way using DOM parser. |
| 61 string = '<span class="left">' | 61 return '<body class="alldone">' in source |
| 62 index = source.find(string) | |
| 63 end_index = source.find('</span>', index+1) | |
| 64 source = source[index + len(string):end_index] | |
| 65 return '0:00' in source | |
| 66 | 62 |
| 67 # TODO(vsm): Ideally, this wouldn't live in this file. | 63 # TODO(vsm): Ideally, this wouldn't live in this file. |
| 68 CONFIGURATIONS = { | 64 CONFIGURATIONS = { |
| 69 'correctness': correctness_test_done, | 65 'correctness': correctness_test_done, |
| 70 'perf': perf_test_done, | 66 'perf': perf_test_done, |
| 71 'dromaeo': dromaeo_test_done | 67 'dromaeo': dromaeo_test_done |
| 72 } | 68 } |
| 73 | 69 |
| 74 def run_test_in_browser(browser, html_out, timeout, mode): | 70 def run_test_in_browser(browser, html_out, timeout, mode): |
| 75 """Run the desired test in the browser using Selenium 2.0 WebDriver syntax, | 71 """Run the desired test in the browser using Selenium 2.0 WebDriver syntax, |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 browser = start_browser(browser_name, executable_path, html_out) | 305 browser = start_browser(browser_name, executable_path, html_out) |
| 310 | 306 |
| 311 try: | 307 try: |
| 312 output = run_test_in_browser(browser, html_out, timeout, mode) | 308 output = run_test_in_browser(browser, html_out, timeout, mode) |
| 313 return report_results(mode, output) | 309 return report_results(mode, output) |
| 314 finally: | 310 finally: |
| 315 close_browser(browser) | 311 close_browser(browser) |
| 316 | 312 |
| 317 if __name__ == "__main__": | 313 if __name__ == "__main__": |
| 318 sys.exit(main(sys.argv)) | 314 sys.exit(main(sys.argv)) |
| OLD | NEW |