| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 104 |
| 105 def Main(): | 105 def Main(): |
| 106 # Note: you need ChromeDriver *in your path* to run Chrome, in addition to | 106 # Note: you need ChromeDriver *in your path* to run Chrome, in addition to |
| 107 # installing Chrome. | 107 # installing Chrome. |
| 108 browser = None | 108 browser = None |
| 109 html_out, browser, timeout, is_perf = parse_args() | 109 html_out, browser, timeout, is_perf = parse_args() |
| 110 | 110 |
| 111 if browser == 'chrome': | 111 if browser == 'chrome': |
| 112 browser = selenium.webdriver.Chrome() | 112 browser = selenium.webdriver.Chrome() |
| 113 elif browser == 'ff': | 113 elif browser == 'ff': |
| 114 browser = selenium.webdriver.Firefox() | 114 profile = selenium.webdriver.firefox.firefox_profile.FirefoxProfile() |
| 115 profile.set_preference('dom.max_script_run_time', 0) |
| 116 profile.set_preference('dom.max_chrome_script_run_time', 0) |
| 117 browser = selenium.webdriver.Firefox(firefox_profile=profile) |
| 115 elif browser == 'ie' and platform.system() == 'Windows': | 118 elif browser == 'ie' and platform.system() == 'Windows': |
| 116 browser = selenium.webdriver.Ie() | 119 browser = selenium.webdriver.Ie() |
| 117 elif browser == 'safari' and platform.system() == 'Darwin': | 120 elif browser == 'safari' and platform.system() == 'Darwin': |
| 118 # TODO(efortuna): Ensure our preferences (no pop-up blocking) file is the | 121 # TODO(efortuna): Ensure our preferences (no pop-up blocking) file is the |
| 119 # same (Safari auto-deletes when it has too many "crashes," or in our case, | 122 # same (Safari auto-deletes when it has too many "crashes," or in our case, |
| 120 # timeouts). Come up with a less hacky way to do this. | 123 # timeouts). Come up with a less hacky way to do this. |
| 121 shutil.copy(os.path.dirname(__file__) + '/com.apple.Safari.plist', | 124 shutil.copy(os.path.dirname(__file__) + '/com.apple.Safari.plist', |
| 122 '/Library/Preferences/com.apple.Safari.plist') | 125 '/Library/Preferences/com.apple.Safari.plist') |
| 123 sel = selenium.selenium('localhost', 4444, "*safari", 'file://' + html_out) | 126 sel = selenium.selenium('localhost', 4444, "*safari", 'file://' + html_out) |
| 124 try: | 127 try: |
| (...skipping 30 matching lines...) Expand all Loading... |
| 155 #TODO(efortuna): Access these elements in a nicer way using DOM parser. | 158 #TODO(efortuna): Access these elements in a nicer way using DOM parser. |
| 156 index = source.find('<body>') | 159 index = source.find('<body>') |
| 157 index += len('<body>') | 160 index += len('<body>') |
| 158 end_index = source.find('<script') | 161 end_index = source.find('<script') |
| 159 print source[index : end_index] | 162 print source[index : end_index] |
| 160 return 1 | 163 return 1 |
| 161 | 164 |
| 162 | 165 |
| 163 if __name__ == "__main__": | 166 if __name__ == "__main__": |
| 164 sys.exit(Main()) | 167 sys.exit(Main()) |
| OLD | NEW |