diff options
Diffstat (limited to '')
8 files changed, 245 insertions, 0 deletions
diff --git a/toolkit/mozapps/update/tests/browser/manual_app_update_only/browser.ini b/toolkit/mozapps/update/tests/browser/manual_app_update_only/browser.ini new file mode 100644 index 0000000000..b5295f5eac --- /dev/null +++ b/toolkit/mozapps/update/tests/browser/manual_app_update_only/browser.ini @@ -0,0 +1,18 @@ +[DEFAULT] +head = head.js +prefs = + app.update.BITS.enabled=false + browser.policies.alternatePath='<test-root>/toolkit/mozapps/update/tests/browser/manual_app_update_only/config_manual_app_update_only.json' +support-files = + !/toolkit/mozapps/update/tests/browser/head.js + config_manual_app_update_only.json + ../../data/shared.js + ../../data/app_update.sjs + ../testConstants.js +skip-if = os == 'win' && msix # Updater is disabled in MSIX builds + +[browser_aboutDialog_fc_autoUpdateFalse.js] +[browser_aboutDialog_fc_autoUpdateTrue.js] +[browser_aboutPrefs_fc_autoUpdateFalse.js] +[browser_aboutPrefs_fc_autoUpdateTrue.js] +[browser_noBackgroundUpdate.js] diff --git a/toolkit/mozapps/update/tests/browser/manual_app_update_only/browser_aboutDialog_fc_autoUpdateFalse.js b/toolkit/mozapps/update/tests/browser/manual_app_update_only/browser_aboutDialog_fc_autoUpdateFalse.js new file mode 100644 index 0000000000..169e66033a --- /dev/null +++ b/toolkit/mozapps/update/tests/browser/manual_app_update_only/browser_aboutDialog_fc_autoUpdateFalse.js @@ -0,0 +1,43 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +add_task(async function test_manual_app_update_policy() { + await setAppUpdateAutoEnabledHelper(false); + + is( + Services.policies.isAllowed("autoAppUpdateChecking"), + false, + "autoAppUpdateChecking should be disabled by policy" + ); + is(gAUS.manualUpdateOnly, true, "gAUS.manualUpdateOnly should be true"); + + let downloadInfo = [{ patchType: "partial", internalResult: "0" }]; + // Since the partial should be successful specify an invalid size for the + // complete update. + let params = { queryString: "&invalidCompleteSize=1" }; + await runAboutDialogUpdateTest(params, [ + { + panelId: "checkingForUpdates", + checkActiveUpdate: null, + continueFile: CONTINUE_CHECK, + }, + { + panelId: "downloadAndInstall", + checkActiveUpdate: null, + continueFile: null, + }, + { + panelId: "downloading", + checkActiveUpdate: { state: STATE_DOWNLOADING }, + continueFile: CONTINUE_DOWNLOAD, + downloadInfo, + }, + { + panelId: "apply", + checkActiveUpdate: { state: STATE_PENDING }, + continueFile: null, + }, + ]); +}); diff --git a/toolkit/mozapps/update/tests/browser/manual_app_update_only/browser_aboutDialog_fc_autoUpdateTrue.js b/toolkit/mozapps/update/tests/browser/manual_app_update_only/browser_aboutDialog_fc_autoUpdateTrue.js new file mode 100644 index 0000000000..0a59f59d71 --- /dev/null +++ b/toolkit/mozapps/update/tests/browser/manual_app_update_only/browser_aboutDialog_fc_autoUpdateTrue.js @@ -0,0 +1,43 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +add_task(async function test_manual_app_update_policy() { + await setAppUpdateAutoEnabledHelper(true); + + is( + Services.policies.isAllowed("autoAppUpdateChecking"), + false, + "autoAppUpdateChecking should be disabled by policy" + ); + is(gAUS.manualUpdateOnly, true, "gAUS.manualUpdateOnly should be true"); + + let downloadInfo = [{ patchType: "partial", internalResult: "0" }]; + // Since the partial should be successful specify an invalid size for the + // complete update. + let params = { queryString: "&invalidCompleteSize=1" }; + await runAboutDialogUpdateTest(params, [ + { + panelId: "checkingForUpdates", + checkActiveUpdate: null, + continueFile: CONTINUE_CHECK, + }, + { + panelId: "downloadAndInstall", + checkActiveUpdate: null, + continueFile: null, + }, + { + panelId: "downloading", + checkActiveUpdate: { state: STATE_DOWNLOADING }, + continueFile: CONTINUE_DOWNLOAD, + downloadInfo, + }, + { + panelId: "apply", + checkActiveUpdate: { state: STATE_PENDING }, + continueFile: null, + }, + ]); +}); diff --git a/toolkit/mozapps/update/tests/browser/manual_app_update_only/browser_aboutPrefs_fc_autoUpdateFalse.js b/toolkit/mozapps/update/tests/browser/manual_app_update_only/browser_aboutPrefs_fc_autoUpdateFalse.js new file mode 100644 index 0000000000..2d9608951e --- /dev/null +++ b/toolkit/mozapps/update/tests/browser/manual_app_update_only/browser_aboutPrefs_fc_autoUpdateFalse.js @@ -0,0 +1,55 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +add_task(async function test_manual_app_update_policy() { + await setAppUpdateAutoEnabledHelper(false); + + is( + Services.policies.isAllowed("autoAppUpdateChecking"), + false, + "autoAppUpdateChecking should be disabled by policy" + ); + is(gAUS.manualUpdateOnly, true, "gAUS.manualUpdateOnly should be true"); + + let downloadInfo = [{ patchType: "partial", internalResult: "0" }]; + // Since the partial should be successful specify an invalid size for the + // complete update. + let params = { queryString: "&invalidCompleteSize=1" }; + await runAboutPrefsUpdateTest(params, [ + { + panelId: "checkingForUpdates", + checkActiveUpdate: null, + continueFile: CONTINUE_CHECK, + }, + { + panelId: "downloadAndInstall", + checkActiveUpdate: null, + continueFile: null, + }, + { + panelId: "downloading", + checkActiveUpdate: { state: STATE_DOWNLOADING }, + continueFile: CONTINUE_DOWNLOAD, + downloadInfo, + }, + { + panelId: "apply", + checkActiveUpdate: { state: STATE_PENDING }, + continueFile: null, + }, + async tab => { + await SpecialPowers.spawn(tab.linkedBrowser, [], async function () { + let setting = content.document.getElementById( + "updateSettingsContainer" + ); + is( + setting.hidden, + true, + "Update choices should be disabled when manualUpdateOnly" + ); + }); + }, + ]); +}); diff --git a/toolkit/mozapps/update/tests/browser/manual_app_update_only/browser_aboutPrefs_fc_autoUpdateTrue.js b/toolkit/mozapps/update/tests/browser/manual_app_update_only/browser_aboutPrefs_fc_autoUpdateTrue.js new file mode 100644 index 0000000000..b7b0c1027a --- /dev/null +++ b/toolkit/mozapps/update/tests/browser/manual_app_update_only/browser_aboutPrefs_fc_autoUpdateTrue.js @@ -0,0 +1,55 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +add_task(async function test_manual_app_update_policy() { + await setAppUpdateAutoEnabledHelper(true); + + is( + Services.policies.isAllowed("autoAppUpdateChecking"), + false, + "autoAppUpdateChecking should be disabled by policy" + ); + is(gAUS.manualUpdateOnly, true, "gAUS.manualUpdateOnly should be true"); + + let downloadInfo = [{ patchType: "partial", internalResult: "0" }]; + // Since the partial should be successful specify an invalid size for the + // complete update. + let params = { queryString: "&invalidCompleteSize=1" }; + await runAboutPrefsUpdateTest(params, [ + { + panelId: "checkingForUpdates", + checkActiveUpdate: null, + continueFile: CONTINUE_CHECK, + }, + { + panelId: "downloadAndInstall", + checkActiveUpdate: null, + continueFile: null, + }, + { + panelId: "downloading", + checkActiveUpdate: { state: STATE_DOWNLOADING }, + continueFile: CONTINUE_DOWNLOAD, + downloadInfo, + }, + { + panelId: "apply", + checkActiveUpdate: { state: STATE_PENDING }, + continueFile: null, + }, + async tab => { + await SpecialPowers.spawn(tab.linkedBrowser, [], async function () { + let setting = content.document.getElementById( + "updateSettingsContainer" + ); + is( + setting.hidden, + true, + "Update choices should be disabled when manualUpdateOnly" + ); + }); + }, + ]); +}); diff --git a/toolkit/mozapps/update/tests/browser/manual_app_update_only/browser_noBackgroundUpdate.js b/toolkit/mozapps/update/tests/browser/manual_app_update_only/browser_noBackgroundUpdate.js new file mode 100644 index 0000000000..38b27e31ad --- /dev/null +++ b/toolkit/mozapps/update/tests/browser/manual_app_update_only/browser_noBackgroundUpdate.js @@ -0,0 +1,17 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +add_task(async function test_manual_app_update_policy() { + // Unfortunately, we can't really test the other background update entry + // point, gAUS.notify, because it doesn't return anything and it would be + // a bit overkill to edit the nsITimerCallback interface just for this test. + // But the two entry points just immediately call the same function, so this + // should probably be alright. + is( + gAUS.checkForBackgroundUpdates(), + false, + "gAUS.checkForBackgroundUpdates() should not proceed with update check" + ); +}); diff --git a/toolkit/mozapps/update/tests/browser/manual_app_update_only/config_manual_app_update_only.json b/toolkit/mozapps/update/tests/browser/manual_app_update_only/config_manual_app_update_only.json new file mode 100644 index 0000000000..4e7c785bc1 --- /dev/null +++ b/toolkit/mozapps/update/tests/browser/manual_app_update_only/config_manual_app_update_only.json @@ -0,0 +1,5 @@ +{ + "policies": { + "ManualAppUpdateOnly": true + } +} diff --git a/toolkit/mozapps/update/tests/browser/manual_app_update_only/head.js b/toolkit/mozapps/update/tests/browser/manual_app_update_only/head.js new file mode 100644 index 0000000000..2a7576963b --- /dev/null +++ b/toolkit/mozapps/update/tests/browser/manual_app_update_only/head.js @@ -0,0 +1,9 @@ +/* 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 +); |