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

Unified Diff: chrome/test/pyautolib/pyauto.py

Issue 8649004: Allow chromedriver to install an extension and get all installed extension IDs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... 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 side-by-side diff with in-line comments
Download patch
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.

Powered by Google App Engine
This is Rietveld 408576698