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/webextensions/test/xpcshell/test_addon_path_service.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/webextensions/test/xpcshell/test_addon_path_service.js')
-rw-r--r-- | toolkit/mozapps/webextensions/test/xpcshell/test_addon_path_service.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/toolkit/mozapps/webextensions/test/xpcshell/test_addon_path_service.js b/toolkit/mozapps/webextensions/test/xpcshell/test_addon_path_service.js new file mode 100644 index 000000000..56ce3c614 --- /dev/null +++ b/toolkit/mozapps/webextensions/test/xpcshell/test_addon_path_service.js @@ -0,0 +1,38 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +var service = Components.classes["@mozilla.org/addon-path-service;1"].getService(Components.interfaces.amIAddonPathService); + +function insert(path, value) +{ + service.insertPath("/test/" + path, value); +} + +function find(path) +{ + return service.findAddonId("/test/" + path); +} + +function run_test() +{ + insert("abc", "10"); + insert("def", "11"); + insert("axy", "12"); + insert("defghij", "13"); + insert("defghi", "14"); + + do_check_eq(find("abc"), "10"); + do_check_eq(find("abc123"), "10"); + do_check_eq(find("def"), "11"); + do_check_eq(find("axy"), "12"); + do_check_eq(find("axy1"), "12"); + do_check_eq(find("defghij"), "13"); + do_check_eq(find("abd"), ""); + do_check_eq(find("x"), ""); + + insert("file:///home/billm/mozilla/in4/objdir-ff-dbg/dist/bin/browser/extensions/%7B972ce4c6-7e08-4474-a285-3208198ce6fd%7D/", "{972ce4c6-7e08-4474-a285-3208198ce6fd}"); + insert("file:///home/billm/mozilla/addons/dl-helper-workspace/addon/", "{b9db16a4-6edc-47ec-a1f4-b86292ed211d}"); + + do_check_eq(find("file:///home/billm/mozilla/addons/dl-helper-workspace/addon/local/modules/medialist-manager.jsm"), "{b9db16a4-6edc-47ec-a1f4-b86292ed211d}"); +} |