diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /browser/base/content/test/about/browser_aboutDialog_distribution.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/base/content/test/about/browser_aboutDialog_distribution.js')
-rw-r--r-- | browser/base/content/test/about/browser_aboutDialog_distribution.js | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/browser/base/content/test/about/browser_aboutDialog_distribution.js b/browser/base/content/test/about/browser_aboutDialog_distribution.js new file mode 100644 index 0000000000..8f52533bbc --- /dev/null +++ b/browser/base/content/test/about/browser_aboutDialog_distribution.js @@ -0,0 +1,66 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +Services.scriptloader.loadSubScript( + "chrome://mochitests/content/browser/toolkit/mozapps/update/tests/browser/head.js", + this +); + +add_task(async function verify_distribution_info_hides() { + let defaultBranch = Services.prefs.getDefaultBranch(null); + + defaultBranch.setCharPref("distribution.id", "mozilla-test-distribution-id"); + defaultBranch.setCharPref("distribution.version", "1.0"); + + let aboutDialog = await waitForAboutDialog(); + + let distroIdField = aboutDialog.document.getElementById("distributionId"); + let distroField = aboutDialog.document.getElementById("distribution"); + + if ( + AppConstants.platform === "win" && + Services.sysinfo.getProperty("hasWinPackageId") + ) { + is(distroIdField.value, "mozilla-test-distribution-id - 1.0"); + is(distroIdField.style.display, "block"); + is(distroField.style.display, "block"); + } else { + is(distroIdField.value, ""); + isnot(distroIdField.style.display, "block"); + isnot(distroField.style.display, "block"); + } + + aboutDialog.close(); +}); + +add_task(async function verify_distribution_info_displays() { + let defaultBranch = Services.prefs.getDefaultBranch(null); + + defaultBranch.setCharPref("distribution.id", "test-distribution-id"); + defaultBranch.setCharPref("distribution.version", "1.0"); + defaultBranch.setCharPref("distribution.about", "About Text"); + + let aboutDialog = await waitForAboutDialog(); + + let distroIdField = aboutDialog.document.getElementById("distributionId"); + + is(distroIdField.value, "test-distribution-id - 1.0"); + is(distroIdField.style.display, "block"); + + let distroField = aboutDialog.document.getElementById("distribution"); + is(distroField.value, "About Text"); + is(distroField.style.display, "block"); + + aboutDialog.close(); +}); + +add_task(async function cleanup() { + let defaultBranch = Services.prefs.getDefaultBranch(null); + + // This is the best we can do since we can't remove default prefs + defaultBranch.setCharPref("distribution.id", ""); + defaultBranch.setCharPref("distribution.version", ""); + defaultBranch.setCharPref("distribution.about", ""); +}); |