fune/browser/components/uitour/test/browser_UITour_resetProfile.js
Emma Malysz 75ea156d47 Bug 1601093, Rename the remaining .xul files to .xhtml in toolkit/ r=marionette-reviewers,mossop,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D55857

--HG--
rename : toolkit/components/alerts/resources/content/alert.xul => toolkit/components/alerts/resources/content/alert.xhtml
rename : toolkit/components/apppicker/content/appPicker.xul => toolkit/components/apppicker/content/appPicker.xhtml
rename : toolkit/components/extensions/dummy.xul => toolkit/components/extensions/dummy.xhtml
rename : toolkit/components/passwordmgr/content/passwordManager.xul => toolkit/components/passwordmgr/content/passwordManager.xhtml
rename : toolkit/components/printing/content/printPageSetup.xul => toolkit/components/printing/content/printPageSetup.xhtml
rename : toolkit/components/printing/content/printPreviewProgress.xul => toolkit/components/printing/content/printPreviewProgress.xhtml
rename : toolkit/components/printing/content/printProgress.xul => toolkit/components/printing/content/printProgress.xhtml
rename : toolkit/components/prompts/content/commonDialog.xul => toolkit/components/prompts/content/commonDialog.xhtml
rename : toolkit/components/prompts/content/selectDialog.xul => toolkit/components/prompts/content/selectDialog.xhtml
rename : toolkit/components/viewconfig/content/config.xul => toolkit/components/viewconfig/content/config.xhtml
rename : toolkit/content/editMenuKeys.inc.xul => toolkit/content/editMenuKeys.inc.xhtml
rename : toolkit/content/resetProfile.xul => toolkit/content/resetProfile.xhtml
rename : toolkit/content/resetProfileProgress.xul => toolkit/content/resetProfileProgress.xhtml
rename : toolkit/modules/win.xul => toolkit/modules/win.xhtml
rename : toolkit/profile/content/createProfileWizard.xul => toolkit/profile/content/createProfileWizard.xhtml
rename : toolkit/profile/content/profileDowngrade.xul => toolkit/profile/content/profileDowngrade.xhtml
rename : toolkit/profile/content/profileSelection.xul => toolkit/profile/content/profileSelection.xhtml
extra : moz-landing-system : lando
2019-12-11 17:44:54 +00:00

66 lines
2 KiB
JavaScript

"use strict";
var gTestTab;
var gContentAPI;
var gContentWindow;
add_task(setup_UITourTest);
// Test that a reset profile dialog appears when "resetFirefox" event is triggered
add_UITour_task(async function test_resetFirefox() {
let canReset = await getConfigurationPromise("canReset");
ok(
!canReset,
"Shouldn't be able to reset from mochitest's temporary profile."
);
let dialogPromise = new Promise(resolve => {
Services.ww.registerNotification(function onOpen(subj, topic, data) {
if (topic == "domwindowopened" && subj instanceof Ci.nsIDOMWindow) {
subj.addEventListener(
"load",
function() {
if (
subj.document.documentURI ==
"chrome://global/content/resetProfile.xhtml"
) {
Services.ww.unregisterNotification(onOpen);
ok(true, "Observed search manager window open");
is(
subj.opener,
window,
"Reset Firefox event opened a reset profile window."
);
subj.close();
resolve();
}
},
{ once: true }
);
}
});
});
// make reset possible.
let profileService = Cc["@mozilla.org/toolkit/profile-service;1"].getService(
Ci.nsIToolkitProfileService
);
let currentProfileDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
let profileName = "mochitest-test-profile-temp-" + Date.now();
let tempProfile = profileService.createProfile(
currentProfileDir,
profileName
);
canReset = await getConfigurationPromise("canReset");
ok(
canReset,
"Should be able to reset from mochitest's temporary profile once it's in the profile manager."
);
await gContentAPI.resetFirefox();
await dialogPromise;
tempProfile.remove(false);
canReset = await getConfigurationPromise("canReset");
ok(
!canReset,
"Shouldn't be able to reset from mochitest's temporary profile once removed from the profile manager."
);
});