diff options
author | Matt A. Tobin <email@mattatobin.com> | 2018-02-10 02:49:12 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2018-02-10 02:49:12 -0500 |
commit | 4fb11cd5966461bccc3ed1599b808237be6b0de9 (patch) | |
tree | d7f0ccd49cebb3544d52635ff1bd6ed4d763823f /toolkit/mozapps/extensions/test/xpcshell/test_no_addons.js | |
parent | f164d9124708b50789dbb6959e1de96cc5697c48 (diff) | |
download | UXP-4fb11cd5966461bccc3ed1599b808237be6b0de9.tar UXP-4fb11cd5966461bccc3ed1599b808237be6b0de9.tar.gz UXP-4fb11cd5966461bccc3ed1599b808237be6b0de9.tar.lz UXP-4fb11cd5966461bccc3ed1599b808237be6b0de9.tar.xz UXP-4fb11cd5966461bccc3ed1599b808237be6b0de9.zip |
Move WebExtensions enabled Add-ons Manager
Diffstat (limited to 'toolkit/mozapps/extensions/test/xpcshell/test_no_addons.js')
-rw-r--r-- | toolkit/mozapps/extensions/test/xpcshell/test_no_addons.js | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_no_addons.js b/toolkit/mozapps/extensions/test/xpcshell/test_no_addons.js deleted file mode 100644 index a2ea5301e..000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/test_no_addons.js +++ /dev/null @@ -1,98 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -// Test startup and restart when no add-ons are installed -// bug 944006 - -Components.utils.import("resource://gre/modules/Promise.jsm"); - -// Load XPI Provider to get schema version ID -var XPIScope = Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm"); -const DB_SCHEMA = XPIScope.DB_SCHEMA; - -createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); - -function run_test() { - // Kick off the task-based tests... - run_next_test(); -} - -// Test for a preference to either exist with a specified value, or not exist at all -function checkPending() { - try { - do_check_false(Services.prefs.getBoolPref("extensions.pendingOperations")); - } - catch (e) { - // OK - } -} - -function checkString(aPref, aValue) { - try { - do_check_eq(Services.prefs.getCharPref(aPref), aValue) - } - catch (e) { - // OK - } -} - -// Make sure all our extension state is empty/nonexistent -function check_empty_state() { - do_check_false(gExtensionsJSON.exists()); - do_check_false(gExtensionsINI.exists()); - - do_check_eq(Services.prefs.getIntPref("extensions.databaseSchema"), DB_SCHEMA); - - checkString("extensions.bootstrappedAddons", "{}"); - checkString("extensions.installCache", "[]"); - checkPending(); -} - -// After first run with no add-ons, we expect: -// no extensions.json is created -// no extensions.ini -// database schema version preference is set -// bootstrap add-ons preference is not found -// add-on directory state preference is an empty array -// no pending operations -add_task(function* first_run() { - startupManager(); - check_empty_state(); - yield true; -}); - -// Now do something that causes a DB load, and re-check -function* trigger_db_load() { - let addonDefer = Promise.defer(); - AddonManager.getAddonsByTypes(['extension'], addonDefer.resolve); - let addonList = yield addonDefer.promise; - - do_check_eq(addonList.length, 0); - check_empty_state(); - - yield true; -} -add_task(trigger_db_load); - -// Now restart the manager and check again -add_task(function* restart_and_recheck() { - restartManager(); - check_empty_state(); - yield true; -}); - -// and reload the DB again -add_task(trigger_db_load); - -// When we start up with no DB and an old database schema, we should update the -// schema number but not create a database -add_task(function upgrade_schema_version() { - shutdownManager(); - Services.prefs.setIntPref("extensions.databaseSchema", 1); - - startupManager(); - do_check_eq(Services.prefs.getIntPref("extensions.databaseSchema"), DB_SCHEMA); - check_empty_state(); -}); - |