browser_UITour_resetProfile.js (1364B)
1 "use strict"; 2 3 var gTestTab; 4 var gContentAPI; 5 6 add_task(setup_UITourTest); 7 8 // Test that a reset profile dialog appears when "resetFirefox" event is triggered 9 add_UITour_task(async function test_resetFirefox() { 10 let canReset = await getConfigurationPromise("canReset"); 11 ok( 12 !canReset, 13 "Shouldn't be able to reset from mochitest's temporary profile." 14 ); 15 let dialogPromise = BrowserTestUtils.promiseAlertDialog( 16 "cancel", 17 "chrome://global/content/resetProfile.xhtml", 18 { 19 isSubDialog: true, 20 } 21 ); 22 23 // make reset possible. 24 let profileService = Cc["@mozilla.org/toolkit/profile-service;1"].getService( 25 Ci.nsIToolkitProfileService 26 ); 27 let currentProfileDir = Services.dirsvc.get("ProfD", Ci.nsIFile); 28 let profileName = "mochitest-test-profile-temp-" + Date.now(); 29 let tempProfile = profileService.createProfile( 30 currentProfileDir, 31 profileName 32 ); 33 canReset = await getConfigurationPromise("canReset"); 34 ok( 35 canReset, 36 "Should be able to reset from mochitest's temporary profile once it's in the profile manager." 37 ); 38 await gContentAPI.resetFirefox(); 39 await dialogPromise; 40 tempProfile.remove(false); 41 canReset = await getConfigurationPromise("canReset"); 42 ok( 43 !canReset, 44 "Shouldn't be able to reset from mochitest's temporary profile once removed from the profile manager." 45 ); 46 });