diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/marionette/harness/marionette_harness/tests/unit/test_addons.py | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/marionette/harness/marionette_harness/tests/unit/test_addons.py')
-rw-r--r-- | testing/marionette/harness/marionette_harness/tests/unit/test_addons.py | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/testing/marionette/harness/marionette_harness/tests/unit/test_addons.py b/testing/marionette/harness/marionette_harness/tests/unit/test_addons.py new file mode 100644 index 000000000..25f1c05ab --- /dev/null +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_addons.py @@ -0,0 +1,58 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +import os + +from marionette_driver.addons import Addons, AddonInstallException +from marionette_harness import MarionetteTestCase, skip + + +here = os.path.abspath(os.path.dirname(__file__)) + + +class TestAddons(MarionetteTestCase): + + def setUp(self): + MarionetteTestCase.setUp(self) + self.addons = Addons(self.marionette) + + @property + def all_addon_ids(self): + with self.marionette.using_context('chrome'): + addons = self.marionette.execute_async_script(""" + Components.utils.import("resource://gre/modules/AddonManager.jsm"); + AddonManager.getAllAddons(function(addons){ + let ids = addons.map(function(x) { + return x.id; + }); + marionetteScriptFinished(ids); + }); + """) + + return addons + + def test_install_and_remove_temporary_unsigned_addon(self): + addon_path = os.path.join(here, 'mn-restartless-unsigned.xpi') + + addon_id = self.addons.install(addon_path, temp=True) + self.assertIn(addon_id, self.all_addon_ids) + + self.addons.uninstall(addon_id) + self.assertNotIn(addon_id, self.all_addon_ids) + + def test_install_unsigned_addon(self): + addon_path = os.path.join(here, 'mn-restartless-unsigned.xpi') + + with self.assertRaises(AddonInstallException): + self.addons.install(addon_path) + + @skip("Need to get the test extension signed") + def test_install_and_remove_signed_addon(self): + addon_path = os.path.join(here, 'mn-restartless-signed.xpi') + + addon_id = self.addons.install(addon_path) + self.assertIn(addon_id, self.all_addon_ids) + + self.addons.uninstall(addon_id) + self.assertNotIn(addon_id, self.all_addon_ids) |