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

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

Issue 8804011: WebDriver extension support in TestingAutomationProvider. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix comments and minor issues Created 9 years 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
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.cc ('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/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 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 1804 matching lines...) Expand 10 before | Expand all | Expand 10 after
1815 id: The string id of the extension. 1815 id: The string id of the extension.
1816 1816
1817 Returns: 1817 Returns:
1818 True, if the extension was successfully uninstalled, or 1818 True, if the extension was successfully uninstalled, or
1819 False, otherwise. 1819 False, otherwise.
1820 """ 1820 """
1821 cmd_dict = { # Prepare command for the json interface 1821 cmd_dict = { # Prepare command for the json interface
1822 'command': 'UninstallExtensionById', 1822 'command': 'UninstallExtensionById',
1823 'id': id, 1823 'id': id,
1824 } 1824 }
1825 return self._GetResultFromJSONRequest(cmd_dict)['success'] 1825 return self._GetResultFromJSONRequest(cmd_dict, windex=-1)['success']
1826 1826
1827 def SetExtensionStateById(self, id, enable, allow_in_incognito): 1827 def SetExtensionStateById(self, id, enable, allow_in_incognito):
1828 """Set extension state: enable/disable, allow/disallow in incognito mode. 1828 """Set extension state: enable/disable, allow/disallow in incognito mode.
1829 1829
1830 Args: 1830 Args:
1831 id: The string id of the extension. 1831 id: The string id of the extension.
1832 enable: A boolean, enable extension. 1832 enable: A boolean, enable extension.
1833 allow_in_incognito: A boolean, allow extension in incognito. 1833 allow_in_incognito: A boolean, allow extension in incognito.
1834 """ 1834 """
1835 cmd_dict = { # Prepare command for the json interface 1835 cmd_dict = { # Prepare command for the json interface
1836 'command': 'SetExtensionStateById', 1836 'command': 'SetExtensionStateById',
1837 'id': id, 1837 'id': id,
1838 'enable': enable, 1838 'enable': enable,
1839 'allow_in_incognito': allow_in_incognito, 1839 'allow_in_incognito': allow_in_incognito,
1840 } 1840 }
1841 self._GetResultFromJSONRequest(cmd_dict) 1841 self._GetResultFromJSONRequest(cmd_dict, windex=-1)
1842 1842
1843 def TriggerPageActionById(self, id, windex=0): 1843 def TriggerPageActionById(self, id, tab_index=0, windex=0):
1844 """Trigger page action asynchronously in the active tab. 1844 """Trigger page action asynchronously in the active tab.
1845 1845
1846 The page action icon must be displayed before invoking this function. 1846 The page action icon must be displayed before invoking this function.
1847 1847
1848 Args: 1848 Args:
1849 id: The string id of the extension. 1849 id: The string id of the extension.
1850 tab_index: Integer index of the tab to use; defaults to 0 (first tab).
1850 windex: Integer index of the browser window to use; defaults to 0 1851 windex: Integer index of the browser window to use; defaults to 0
1851 (first window). 1852 (first window).
1852 """ 1853 """
1853 cmd_dict = { # Prepare command for the json interface 1854 cmd_dict = { # Prepare command for the json interface
1854 'command': 'TriggerPageActionById', 1855 'command': 'TriggerPageActionById',
1855 'id': id, 1856 'id': id,
1856 'windex': windex, 1857 'windex': windex,
1858 'tab_index': tab_index,
1857 } 1859 }
1858 self._GetResultFromJSONRequest(cmd_dict, windex=windex) 1860 self._GetResultFromJSONRequest(cmd_dict, windex=-1)
1859 1861
1860 def TriggerBrowserActionById(self, id, windex=0): 1862 def TriggerBrowserActionById(self, id, tab_index=0, windex=0):
1861 """Trigger browser action asynchronously in the active tab. 1863 """Trigger browser action asynchronously in the active tab.
1862 1864
1863 Args: 1865 Args:
1864 id: The string id of the extension. 1866 id: The string id of the extension.
1867 tab_index: Integer index of the tab to use; defaults to 0 (first tab).
1865 windex: Integer index of the browser window to use; defaults to 0 1868 windex: Integer index of the browser window to use; defaults to 0
1866 (first window). 1869 (first window).
1867 """ 1870 """
1868 cmd_dict = { # Prepare command for the json interface 1871 cmd_dict = { # Prepare command for the json interface
1869 'command': 'TriggerBrowserActionById', 1872 'command': 'TriggerBrowserActionById',
1870 'id': id, 1873 'id': id,
1871 'windex': windex, 1874 'windex': windex,
1875 'tab_index': tab_index,
1872 } 1876 }
1873 self._GetResultFromJSONRequest(cmd_dict, windex=windex) 1877 self._GetResultFromJSONRequest(cmd_dict, windex=-1)
1874 1878
1875 def UpdateExtensionsNow(self): 1879 def UpdateExtensionsNow(self):
1876 """Auto-updates installed extensions. 1880 """Auto-updates installed extensions.
1877 1881
1878 Waits until all extensions are updated, loaded, and ready for use. 1882 Waits until all extensions are updated, loaded, and ready for use.
1879 This is equivalent to clicking the "Update extensions now" button on the 1883 This is equivalent to clicking the "Update extensions now" button on the
1880 chrome://extensions page. 1884 chrome://extensions page.
1881 1885
1882 Raises: 1886 Raises:
1883 pyauto_errors.JSONInterfaceError if the automation returns an error. 1887 pyauto_errors.JSONInterfaceError if the automation returns an error.
(...skipping 2955 matching lines...) Expand 10 before | Expand all | Expand 10 after
4839 successful = result.wasSuccessful() 4843 successful = result.wasSuccessful()
4840 if not successful: 4844 if not successful:
4841 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) 4845 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename)
4842 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ 4846 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \
4843 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) 4847 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL)
4844 sys.exit(not successful) 4848 sys.exit(not successful)
4845 4849
4846 4850
4847 if __name__ == '__main__': 4851 if __name__ == '__main__':
4848 Main() 4852 Main()
OLDNEW
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698