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

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

Issue 8587004: Add PyAuto tests for triggering browser/page action. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor style change Created 9 years, 1 month 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/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """PyAuto: Python Interface to Chromium's Automation Proxy. 7 """PyAuto: Python Interface to Chromium's Automation Proxy.
8 8
9 PyAuto uses swig to expose Automation Proxy interfaces to Python. 9 PyAuto uses swig to expose Automation Proxy interfaces to Python.
10 For complete documentation on the functionality available, 10 For complete documentation on the functionality available,
(...skipping 1772 matching lines...) Expand 10 before | Expand all | Expand 10 after
1783 allow_in_incognito: A boolean, allow extension in incognito. 1783 allow_in_incognito: A boolean, allow extension in incognito.
1784 """ 1784 """
1785 cmd_dict = { # Prepare command for the json interface 1785 cmd_dict = { # Prepare command for the json interface
1786 'command': 'SetExtensionStateById', 1786 'command': 'SetExtensionStateById',
1787 'id': id, 1787 'id': id,
1788 'enable': enable, 1788 'enable': enable,
1789 'allow_in_incognito': allow_in_incognito, 1789 'allow_in_incognito': allow_in_incognito,
1790 } 1790 }
1791 self._GetResultFromJSONRequest(cmd_dict) 1791 self._GetResultFromJSONRequest(cmd_dict)
1792 1792
1793 def TriggerExtensionActionById(self, id, windex=0):
1794 """Trigger browser/page action asynchronously in the active tab.
1795
1796 Args:
1797 id: The string id of the extension.
dennis_jeffrey 2011/11/17 00:11:32 document the "windex" variable here too
frankf 2011/11/17 00:25:03 Done.
1798 """
1799 cmd_dict = { # Prepare command for the json interface
1800 'command': 'TriggerExtensionActionById',
1801 'id': id,
1802 }
1803 self._GetResultFromJSONRequest(cmd_dict, windex=windex)
1804
1793 def UpdateExtensionsNow(self): 1805 def UpdateExtensionsNow(self):
1794 """Auto-updates installed extensions. 1806 """Auto-updates installed extensions.
1795 1807
1796 Waits until all extensions are updated, loaded, and ready for use. 1808 Waits until all extensions are updated, loaded, and ready for use.
1797 This is equivalent to clicking the "Update extensions now" button on the 1809 This is equivalent to clicking the "Update extensions now" button on the
1798 chrome://extensions page. 1810 chrome://extensions page.
1799 1811
1800 Raises: 1812 Raises:
1801 pyauto_errors.JSONInterfaceError if the automation returns an error. 1813 pyauto_errors.JSONInterfaceError if the automation returns an error.
1802 """ 1814 """
(...skipping 2979 matching lines...) Expand 10 before | Expand all | Expand 10 after
4782 successful = result.wasSuccessful() 4794 successful = result.wasSuccessful()
4783 if not successful: 4795 if not successful:
4784 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) 4796 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename)
4785 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ 4797 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \
4786 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) 4798 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL)
4787 sys.exit(not successful) 4799 sys.exit(not successful)
4788 4800
4789 4801
4790 if __name__ == '__main__': 4802 if __name__ == '__main__':
4791 Main() 4803 Main()
OLDNEW
« chrome/test/functional/extensions.py ('K') | « chrome/test/functional/extensions.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698