Chromium Code Reviews| Index: chrome/test/pyautolib/pyauto.py |
| diff --git a/chrome/test/pyautolib/pyauto.py b/chrome/test/pyautolib/pyauto.py |
| index 9e179f6d7b74b87ca637ab356482d42ee5dc60f9..ebedfb0414add3da2a3df91c194939884c0624ca 100644 |
| --- a/chrome/test/pyautolib/pyauto.py |
| +++ b/chrome/test/pyautolib/pyauto.py |
| @@ -1716,6 +1716,26 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase): |
| return self._GetResultFromJSONRequest( |
| cmd_dict, windex=window_index)['translation_success'] |
| + def InstallExtension(self, extension_path): |
| + """Installs an extension from the given path. |
| + |
| + The path must be absolute and may be a crx file or an unpacked extension |
| + directory. Returns the extension ID if successfully installed and loaded. |
| + Otherwise, throws an exception. The extension must not already be installed. |
|
dennis_jeffrey
2011/11/22 23:32:16
Mention the possibility of an exception in the "Ra
kkania
2011/11/23 17:31:23
Done.
|
| + |
| + Args: |
| + extension_path: The absolute path to the extension to install. If the |
| + extension is packed, it must have a .crx extension. |
| + |
| + Returns: |
| + The ID of the extension. |
|
dennis_jeffrey
2011/11/22 23:32:16
'of the installed extension'
kkania
2011/11/23 17:31:23
Done.
|
| + """ |
| + cmd_dict = { |
| + 'command': 'InstallExtension', |
| + 'path': extension_path |
| + } |
| + return self._GetResultFromJSONRequest(cmd_dict, windex=-1)['id'] |
| + |
| def GetExtensionsInfo(self): |
| """Returns information about all installed extensions. |
| @@ -1756,7 +1776,7 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase): |
| cmd_dict = { # Prepare command for the json interface |
| 'command': 'GetExtensionsInfo' |
| } |
| - return self._GetResultFromJSONRequest(cmd_dict)['extensions'] |
| + return self._GetResultFromJSONRequest(cmd_dict, windex=-1)['extensions'] |
| def UninstallExtensionById(self, id): |
| """Uninstall the extension with the given id. |
| @@ -2410,13 +2430,14 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase): |
| A theme file is a file with a .crx suffix, like an extension. The theme |
| file must be specified with an absolute path. This method call waits until |
| the theme is installed and will trigger the "theme installed" infobar. |
| + If the install is unsuccessful, will throw an exception. |
|
dennis_jeffrey
2011/11/22 23:32:16
Mention this in the "Raises:" section of this docs
kkania
2011/11/23 17:31:23
Done.
|
| Uses InstallExtension(). |
| Returns: |
| - The ID of the installed theme, on success. The empty string, otherwise. |
| + The ID of the installed theme. |
| """ |
| - return self.InstallExtension(crx_file_path, True) |
| + return self.InstallExtension(crx_file_path) |
| def WaitUntilDownloadedThemeSet(self, theme_name): |
| """Waits until the theme has been set. |