diff options
author | nirnimesh@chromium.org <nirnimesh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-12 19:14:04 +0000 |
---|---|---|
committer | nirnimesh@chromium.org <nirnimesh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-12 19:14:04 +0000 |
commit | d4f0bd652042c6a4fd89af44f3974a3c9a71a1af (patch) | |
tree | 2f899edab6f9be4bae939b33f81afce7601b7be3 | |
parent | c5d767959f5e51bb78c67d647a7d4e0fbfd48f50 (diff) | |
download | chromium_src-d4f0bd652042c6a4fd89af44f3974a3c9a71a1af.zip chromium_src-d4f0bd652042c6a4fd89af44f3974a3c9a71a1af.tar.gz chromium_src-d4f0bd652042c6a4fd89af44f3974a3c9a71a1af.tar.bz2 |
[pyauto] Add ability to force install an extension with experimental perms
Allow InstallExtension() to act as if a .crx is from the webstore, thereby
allowing it to install extensions with 'experimental' permissions.
R=aa@chromium.org
BUG=131486
TEST=
Review URL: https://chromiumcodereview.appspot.com/10540066
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141701 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/automation/testing_automation_provider.cc | 5 | ||||
-rwxr-xr-x | chrome/test/pyautolib/pyauto.py | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 307b1b0..6781126 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -3942,6 +3942,7 @@ void TestingAutomationProvider::InstallExtension( DictionaryValue* args, IPC::Message* reply_message) { FilePath::StringType path_string; bool with_ui; + bool from_webstore = false; Browser* browser; std::string error_msg; if (!GetBrowserFromJSONArgs(args, &browser, &error_msg)) { @@ -3958,6 +3959,8 @@ void TestingAutomationProvider::InstallExtension( "Missing or invalid 'with_ui'"); return; } + args->GetBoolean("from_webstore", &from_webstore); + ExtensionService* service = browser->profile()->GetExtensionService(); ExtensionProcessManager* manager = browser->profile()->GetExtensionProcessManager(); @@ -3980,6 +3983,8 @@ void TestingAutomationProvider::InstallExtension( if (!with_ui) installer->set_allow_silent_install(true); installer->set_install_cause(extension_misc::INSTALL_CAUSE_AUTOMATION); + if (from_webstore) + installer->set_creation_flags(Extension::FROM_WEBSTORE); installer->InstallCrx(extension_path); } else { scoped_refptr<extensions::UnpackedInstaller> installer( diff --git a/chrome/test/pyautolib/pyauto.py b/chrome/test/pyautolib/pyauto.py index 1fae233..2fb12bf 100755 --- a/chrome/test/pyautolib/pyauto.py +++ b/chrome/test/pyautolib/pyauto.py @@ -2045,7 +2045,8 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase): tab_index=tab_index, window_index=window_index)['page_translated'], args=[tab_index, window_index]) - def InstallExtension(self, extension_path, with_ui=False, windex=0): + def InstallExtension(self, extension_path, with_ui=False, from_webstore=None, + windex=0): """Installs an extension from the given path. The path must be absolute and may be a crx file or an unpacked extension @@ -2056,6 +2057,9 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase): extension_path: The absolute path to the extension to install. If the extension is packed, it must have a .crx extension. with_ui: Whether the extension install confirmation UI should be shown. + from_webstore: If True, forces a .crx extension to be recognized as one + from the webstore. Can be used to force install an extension with + 'experimental' permissions. windex: Integer index of the browser window to use; defaults to 0 (first window). @@ -2071,6 +2075,8 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase): 'with_ui': with_ui, 'windex': windex, } + if from_webstore: + cmd_dict['from_webstore'] = True return self._GetResultFromJSONRequest(cmd_dict, windex=None)['id'] def GetExtensionsInfo(self, windex=0): |