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

Side by Side Diff: tests/selenium/samples_tests.py

Issue 212031: Changed selenium tests to recover from test crashes/hangs. Divided perceptual... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: '' Created 11 years, 2 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 | « tests/selenium/sample_list.txt ('k') | tests/selenium/selenium_constants.py » ('j') | 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/python2.4 1 #!/usr/bin/python2.4
2 # Copyright 2009, Google Inc. 2 # Copyright 2009, Google Inc.
3 # All rights reserved. 3 # All rights reserved.
4 # 4 #
5 # Redistribution and use in source and binary forms, with or without 5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are 6 # modification, are permitted provided that the following conditions are
7 # met: 7 # met:
8 # 8 #
9 # * Redistributions of source code must retain the above copyright 9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer. 10 # notice, this list of conditions and the following disclaimer.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 import gflags 52 import gflags
53 import selenium_utilities 53 import selenium_utilities
54 54
55 55
56 class SampleTests(selenium_utilities.SeleniumTestCase): 56 class SampleTests(selenium_utilities.SeleniumTestCase):
57 """Tests a couple of samples in the o3d samples directory.""" 57 """Tests a couple of samples in the o3d samples directory."""
58 58
59 # TODO: Change to correct object class when NPAPI class is exposed. 59 # TODO: Change to correct object class when NPAPI class is exposed.
60 SELENIUM_OBJ_TYPE = "[object HTMLObjectElement]" 60 SELENIUM_OBJ_TYPE = "[object HTMLObjectElement]"
61 61
62 def __init__(self, name, session, browser, path_to_html, test_type=None, 62 def __init__(self, name, browser, path_to_html, test_type=None,
63 sample_path=None, options=None): 63 sample_path=None, options=None):
64 selenium_utilities.SeleniumTestCase.__init__( 64 selenium_utilities.SeleniumTestCase.__init__(
65 self, name, session, browser, path_to_html, test_type, sample_path, 65 self, name, browser, path_to_html, test_type, sample_path,
66 options) 66 options)
67 67
68 def GenericTest(self): 68 def GenericTest(self):
69 """Generically test a sample. 69 """Generically test a sample.
70 70
71 Each sample is expected to have a global variable called g_finished 71 Each sample is expected to have a global variable called g_finished
72 which is set to true when it is finished initializing and is in a state 72 which is set to true when it is finished initializing and is in a state
73 ready for a screenshot. 73 ready for a screenshot.
74 """ 74 """
75 self.RunGenericTest( 75 self.RunGenericTest(
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 # Figure out how many options there are. 307 # Figure out how many options there are.
308 num_shaders = s.get_eval( 308 num_shaders = s.get_eval(
309 "window.document.getElementById('shaderSelect').length") 309 "window.document.getElementById('shaderSelect').length")
310 310
311 # try each shader 311 # try each shader
312 for shader in range(0, int(num_shaders)): 312 for shader in range(0, int(num_shaders)):
313 # select shader 313 # select shader
314 s.select("//select[@id='shaderSelect']", ("index=%d" % shader)) 314 s.select("//select[@id='shaderSelect']", ("index=%d" % shader))
315 # Take screenshot 315 # Take screenshot
316 self.assertTrue(selenium_utilities.TakeScreenShot( 316 self.assertTrue(selenium_utilities.TakeScreenShot(
317 s, self.browser, "g_client", ("shader-test%d" % shader))) 317 s, self.browser, "g_client", "shader-test%d" % (shader + 1)))
318 318
319 def TestSampleErrorTextureSmall(self): 319 def TestSampleErrorTextureSmall(self):
320 """Tests error-texture.html.""" 320 """Tests error-texture.html."""
321 321
322 # Alias for the selenium session 322 # Alias for the selenium session
323 s = self.session 323 s = self.session
324 s.open(self.GetURL("/samples/error-texture.html")) 324 s.open(self.GetURL("/samples/error-texture.html"))
325 325
326 # Allow a limited time for the plugin to initialize. 326 # Allow a limited time for the plugin to initialize.
327 s.wait_for_condition("typeof(window.g_client) != 'undefined';", 30000) 327 s.wait_for_condition("typeof(window.g_client) != 'undefined';", 30000)
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 s.wait_for_condition("typeof(window.g_client) != 'undefined';", 10000) 521 s.wait_for_condition("typeof(window.g_client) != 'undefined';", 10000)
522 522
523 # Instruct the page to download the tgz file once. 523 # Instruct the page to download the tgz file once.
524 s.click("startLoad") 524 s.click("startLoad")
525 525
526 s.wait_for_condition("(typeof(window.g_finished) != 'undefined') && " 526 s.wait_for_condition("(typeof(window.g_finished) != 'undefined') && "
527 "window.g_finished == true;", 20000) 527 "window.g_finished == true;", 20000)
528 528
529 if __name__ == "__main__": 529 if __name__ == "__main__":
530 pass 530 pass
OLDNEW
« no previous file with comments | « tests/selenium/sample_list.txt ('k') | tests/selenium/selenium_constants.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698