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

Side by Side Diff: chrome/test/pyautolib/pyauto.py

Issue 10168019: Adds an automation hook WaitUntilNavigationCompletes() which blocks until pending navigation comple… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Slight comment rewording. Created 8 years, 8 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """PyAuto: Python Interface to Chromium's Automation Proxy. 6 """PyAuto: Python Interface to Chromium's Automation Proxy.
7 7
8 PyAuto uses swig to expose Automation Proxy interfaces to Python. 8 PyAuto uses swig to expose Automation Proxy interfaces to Python.
9 For complete documentation on the functionality available, 9 For complete documentation on the functionality available,
10 run pydoc on this file. 10 run pydoc on this file.
(...skipping 3094 matching lines...) Expand 10 before | Expand all | Expand 10 after
3105 """Removes all events currently in the AutomationEventQueue. 3105 """Removes all events currently in the AutomationEventQueue.
3106 3106
3107 Raises: 3107 Raises:
3108 pyauto_errors.JSONInterfaceError if the automation call returns an error. 3108 pyauto_errors.JSONInterfaceError if the automation call returns an error.
3109 """ 3109 """
3110 cmd_dict = { 3110 cmd_dict = {
3111 'command': 'ClearEventQueue', 3111 'command': 'ClearEventQueue',
3112 } 3112 }
3113 return self._GetResultFromJSONRequest(cmd_dict, windex=None) 3113 return self._GetResultFromJSONRequest(cmd_dict, windex=None)
3114 3114
3115 def WaitUntilNavigationCompletes(self, tab_index=0, windex=0):
3116 """Wait until the specified tab is done navigating.
3117
3118 It is safe to call ExecuteJavascript() as soon as the call returns. If
3119 there is no outstanding navigation the call will return immediately.
3120
3121 Args:
3122 tab_index: index of the tab.
3123 windex: index of the window.
3124
3125 Raises:
3126 pyauto_errors.JSONInterfaceError if the automation call returns an error.
3127 """
3128 cmd_dict = {
3129 'command': 'WaitUntilNavigationCompletes',
3130 'tab_index' : tab_index,
3131 'windex' : windex,
dennis_jeffrey 2012/04/20 22:11:32 remove space before the ":" in the above 2 lines
3132 }
3133 return self._GetResultFromJSONRequest(cmd_dict)
3134
3115 def ExecuteJavascript(self, js, tab_index=0, windex=0, frame_xpath=''): 3135 def ExecuteJavascript(self, js, tab_index=0, windex=0, frame_xpath=''):
3116 """Executes a script in the specified frame of a tab. 3136 """Executes a script in the specified frame of a tab.
3117 3137
3118 By default, execute the script in the top frame of the first tab in the 3138 By default, execute the script in the top frame of the first tab in the
3119 first window. The invoked javascript function must send a result back via 3139 first window. The invoked javascript function must send a result back via
3120 the domAutomationController.send function, or this function will never 3140 the domAutomationController.send function, or this function will never
3121 return. 3141 return.
3122 3142
3123 Args: 3143 Args:
3124 js: script to be executed. 3144 js: script to be executed.
(...skipping 2253 matching lines...) Expand 10 before | Expand all | Expand 10 after
5378 successful = result.wasSuccessful() 5398 successful = result.wasSuccessful()
5379 if not successful: 5399 if not successful:
5380 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) 5400 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename)
5381 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ 5401 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \
5382 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) 5402 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL)
5383 sys.exit(not successful) 5403 sys.exit(not successful)
5384 5404
5385 5405
5386 if __name__ == '__main__': 5406 if __name__ == '__main__':
5387 Main() 5407 Main()
OLDNEW
« chrome/browser/automation/testing_automation_provider.cc ('K') | « chrome/test/functional/apptest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698