browser_aboutDialog_distribution.js (2222B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 Services.scriptloader.loadSubScript( 7 "chrome://mochitests/content/browser/toolkit/mozapps/update/tests/browser/head.js", 8 this 9 ); 10 11 add_task(async function verify_distribution_info_hides() { 12 let defaultBranch = Services.prefs.getDefaultBranch(null); 13 14 defaultBranch.setCharPref("distribution.id", "mozilla-test-distribution-id"); 15 defaultBranch.setCharPref("distribution.version", "1.0"); 16 17 let aboutDialog = await waitForAboutDialog(); 18 19 let distroIdField = aboutDialog.document.getElementById("distributionId"); 20 let distroField = aboutDialog.document.getElementById("distribution"); 21 22 if ( 23 AppConstants.platform === "win" && 24 Services.sysinfo.getProperty("hasWinPackageId") 25 ) { 26 is(distroIdField.value, "mozilla-test-distribution-id - 1.0"); 27 is(distroIdField.style.display, "block"); 28 is(distroField.style.display, "block"); 29 } else { 30 is(distroIdField.value, ""); 31 isnot(distroIdField.style.display, "block"); 32 isnot(distroField.style.display, "block"); 33 } 34 35 aboutDialog.close(); 36 }); 37 38 add_task(async function verify_distribution_info_displays() { 39 let defaultBranch = Services.prefs.getDefaultBranch(null); 40 41 defaultBranch.setCharPref("distribution.id", "test-distribution-id"); 42 defaultBranch.setCharPref("distribution.version", "1.0"); 43 defaultBranch.setCharPref("distribution.about", "About Text"); 44 45 let aboutDialog = await waitForAboutDialog(); 46 47 let distroIdField = aboutDialog.document.getElementById("distributionId"); 48 49 is(distroIdField.value, "test-distribution-id - 1.0"); 50 is(distroIdField.style.display, "block"); 51 52 let distroField = aboutDialog.document.getElementById("distribution"); 53 is(distroField.value, "About Text"); 54 is(distroField.style.display, "block"); 55 56 aboutDialog.close(); 57 }); 58 59 add_task(async function cleanup() { 60 let defaultBranch = Services.prefs.getDefaultBranch(null); 61 62 // This is the best we can do since we can't remove default prefs 63 defaultBranch.setCharPref("distribution.id", ""); 64 defaultBranch.setCharPref("distribution.version", ""); 65 defaultBranch.setCharPref("distribution.about", ""); 66 });