Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: tools/testing/run_selenium.py

Issue 10968040: Eliminate some of the flakiness in testing: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/unittest/unittest.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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))
OLDNEW
« no previous file with comments | « pkg/unittest/unittest.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698