| 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. |    9 the result. | 
|   10 """ |   10 """ | 
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   42   source = '' |   42   source = '' | 
|   43   try: |   43   try: | 
|   44     if is_perf: |   44     if is_perf: | 
|   45       # We're running a performance test. |   45       # We're running a performance test. | 
|   46       element = WebDriverWait(browser, float(timeout)).until(perf_test_done) |   46       element = WebDriverWait(browser, float(timeout)).until(perf_test_done) | 
|   47     else: |   47     else: | 
|   48       element = WebDriverWait(browser, float(timeout)).until( |   48       element = WebDriverWait(browser, float(timeout)).until( | 
|   49           lambda driver : ('PASS' in driver.page_source) or |   49           lambda driver : ('PASS' in driver.page_source) or | 
|   50           ('FAIL' in driver.page_source)) |   50           ('FAIL' in driver.page_source)) | 
|   51     source = browser.page_source |   51     source = browser.page_source | 
|   52   except selenium.common.exceptions.TimeoutException: |  | 
|   53     source = 'FAIL (timeout)' |  | 
|   54   finally:  |   52   finally:  | 
|   55     # A timeout exception is thrown if nothing happens within the time limit. |   53     # A timeout exception is thrown if nothing happens within the time limit. | 
|   56     if browser != 'chrome': |   54     if browser != 'chrome': | 
|   57       browser.close() |   55       browser.close() | 
|   58     try: |   56     try: | 
|   59       browser.quit() |   57       browser.quit() | 
|   60     except selenium.common.exceptions.WebDriverException: |   58     except selenium.common.exceptions.WebDriverException: | 
|   61       #TODO(efortuna): figure out why this crashes.... and avoid? |   59       #TODO(efortuna): figure out why this crashes.... and avoid? | 
|   62       pass |   60       pass | 
|   63   return source |   61   return source | 
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  151       #TODO(efortuna): Access these elements in a nicer way using DOM parser. |  149       #TODO(efortuna): Access these elements in a nicer way using DOM parser. | 
|  152       index = source.find('<body>') |  150       index = source.find('<body>') | 
|  153       index += len('<body>') |  151       index += len('<body>') | 
|  154       end_index = source.find('<script') |  152       end_index = source.find('<script') | 
|  155       print source[index : end_index] |  153       print source[index : end_index] | 
|  156       return 1 |  154       return 1 | 
|  157  |  155  | 
|  158  |  156  | 
|  159 if __name__ == "__main__": |  157 if __name__ == "__main__": | 
|  160   sys.exit(Main()) |  158   sys.exit(Main()) | 
| OLD | NEW |