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

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: Addressed Dennis's comments 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 If the extension has a page action, the page action icon must be displayed.
dennis_jeffrey 2011/11/17 00:53:17 nit: ...the page action icon must be displayed bef
frankf 2011/11/21 02:01:46 Done.
1797
1798 Args:
1799 id: The string id of the extension.
1800 windex: Integer index of the browser window to use; defaults to 0
1801 (first window).
1802 """
1803 cmd_dict = { # Prepare command for the json interface
1804 'command': 'TriggerExtensionActionById',
1805 'id': id,
1806 }
1807 self._GetResultFromJSONRequest(cmd_dict, windex=windex)
1808
1793 def UpdateExtensionsNow(self): 1809 def UpdateExtensionsNow(self):
1794 """Auto-updates installed extensions. 1810 """Auto-updates installed extensions.
1795 1811
1796 Waits until all extensions are updated, loaded, and ready for use. 1812 Waits until all extensions are updated, loaded, and ready for use.
1797 This is equivalent to clicking the "Update extensions now" button on the 1813 This is equivalent to clicking the "Update extensions now" button on the
1798 chrome://extensions page. 1814 chrome://extensions page.
1799 1815
1800 Raises: 1816 Raises:
1801 pyauto_errors.JSONInterfaceError if the automation returns an error. 1817 pyauto_errors.JSONInterfaceError if the automation returns an error.
1802 """ 1818 """
(...skipping 2979 matching lines...) Expand 10 before | Expand all | Expand 10 after
4782 successful = result.wasSuccessful() 4798 successful = result.wasSuccessful()
4783 if not successful: 4799 if not successful:
4784 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) 4800 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename)
4785 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ 4801 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \
4786 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) 4802 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL)
4787 sys.exit(not successful) 4803 sys.exit(not successful)
4788 4804
4789 4805
4790 if __name__ == '__main__': 4806 if __name__ == '__main__':
4791 Main() 4807 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