Bug 1691821 - [3.2] Adjust form autofill extension tests to work with the shared component. r=zbraniecki,dimi,jmaher

Differential Revision: https://phabricator.services.mozilla.com/D110273
This commit is contained in:
Eugen Sawin 2021-04-12 17:33:18 +00:00
Родитель ea394ebcbc
Коммит a35b4fa14b
9 изменённых файлов: 17 добавлений и 22 удалений

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

@ -36,9 +36,9 @@ var gExceptionPaths = [
// toolkit/components/pdfjs/content/build/pdf.js
"resource://pdf.js/web/images/",
// Exclude all the metadata paths under the country metadata folder because these
// paths will be concatenated in FormAutofillUtils.jsm based on different country/region.
"resource://formautofill/addressmetadata/",
// Exclude the form autofill path that has been moved out of the extensions to
// toolkit, see bug 1691821.
"resource://gre-resources/autofill/",
// Exclude all search-extensions because they aren't referenced by filename
"resource://search-extensions/",
@ -372,7 +372,7 @@ function trackChromeUri(uri) {
// formautofill registers resource://formautofill/ and
// chrome://formautofill/content/ dynamically at runtime.
// Bug 1480276 is about addressing this without this hard-coding.
trackResourcePrefix("formautofill");
trackResourcePrefix("autofill");
trackChromeUri("chrome://formautofill/content/");
function parseManifest(manifestUri) {

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

@ -142,8 +142,7 @@ async function initProfileStorage(
collectionName = "addresses"
) {
let { FormAutofillStorage } = ChromeUtils.import(
"resource://autofill/FormAutofillStorage.jsm",
null
"resource://autofill/FormAutofillStorage.jsm"
);
let path = getTempFile(fileName).path;
let profileStorage = new FormAutofillStorage(path);

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

@ -27,6 +27,7 @@ add_task(async function test_activeStatus_init() {
// Initialize profile storage
await FormAutofillStatus.formAutofillStorage.initialize();
await FormAutofillStatus.updateSavedFieldNames();
// Upon first initializing profile storage, status should be computed.
Assert.equal(FormAutofillStatus.updateStatus.called, true);
Assert.equal(Services.ppmm.sharedData.get("FormAutofill:enabled"), false);
@ -107,14 +108,14 @@ add_task(async function test_activeStatus_computeStatus() {
"getSavedFieldNames"
);
FormAutofillStatus.formAutofillStorage.addresses.getSavedFieldNames.returns(
new Set()
Promise.resolve(new Set())
);
sinon.stub(
FormAutofillStatus.formAutofillStorage.creditCards,
"getSavedFieldNames"
);
FormAutofillStatus.formAutofillStorage.creditCards.getSavedFieldNames.returns(
new Set()
Promise.resolve(new Set())
);
// pref is enabled and profile is empty.
@ -137,9 +138,9 @@ add_task(async function test_activeStatus_computeStatus() {
Assert.equal(FormAutofillStatus.computeStatus(), false);
FormAutofillStatus.formAutofillStorage.addresses.getSavedFieldNames.returns(
new Set(["given-name"])
Promise.resolve(new Set(["given-name"]))
);
FormAutofillStatus.observe(null, "formautofill-storage-changed", "add");
await FormAutofillStatus.observe(null, "formautofill-storage-changed", "add");
// pref is enabled and profile is not empty.
Services.prefs.setBoolPref("extensions.formautofill.addresses.enabled", true);

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

@ -16,8 +16,7 @@ const { CreditCard } = ChromeUtils.import(
let FormAutofillStorage;
add_task(async function setup() {
({ FormAutofillStorage } = ChromeUtils.import(
"resource://autofill/FormAutofillStorage.jsm",
null
"resource://autofill/FormAutofillStorage.jsm"
));
});

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

@ -7,8 +7,7 @@
let FormAutofillStorage;
add_task(async function setup() {
({ FormAutofillStorage } = ChromeUtils.import(
"resource://autofill/FormAutofillStorage.jsm",
null
"resource://autofill/FormAutofillStorage.jsm"
));
});

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

@ -7,8 +7,7 @@
let FormAutofillStorage;
add_task(async function setup() {
({ FormAutofillStorage } = ChromeUtils.import(
"resource://autofill/FormAutofillStorage.jsm",
null
"resource://autofill/FormAutofillStorage.jsm"
));
});

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

@ -7,8 +7,7 @@
let FormAutofillStorage;
add_task(async function setup() {
({ FormAutofillStorage } = ChromeUtils.import(
"resource://autofill/FormAutofillStorage.jsm",
null
"resource://autofill/FormAutofillStorage.jsm"
));
});

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

@ -7,8 +7,7 @@
let FormAutofillStorage;
add_task(async function setup() {
({ FormAutofillStorage } = ChromeUtils.import(
"resource://autofill/FormAutofillStorage.jsm",
null
"resource://autofill/FormAutofillStorage.jsm"
));
});

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

@ -217,7 +217,7 @@ let FormAutofillStatus = {
onCloseWindow() {},
observe(subject, topic, data) {
async observe(subject, topic, data) {
log.debug("observe:", topic, "with data:", data);
switch (topic) {
case "privacy-pane-loaded": {
@ -243,7 +243,7 @@ let FormAutofillStatus = {
break;
}
this.updateSavedFieldNames();
await this.updateSavedFieldNames();
break;
}