Bug 1552714 - Fix tests to compare the result of getAttributes against L10nKeys. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D33740

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Zibi Braniecki 2019-06-06 16:33:09 +00:00
Родитель 307d0160a7
Коммит a49f5263f1
6 изменённых файлов: 30 добавлений и 32 удалений

Просмотреть файл

@ -78,7 +78,7 @@ add_task(async function() {
is(clearBtn.disabled, true, "Should disable clear button while updating sites");
is(settingsButton.disabled, true, "Should disable settings button while updating sites");
Assert.deepEqual(doc.l10n.getAttributes(totalSiteDataSizeLabel), {
id: "sitedata-total-size-calculating",
id: "sitedata-total-size-calculating", args: null,
}, "Should show the loading message while updating");
Services.obs.notifyObservers(null, "sitedatamanager:sites-updated");

Просмотреть файл

@ -4,7 +4,4 @@ module.exports = {
"extends": [
"plugin:mozilla/browser-test",
],
"globals": {
"DOMLocalization": false,
}
};

Просмотреть файл

@ -14,7 +14,7 @@ var { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
add_task(async function testCAandTitle() {
let cert = await readCertificate("ca.pem", "CTu,CTu,CTu");
let win = await displayCertificate(cert);
checkUsages(win, [{id: "verify-ssl-ca"}]);
checkUsages(win, [{id: "verify-ssl-ca", args: null}]);
checkDetailsPane(win, ["ca"]);
// There's no real need to test the title for every cert, so we just test it
@ -28,7 +28,7 @@ add_task(async function testCAandTitle() {
add_task(async function testSSLEndEntity() {
let cert = await readCertificate("ssl-ee.pem", ",,");
let win = await displayCertificate(cert);
checkUsages(win, [{id: "verify-ssl-server"}, {id: "verify-ssl-client"}]);
checkUsages(win, [{id: "verify-ssl-server", args: null}, {id: "verify-ssl-client", args: null}]);
checkDetailsPane(win, ["ca", "ssl-ee"]);
await BrowserTestUtils.closeWindow(win);
});
@ -36,7 +36,7 @@ add_task(async function testSSLEndEntity() {
add_task(async function testEmailEndEntity() {
let cert = await readCertificate("email-ee.pem", ",,");
let win = await displayCertificate(cert);
checkUsages(win, [{id: "verify-email-recip"}, {id: "verify-email-signer"}]);
checkUsages(win, [{id: "verify-email-recip", args: null}, {id: "verify-email-signer", args: null}]);
checkDetailsPane(win, ["ca", "email-ee"]);
await BrowserTestUtils.closeWindow(win);
});
@ -44,7 +44,7 @@ add_task(async function testEmailEndEntity() {
add_task(async function testCodeSignEndEntity() {
let cert = await readCertificate("code-ee.pem", ",,");
let win = await displayCertificate(cert);
checkError(win, {id: "cert-not-verified-unknown"});
checkError(win, {id: "cert-not-verified-unknown", args: null});
checkDetailsPane(win, ["code-ee"]);
await BrowserTestUtils.closeWindow(win);
});
@ -52,7 +52,7 @@ add_task(async function testCodeSignEndEntity() {
add_task(async function testExpired() {
let cert = await readCertificate("expired-ca.pem", ",,");
let win = await displayCertificate(cert);
checkError(win, {id: "cert-not-verified-cert-expired"});
checkError(win, {id: "cert-not-verified-cert-expired", args: null});
checkDetailsPane(win, ["expired-ca"]);
await BrowserTestUtils.closeWindow(win);
@ -60,7 +60,7 @@ add_task(async function testExpired() {
// same task.
let eeCert = await readCertificate("ee-from-expired-ca.pem", ",,");
let eeWin = await displayCertificate(eeCert);
checkError(eeWin, {id: "cert-not-verified-ca-invalid"});
checkError(eeWin, {id: "cert-not-verified-ca-invalid", args: null});
checkDetailsPane(eeWin, ["ee-from-expired-ca"]);
await BrowserTestUtils.closeWindow(eeWin);
});
@ -68,7 +68,7 @@ add_task(async function testExpired() {
add_task(async function testUnknownIssuer() {
let cert = await readCertificate("unknown-issuer.pem", ",,");
let win = await displayCertificate(cert);
checkError(win, {id: "cert-not-verified-issuer-unknown"});
checkError(win, {id: "cert-not-verified-issuer-unknown", args: null});
checkDetailsPane(win, ["unknown-issuer"]);
await BrowserTestUtils.closeWindow(win);
});
@ -76,7 +76,7 @@ add_task(async function testUnknownIssuer() {
add_task(async function testInsecureAlgo() {
let cert = await readCertificate("md5-ee.pem", ",,");
let win = await displayCertificate(cert);
checkError(win, {id: "cert-not-verified_algorithm-disabled"});
checkError(win, {id: "cert-not-verified_algorithm-disabled", args: null});
checkDetailsPane(win, ["md5-ee"]);
await BrowserTestUtils.closeWindow(win);
});
@ -84,7 +84,7 @@ add_task(async function testInsecureAlgo() {
add_task(async function testUntrusted() {
let cert = await readCertificate("untrusted-ca.pem", "p,p,p");
let win = await displayCertificate(cert);
checkError(win, {id: "cert-not-verified-cert-not-trusted"});
checkError(win, {id: "cert-not-verified-cert-not-trusted", args: null});
checkDetailsPane(win, ["untrusted-ca"]);
await BrowserTestUtils.closeWindow(win);
@ -92,7 +92,7 @@ add_task(async function testUntrusted() {
// same task.
let eeCert = await readCertificate("ee-from-untrusted-ca.pem", ",,");
let eeWin = await displayCertificate(eeCert);
checkError(eeWin, {id: "cert-not-verified-issuer-not-trusted"});
checkError(eeWin, {id: "cert-not-verified-issuer-not-trusted", args: null});
checkDetailsPane(eeWin, ["ee-from-untrusted-ca"]);
await BrowserTestUtils.closeWindow(eeWin);
});
@ -124,7 +124,7 @@ add_task(async function testRevoked() {
// As of bug 1312827, OneCRL only applies to TLS web server certificates, so
// this certificate will actually verify successfully for every end-entity
// usage except TLS web server.
checkUsages(win, [{id: "verify-email-recip"}, {id: "verify-email-signer"}, {id: "verify-ssl-client"}]);
checkUsages(win, [{id: "verify-email-recip", args: null}, {id: "verify-email-signer", args: null}, {id: "verify-ssl-client", args: null}]);
checkDetailsPane(win, ["ca", "revoked"]);
await BrowserTestUtils.closeWindow(win);
});
@ -136,7 +136,7 @@ add_task(async function testInvalid() {
// message in this case.
let cert = await readCertificate("invalid.pem", ",,");
let win = await displayCertificate(cert);
checkError(win, {id: "cert-not-verified-unknown"});
checkError(win, {id: "cert-not-verified-unknown", args: null});
checkDetailsPane(win, ["invalid"]);
await BrowserTestUtils.closeWindow(win);
});
@ -220,7 +220,7 @@ function getError(win) {
*/
function checkUsages(win, usagesL10nIds) {
Assert.deepEqual(getError(win),
{ id: "cert-verified" },
{ id: "cert-verified", args: null },
"should have successful verification message");
let determinedUsages = getUsages(win);
usagesL10nIds.sort(compareL10Ids);

Просмотреть файл

@ -143,38 +143,38 @@ async function testHelper(tabID, expectedTitleL10nId, expectedConfirmL10nId, exp
// Test deleting certs from the "Your Certificates" tab.
add_task(async function testDeletePersonalCerts() {
const expectedTitleL10nId = {id: "delete-user-cert-title"};
const expectedConfirmL10nId = {id: "delete-user-cert-confirm"};
const expectedImpactL10nId = {id: "delete-user-cert-impact"};
const expectedTitleL10nId = {id: "delete-user-cert-title", args: null};
const expectedConfirmL10nId = {id: "delete-user-cert-confirm", args: null};
const expectedImpactL10nId = {id: "delete-user-cert-impact", args: null};
await testHelper("mine_tab", expectedTitleL10nId, expectedConfirmL10nId,
expectedImpactL10nId);
});
// Test deleting certs from the "People" tab.
add_task(async function testDeleteOtherPeopleCerts() {
const expectedTitleL10nId = {id: "delete-email-cert-title"};
const expectedTitleL10nId = {id: "delete-email-cert-title", args: null};
// doesn't seem to work when embedded in the following literals, which is
// why escape codes are used instead.
const expectedConfirmL10nId = {id: "delete-email-cert-confirm"};
const expectedImpactL10nId = {id: "delete-email-cert-impact"};
const expectedConfirmL10nId = {id: "delete-email-cert-confirm", args: null};
const expectedImpactL10nId = {id: "delete-email-cert-impact", args: null};
await testHelper("others_tab", expectedTitleL10nId, expectedConfirmL10nId,
expectedImpactL10nId);
});
// Test deleting certs from the "Servers" tab.
add_task(async function testDeleteServerCerts() {
const expectedTitleL10nId = {id: "delete-ssl-cert-title"};
const expectedConfirmL10nId = {id: "delete-ssl-cert-confirm"};
const expectedImpactL10nId = {id: "delete-ssl-cert-impact"};
const expectedTitleL10nId = {id: "delete-ssl-cert-title", args: null};
const expectedConfirmL10nId = {id: "delete-ssl-cert-confirm", args: null};
const expectedImpactL10nId = {id: "delete-ssl-cert-impact", args: null};
await testHelper("websites_tab", expectedTitleL10nId, expectedConfirmL10nId,
expectedImpactL10nId);
});
// Test deleting certs from the "Authorities" tab.
add_task(async function testDeleteCACerts() {
const expectedTitleL10nId = {id: "delete-ca-cert-title"};
const expectedConfirmL10nId = {id: "delete-ca-cert-confirm"};
const expectedImpactL10nId = {id: "delete-ca-cert-impact"};
const expectedTitleL10nId = {id: "delete-ca-cert-title", args: null};
const expectedConfirmL10nId = {id: "delete-ca-cert-confirm", args: null};
const expectedImpactL10nId = {id: "delete-ca-cert-impact", args: null};
await testHelper("ca_tab", expectedTitleL10nId, expectedConfirmL10nId,
expectedImpactL10nId);
});

Просмотреть файл

@ -56,7 +56,7 @@ function checkOptions(doc, options, expectedOptions) {
is(input.value, expected.value, "The value is right");
is(input.checked, expected.checked, "The checked property is correct");
Assert.deepEqual(
doc.l10n.getAttributes(text), {id: expected.label},
doc.l10n.getAttributes(text), {id: expected.label, args: null},
"The label has the right text");
}
}
@ -222,7 +222,7 @@ add_task(async function testDetailOperations() {
// Check toggling disabled.
let name = card.querySelector(".addon-name");
is(name.textContent, "Test", "The name is set when enabled");
is(doc.l10n.getAttributes(name).id, "", "There is no l10n name");
is(doc.l10n.getAttributes(name).id, null, "There is no l10n name");
// Disable the extension.
let disableToggled = BrowserTestUtils.waitForEvent(card, "update");
@ -244,7 +244,7 @@ add_task(async function testDetailOperations() {
// Name is just the add-on name again.
is(name.textContent, "Test", "The name is reset when enabled");
is(doc.l10n.getAttributes(name).id, "", "There is no l10n name");
is(doc.l10n.getAttributes(name).id, null, "There is no l10n name");
// Remove but cancel.
let cancelled = BrowserTestUtils.waitForEvent(card, "remove-cancelled");

Просмотреть файл

@ -122,6 +122,7 @@ module.exports = {
"DOMError": false,
"DOMException": false,
"DOMImplementation": false,
"DOMLocalization": false,
"DOMMatrix": false,
"DOMMatrixReadOnly": false,
"DOMParser": false,