browser_bug1579418.js (1621B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 add_task(async function default_homepage_test() { 7 let oldHomepagePref = Services.prefs.getCharPref("browser.startup.homepage"); 8 let oldStartpagePref = Services.prefs.getIntPref("browser.startup.page"); 9 10 await openPreferencesViaOpenPreferencesAPI("paneHome", { leaveOpen: true }); 11 12 let doc = gBrowser.contentDocument; 13 let homeMode = doc.getElementById("homeMode"); 14 let customSettings = doc.getElementById("customSettings"); 15 16 // HOME_MODE_FIREFOX_HOME 17 homeMode.value = 0; 18 19 homeMode.dispatchEvent(new Event("command")); 20 21 is(Services.prefs.getCharPref("browser.startup.homepage"), "about:home"); 22 23 // HOME_MODE_BLANK 24 homeMode.value = 1; 25 26 homeMode.dispatchEvent(new Event("command")); 27 28 await TestUtils.waitForCondition( 29 () => customSettings.hidden === true, 30 "Wait for customSettings to be hidden." 31 ); 32 33 is( 34 Services.prefs.getCharPref("browser.startup.homepage"), 35 "chrome://browser/content/blanktab.html" 36 ); 37 38 // HOME_MODE_CUSTOM 39 homeMode.value = 2; 40 41 homeMode.dispatchEvent(new Event("command")); 42 43 await TestUtils.waitForCondition( 44 () => customSettings.hidden === false, 45 "Wait for customSettings to be shown." 46 ); 47 48 is(customSettings.hidden, false, "homePageURL should be visible"); 49 50 registerCleanupFunction(async () => { 51 Services.prefs.setCharPref("browser.startup.homepage", oldHomepagePref); 52 Services.prefs.setIntPref("browser.startup.page", oldStartpagePref); 53 BrowserTestUtils.removeTab(gBrowser.selectedTab); 54 }); 55 });