gecko/toolkit/mozapps/extensions/test/xpinstall/browser_signed_naming.js

67 lines
2.4 KiB
JavaScript
Raw Normal View History

Bug 553169: Port xpinstall browser chrome tests to the new extension manager API. r=robstrong --HG-- rename : xpinstall/tests/authRedirect.sjs => toolkit/mozapps/extensions/test/xpinstall/authRedirect.sjs rename : xpinstall/tests/browser_auth.js => toolkit/mozapps/extensions/test/xpinstall/browser_auth.js rename : xpinstall/tests/browser_auth2.js => toolkit/mozapps/extensions/test/xpinstall/browser_auth2.js rename : xpinstall/tests/browser_auth3.js => toolkit/mozapps/extensions/test/xpinstall/browser_auth3.js rename : xpinstall/tests/browser_badhash.js => toolkit/mozapps/extensions/test/xpinstall/browser_badhash.js rename : xpinstall/tests/browser_badhashtype.js => toolkit/mozapps/extensions/test/xpinstall/browser_badhashtype.js rename : xpinstall/tests/browser_bug540558.js => toolkit/mozapps/extensions/test/xpinstall/browser_bug540558.js rename : xpinstall/tests/browser_cookies.js => toolkit/mozapps/extensions/test/xpinstall/browser_cookies.js rename : xpinstall/tests/browser_cookies2.js => toolkit/mozapps/extensions/test/xpinstall/browser_cookies2.js rename : xpinstall/tests/browser_cookies3.js => toolkit/mozapps/extensions/test/xpinstall/browser_cookies3.js rename : xpinstall/tests/browser_cookies4.js => toolkit/mozapps/extensions/test/xpinstall/browser_cookies4.js rename : xpinstall/tests/browser_corrupt.js => toolkit/mozapps/extensions/test/xpinstall/browser_corrupt.js rename : xpinstall/tests/browser_empty.js => toolkit/mozapps/extensions/test/xpinstall/browser_empty.js rename : xpinstall/tests/browser_enabled2.js => toolkit/mozapps/extensions/test/xpinstall/browser_enabled2.js rename : xpinstall/tests/browser_enabled3.js => toolkit/mozapps/extensions/test/xpinstall/browser_enabled3.js rename : xpinstall/tests/browser_hash.js => toolkit/mozapps/extensions/test/xpinstall/browser_hash.js rename : xpinstall/tests/browser_installchrome.js => toolkit/mozapps/extensions/test/xpinstall/browser_installchrome.js rename : xpinstall/tests/browser_navigateaway.js => toolkit/mozapps/extensions/test/xpinstall/browser_navigateaway.js rename : xpinstall/tests/browser_navigateaway2.js => toolkit/mozapps/extensions/test/xpinstall/browser_navigateaway2.js rename : xpinstall/tests/browser_offline.js => toolkit/mozapps/extensions/test/xpinstall/browser_offline.js rename : xpinstall/tests/browser_signed_multiple.js => toolkit/mozapps/extensions/test/xpinstall/browser_signed_multiple.js rename : xpinstall/tests/browser_signed_naming.js => toolkit/mozapps/extensions/test/xpinstall/browser_signed_naming.js rename : xpinstall/tests/browser_signed_tampered.js => toolkit/mozapps/extensions/test/xpinstall/browser_signed_tampered.js rename : xpinstall/tests/browser_signed_trigger.js => toolkit/mozapps/extensions/test/xpinstall/browser_signed_trigger.js rename : xpinstall/tests/browser_signed_untrusted.js => toolkit/mozapps/extensions/test/xpinstall/browser_signed_untrusted.js rename : xpinstall/tests/browser_softwareupdate.js => toolkit/mozapps/extensions/test/xpinstall/browser_softwareupdate.js rename : xpinstall/tests/browser_unsigned_trigger.js => toolkit/mozapps/extensions/test/xpinstall/browser_unsigned_trigger.js rename : xpinstall/tests/browser_whitelist.js => toolkit/mozapps/extensions/test/xpinstall/browser_whitelist.js rename : xpinstall/tests/browser_whitelist2.js => toolkit/mozapps/extensions/test/xpinstall/browser_whitelist2.js rename : xpinstall/tests/browser_whitelist3.js => toolkit/mozapps/extensions/test/xpinstall/browser_whitelist3.js rename : xpinstall/tests/browser_whitelist4.js => toolkit/mozapps/extensions/test/xpinstall/browser_whitelist4.js rename : xpinstall/tests/bug540558.html => toolkit/mozapps/extensions/test/xpinstall/bug540558.html rename : xpinstall/tests/cookieRedirect.sjs => toolkit/mozapps/extensions/test/xpinstall/cookieRedirect.sjs rename : xpinstall/tests/corrupt.xpi => toolkit/mozapps/extensions/test/xpinstall/corrupt.xpi rename : xpinstall/tests/empty.xpi => toolkit/mozapps/extensions/test/xpinstall/empty.xpi rename : xpinstall/tests/enabled.html => toolkit/mozapps/extensions/test/xpinstall/enabled.html rename : xpinstall/tests/installchrome.html => toolkit/mozapps/extensions/test/xpinstall/installchrome.html rename : xpinstall/tests/installtrigger.html => toolkit/mozapps/extensions/test/xpinstall/installtrigger.html rename : xpinstall/tests/signed-no-cn.xpi => toolkit/mozapps/extensions/test/xpinstall/signed-no-cn.xpi rename : xpinstall/tests/signed-no-o.xpi => toolkit/mozapps/extensions/test/xpinstall/signed-no-o.xpi rename : xpinstall/tests/signed-tampered.xpi => toolkit/mozapps/extensions/test/xpinstall/signed-tampered.xpi rename : xpinstall/tests/signed-untrusted.xpi => toolkit/mozapps/extensions/test/xpinstall/signed-untrusted.xpi rename : xpinstall/tests/signed.xpi => toolkit/mozapps/extensions/test/xpinstall/signed.xpi rename : xpinstall/tests/signed2.xpi => toolkit/mozapps/extensions/test/xpinstall/signed2.xpi rename : xpinstall/tests/startsoftwareupdate.html => toolkit/mozapps/extensions/test/xpinstall/startsoftwareupdate.html rename : xpinstall/tests/unsigned.xpi => toolkit/mozapps/extensions/test/xpinstall/unsigned.xpi
2010-04-29 13:11:24 -07:00
// ----------------------------------------------------------------------------
// Tests that the correct signer is presented for combinations of O and CN present.
// The signed files have (when present) O=Mozilla Testing, CN=Object Signer
// This verifies bug 372980
function test() {
Harness.installConfirmCallback = confirm_install;
Harness.installEndedCallback = install_ended;
Harness.installsCompletedCallback = finish_test;
Harness.setup();
var pm = Services.perms;
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
var triggers = encodeURIComponent(JSON.stringify({
"Signed XPI (O and CN)": TESTROOT + "signed.xpi",
"Signed XPI (CN)": TESTROOT + "signed-no-o.xpi",
"Signed XPI (O)": TESTROOT + "signed-no-cn.xpi",
}));
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
}
function get_item(items, url) {
for (let i = 0; i < items.length; i++) {
if (items[i].url == url)
return items[i];
}
ok(false, "Item for " + url + " was not listed");
}
function confirm_install(window) {
items = window.document.getElementById("itemList").childNodes;
is(items.length, 3, "Should be 3 items listed in the confirmation dialog");
let item = get_item(items, TESTROOT + "signed.xpi");
if (item) {
is(item.name, "Signed XPI Test", "Should have seen the name from the trigger list");
is(item.cert, "(Object Signer)", "Should have seen the signer");
is(item.signed, "true", "Should have listed the item as signed");
}
item = get_item(items, TESTROOT + "signed-no-o.xpi");
if (item) {
is(item.name, "Signed XPI Test (No Org)", "Should have seen the name from the trigger list");
is(item.cert, "(Object Signer)", "Should have seen the signer");
is(item.signed, "true", "Should have listed the item as signed");
}
item = get_item(items, TESTROOT + "signed-no-cn.xpi");
if (item) {
is(item.name, "Signed XPI Test (No Common Name)", "Should have seen the name from the trigger list");
is(item.cert, "(Mozilla Testing)", "Should have seen the signer");
is(item.signed, "true", "Should have listed the item as signed");
}
return true;
}
function install_ended(install, addon) {
install.cancel();
}
function finish_test(count) {
is(count, 3, "3 Add-ons should have been successfully installed");
Services.perms.remove("example.com", "install");
gBrowser.removeCurrentTab();
Harness.finish();
}