Bug 1875502 - Pre: Update tests to accomodate async readyUpdate r=nalexander,application-update-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D209116
This commit is contained in:
Robin Steuber
2024-05-15 17:06:13 +00:00
parent e58f96019c
commit bcc4b4f167
19 changed files with 125 additions and 80 deletions

View File

@@ -32,10 +32,10 @@ add_task(async function whats_new_page() {
Ci.nsIUpdateManager Ci.nsIUpdateManager
); );
await TestUtils.waitForCondition( await TestUtils.waitForCondition(
() => !um.readyUpdate, async () => !(await um.getReadyUpdate()),
"Waiting for the ready update to be removed" "Waiting for the ready update to be removed"
); );
ok(!um.readyUpdate, "There should not be a ready update"); ok(!(await um.getReadyUpdate()), "There should not be a ready update");
let history; let history;
await TestUtils.waitForCondition(async () => { await TestUtils.waitForCondition(async () => {
history = await um.getHistory(); history = await um.getHistory();

View File

@@ -33,10 +33,10 @@ add_task(async function nimbus_whats_new_page() {
Ci.nsIUpdateManager Ci.nsIUpdateManager
); );
await TestUtils.waitForCondition( await TestUtils.waitForCondition(
() => !um.readyUpdate, async () => !(await um.getReadyUpdate()),
"Waiting for the ready update to be removed" "Waiting for the ready update to be removed"
); );
ok(!um.readyUpdate, "There should not be a ready update"); ok(!(await um.getReadyUpdate()), "There should not be a ready update");
let history; let history;
await TestUtils.waitForCondition(async () => { await TestUtils.waitForCondition(async () => {
history = await um.getHistory(); history = await um.getHistory();

View File

@@ -228,7 +228,7 @@ async function processUpdateStep(step) {
); );
} else { } else {
Assert.ok( Assert.ok(
!gUpdateManager.readyUpdate, !(await gUpdateManager.getReadyUpdate()),
"There should not be a ready update" "There should not be a ready update"
); );
Assert.ok( Assert.ok(

View File

@@ -69,7 +69,7 @@ async function changeAndVerifyUpdateWrites({
`We should ${expectPrompt ? "" : "not "}be prompted` `We should ${expectPrompt ? "" : "not "}be prompted`
); );
is( is(
!!gUpdateManager.readyUpdate, !!(await gUpdateManager.getReadyUpdate()),
expectRemainingUpdate, expectRemainingUpdate,
`There should ${expectRemainingUpdate ? "" : "not "}be a ready update` `There should ${expectRemainingUpdate ? "" : "not "}be a ready update`
); );
@@ -92,7 +92,10 @@ add_task(async function testUpdateAutoPrefUI() {
!gUpdateManager.downloadingUpdate, !gUpdateManager.downloadingUpdate,
"There should not be a downloading update" "There should not be a downloading update"
); );
ok(!gUpdateManager.readyUpdate, "There should not be a ready update"); ok(
!(await gUpdateManager.getReadyUpdate()),
"There should not be a ready update"
);
info("Disable automatic updates and check that works."); info("Disable automatic updates and check that works.");
await changeAndVerifyPref(tab, false); await changeAndVerifyPref(tab, false);
@@ -100,7 +103,10 @@ add_task(async function testUpdateAutoPrefUI() {
!gUpdateManager.downloadingUpdate, !gUpdateManager.downloadingUpdate,
"There should not be a downloading update" "There should not be a downloading update"
); );
ok(!gUpdateManager.readyUpdate, "There should not be a ready update"); ok(
!(await gUpdateManager.getReadyUpdate()),
"There should not be a ready update"
);
let patchProps = { state: STATE_PENDING }; let patchProps = { state: STATE_PENDING };
let patches = getLocalPatchString(patchProps); let patches = getLocalPatchString(patchProps);
@@ -109,7 +115,10 @@ add_task(async function testUpdateAutoPrefUI() {
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true); writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeStatusFile(STATE_PENDING); writeStatusFile(STATE_PENDING);
reloadUpdateManagerData(); reloadUpdateManagerData();
ok(!!gUpdateManager.readyUpdate, "There should be a ready update"); ok(
!!(await gUpdateManager.getReadyUpdate()),
"There should be a ready update"
);
let { prompt } = Services; let { prompt } = Services;
registerCleanupFunction(() => { registerCleanupFunction(() => {

View File

@@ -22,7 +22,7 @@ add_task(async function doorhanger_bc_downloaded_disableBITS() {
let patch = getPatchOfType( let patch = getPatchOfType(
"partial", "partial",
gUpdateManager.readyUpdate await gUpdateManager.getReadyUpdate()
).QueryInterface(Ci.nsIWritablePropertyBag); ).QueryInterface(Ci.nsIWritablePropertyBag);
ok( ok(
!patch.getProperty("bitsId"), !patch.getProperty("bitsId"),

View File

@@ -44,9 +44,10 @@ add_task(async function elevation_dialog() {
() => !Services.wm.getMostRecentWindow("Update:Elevation"), () => !Services.wm.getMostRecentWindow("Update:Elevation"),
"The Update Elevation dialog should have closed" "The Update Elevation dialog should have closed"
); );
ok(!!gUpdateManager.readyUpdate, "There should be a ready update"); let readyUpdate = await gUpdateManager.getReadyUpdate();
ok(!!readyUpdate, "There should be a ready update");
is( is(
gUpdateManager.readyUpdate.state, readyUpdate.state,
STATE_PENDING_ELEVATE, STATE_PENDING_ELEVATE,
"The ready update state should equal " + STATE_PENDING_ELEVATE "The ready update state should equal " + STATE_PENDING_ELEVATE
); );
@@ -64,7 +65,8 @@ add_task(async function elevation_dialog() {
() => !Services.wm.getMostRecentWindow("Update:Elevation"), () => !Services.wm.getMostRecentWindow("Update:Elevation"),
"The Update Elevation dialog should have closed" "The Update Elevation dialog should have closed"
); );
ok(!gUpdateManager.readyUpdate, "There should not be a ready update"); readyUpdate = await gUpdateManager.getReadyUpdate();
ok(!readyUpdate, "There should not be a ready update");
is( is(
readStatusFile(), readStatusFile(),
STATE_NONE, STATE_NONE,
@@ -79,9 +81,10 @@ add_task(async function elevation_dialog() {
() => !Services.wm.getMostRecentWindow("Update:Elevation"), () => !Services.wm.getMostRecentWindow("Update:Elevation"),
"The Update Elevation dialog should have closed" "The Update Elevation dialog should have closed"
); );
ok(!!gUpdateManager.readyUpdate, "There should be a ready update"); readyUpdate = await gUpdateManager.getReadyUpdate();
ok(!!readyUpdate, "There should be a ready update");
is( is(
gUpdateManager.readyUpdate.state, readyUpdate.state,
STATE_PENDING_ELEVATE, STATE_PENDING_ELEVATE,
"The active update state should equal " + STATE_PENDING_ELEVATE "The active update state should equal " + STATE_PENDING_ELEVATE
); );

View File

@@ -576,10 +576,9 @@ function runDoorhangerUpdateTest(params, steps) {
); );
if (checkActiveUpdate) { if (checkActiveUpdate) {
let activeUpdate = let activeUpdate = await (checkActiveUpdate.state == STATE_DOWNLOADING
checkActiveUpdate.state == STATE_DOWNLOADING ? gUpdateManager.downloadingUpdate
? gUpdateManager.downloadingUpdate : gUpdateManager.getReadyUpdate());
: gUpdateManager.readyUpdate;
ok(!!activeUpdate, "There should be an active update"); ok(!!activeUpdate, "There should be an active update");
is( is(
activeUpdate.state, activeUpdate.state,
@@ -591,7 +590,10 @@ function runDoorhangerUpdateTest(params, steps) {
!gUpdateManager.downloadingUpdate, !gUpdateManager.downloadingUpdate,
"There should not be a downloading update" "There should not be a downloading update"
); );
ok(!gUpdateManager.readyUpdate, "There should not be a ready update"); ok(
!(await gUpdateManager.getReadyUpdate()),
"There should not be a ready update"
);
} }
let buttonEl = getNotificationButton(window, notificationId, button); let buttonEl = getNotificationButton(window, notificationId, button);
@@ -753,10 +755,9 @@ function runAboutDialogUpdateTest(params, steps) {
); );
if (checkActiveUpdate) { if (checkActiveUpdate) {
let activeUpdate = let activeUpdate = await (checkActiveUpdate.state == STATE_DOWNLOADING
checkActiveUpdate.state == STATE_DOWNLOADING ? gUpdateManager.downloadingUpdate
? gUpdateManager.downloadingUpdate : gUpdateManager.getReadyUpdate());
: gUpdateManager.readyUpdate;
ok(!!activeUpdate, "There should be an active update"); ok(!!activeUpdate, "There should be an active update");
is( is(
activeUpdate.state, activeUpdate.state,
@@ -768,7 +769,10 @@ function runAboutDialogUpdateTest(params, steps) {
!gUpdateManager.downloadingUpdate, !gUpdateManager.downloadingUpdate,
"There should not be a downloading update" "There should not be a downloading update"
); );
ok(!gUpdateManager.readyUpdate, "There should not be a ready update"); ok(
!(await gUpdateManager.getReadyUpdate()),
"There should not be a ready update"
);
} }
// Some tests just want to stop at the downloading state. These won't // Some tests just want to stop at the downloading state. These won't
@@ -1060,10 +1064,9 @@ function runAboutPrefsUpdateTest(params, steps) {
); );
if (checkActiveUpdate) { if (checkActiveUpdate) {
let activeUpdate = let activeUpdate = await (checkActiveUpdate.state == STATE_DOWNLOADING
checkActiveUpdate.state == STATE_DOWNLOADING ? gUpdateManager.downloadingUpdate
? gUpdateManager.downloadingUpdate : gUpdateManager.getReadyUpdate());
: gUpdateManager.readyUpdate;
ok(!!activeUpdate, "There should be an active update"); ok(!!activeUpdate, "There should be an active update");
is( is(
activeUpdate.state, activeUpdate.state,
@@ -1075,7 +1078,10 @@ function runAboutPrefsUpdateTest(params, steps) {
!gUpdateManager.downloadingUpdate, !gUpdateManager.downloadingUpdate,
"There should not be a downloading update" "There should not be a downloading update"
); );
ok(!gUpdateManager.readyUpdate, "There should not be a ready update"); ok(
!(await gUpdateManager.getReadyUpdate()),
"There should not be a ready update"
);
} }
if (panelId == "downloading") { if (panelId == "downloading") {

View File

@@ -1312,10 +1312,9 @@ async function checkUpdateManager(
aUpdateErrCode, aUpdateErrCode,
aUpdateCount aUpdateCount
) { ) {
let activeUpdate = let activeUpdate = await (aUpdateStatusState == STATE_DOWNLOADING
aUpdateStatusState == STATE_DOWNLOADING ? gUpdateManager.downloadingUpdate
? gUpdateManager.downloadingUpdate : gUpdateManager.getReadyUpdate());
: gUpdateManager.readyUpdate;
Assert.equal( Assert.equal(
readStatusState(), readStatusState(),
aStatusFileState, aStatusFileState,
@@ -2286,7 +2285,7 @@ function checkSymlink() {
/** /**
* Sets the active update and related information for updater tests. * Sets the active update and related information for updater tests.
*/ */
function setupActiveUpdate() { async function setupActiveUpdate() {
let pendingState = gIsServiceTest ? STATE_PENDING_SVC : STATE_PENDING; let pendingState = gIsServiceTest ? STATE_PENDING_SVC : STATE_PENDING;
let patchProps = { state: pendingState }; let patchProps = { state: pendingState };
let patches = getLocalPatchString(patchProps); let patches = getLocalPatchString(patchProps);
@@ -2295,7 +2294,10 @@ function setupActiveUpdate() {
writeVersionFile(DEFAULT_UPDATE_VERSION); writeVersionFile(DEFAULT_UPDATE_VERSION);
writeStatusFile(pendingState); writeStatusFile(pendingState);
reloadUpdateManagerData(); reloadUpdateManagerData();
Assert.ok(!!gUpdateManager.readyUpdate, "the ready update should be defined"); Assert.ok(
!!(await gUpdateManager.getReadyUpdate()),
"the ready update should be defined"
);
} }
/** /**
@@ -2357,7 +2359,7 @@ async function stageUpdate(
); );
Assert.equal( Assert.equal(
gUpdateManager.readyUpdate.state, (await gUpdateManager.getReadyUpdate()).state,
aStateAfterStage, aStateAfterStage,
"the update state" + MSG_SHOULD_EQUAL "the update state" + MSG_SHOULD_EQUAL
); );
@@ -3299,7 +3301,7 @@ async function setupUpdaterTest(
}); });
if (aSetupActiveUpdate) { if (aSetupActiveUpdate) {
setupActiveUpdate(); await setupActiveUpdate();
} }
if (aPostUpdateAsync !== null) { if (aPostUpdateAsync !== null) {

View File

@@ -26,7 +26,10 @@ async function run_test() {
!gUpdateManager.downloadingUpdate, !gUpdateManager.downloadingUpdate,
"there should not be a downloading update" "there should not be a downloading update"
); );
Assert.ok(!gUpdateManager.readyUpdate, "there should not be a ready update"); Assert.ok(
!(await gUpdateManager.getReadyUpdate()),
"there should not be a ready update"
);
const history = await gUpdateManager.getHistory(); const history = await gUpdateManager.getHistory();
Assert.equal( Assert.equal(
history.length, history.length,

View File

@@ -24,7 +24,10 @@ async function run_test() {
!gUpdateManager.downloadingUpdate, !gUpdateManager.downloadingUpdate,
"there should not be a downloading update" "there should not be a downloading update"
); );
Assert.ok(!gUpdateManager.readyUpdate, "there should not be a ready update"); Assert.ok(
!(await gUpdateManager.getReadyUpdate()),
"there should not be a ready update"
);
const history = await gUpdateManager.getHistory(); const history = await gUpdateManager.getHistory();
Assert.equal( Assert.equal(
history.length, history.length,

View File

@@ -25,7 +25,10 @@ async function run_test() {
!gUpdateManager.downloadingUpdate, !gUpdateManager.downloadingUpdate,
"there should not be a downloading update" "there should not be a downloading update"
); );
Assert.ok(!gUpdateManager.readyUpdate, "there should not be a ready update"); Assert.ok(
!(await gUpdateManager.getReadyUpdate()),
"there should not be a ready update"
);
const history = await gUpdateManager.getHistory(); const history = await gUpdateManager.getHistory();
Assert.equal( Assert.equal(
history.length, history.length,

View File

@@ -23,7 +23,10 @@ async function run_test() {
!gUpdateManager.downloadingUpdate, !gUpdateManager.downloadingUpdate,
"there should not be a downloading update" "there should not be a downloading update"
); );
Assert.ok(!gUpdateManager.readyUpdate, "there should not be a ready update"); Assert.ok(
!(await gUpdateManager.getReadyUpdate()),
"there should not be a ready update"
);
const history = await gUpdateManager.getHistory(); const history = await gUpdateManager.getHistory();
Assert.equal( Assert.equal(
history.length, history.length,

View File

@@ -23,7 +23,10 @@ async function run_test() {
!gUpdateManager.downloadingUpdate, !gUpdateManager.downloadingUpdate,
"there should not be a downloading update" "there should not be a downloading update"
); );
Assert.ok(!gUpdateManager.readyUpdate, "there should not be a ready update"); Assert.ok(
!(await gUpdateManager.getReadyUpdate()),
"there should not be a ready update"
);
const history = await gUpdateManager.getHistory(); const history = await gUpdateManager.getHistory();
Assert.equal( Assert.equal(
history.length, history.length,

View File

@@ -27,7 +27,10 @@ async function run_test() {
!gUpdateManager.downloadingUpdate, !gUpdateManager.downloadingUpdate,
"there should not be a downloading update" "there should not be a downloading update"
); );
Assert.ok(!gUpdateManager.readyUpdate, "there should not be a ready update"); Assert.ok(
!(await gUpdateManager.getReadyUpdate()),
"there should not be a ready update"
);
const history = await gUpdateManager.getHistory(); const history = await gUpdateManager.getHistory();
Assert.equal( Assert.equal(
history.length, history.length,

View File

@@ -105,7 +105,10 @@ async function testCleanupSuccessLogsFIFO(
!gUpdateManager.downloadingUpdate, !gUpdateManager.downloadingUpdate,
"there should not be a downloading update" "there should not be a downloading update"
); );
Assert.ok(!gUpdateManager.readyUpdate, "there should not be a ready update"); Assert.ok(
!(await gUpdateManager.getReadyUpdate()),
"there should not be a ready update"
);
const history = await gUpdateManager.getHistory(); const history = await gUpdateManager.getHistory();
Assert.equal( Assert.equal(
history.length, history.length,

View File

@@ -73,9 +73,9 @@ async function downloadUpdate(appUpdateAuto, onDownloadStartCallback) {
} }
let waitToStartPromise = new Promise(resolve => { let waitToStartPromise = new Promise(resolve => {
let listener = { let listener = {
onStartRequest: _aRequest => { onStartRequest: async _aRequest => {
gAUS.removeDownloadListener(listener); gAUS.removeDownloadListener(listener);
onDownloadStartCallback(); await onDownloadStartCallback();
resolve(); resolve();
}, },
onProgress: (_aRequest, _aContext, _aProgress, _aMaxProgress) => {}, onProgress: (_aRequest, _aContext, _aProgress, _aMaxProgress) => {},
@@ -197,11 +197,9 @@ async function multi_update_test(appUpdateAuto) {
prepareToDownloadVersion(FIRST_UPDATE_VERSION); prepareToDownloadVersion(FIRST_UPDATE_VERSION);
await downloadUpdate(appUpdateAuto, () => { await downloadUpdate(appUpdateAuto, async () => {
Assert.ok( const readyUpdate = await gUpdateManager.getReadyUpdate();
!gUpdateManager.readyUpdate, Assert.ok(!readyUpdate, "There should not be a ready update yet");
"There should not be a ready update yet"
);
Assert.ok( Assert.ok(
!!gUpdateManager.downloadingUpdate, !!gUpdateManager.downloadingUpdate,
"First update download should be in downloadingUpdate" "First update download should be in downloadingUpdate"
@@ -218,21 +216,19 @@ async function multi_update_test(appUpdateAuto) {
); );
}); });
let readyUpdate = await gUpdateManager.getReadyUpdate();
Assert.ok( Assert.ok(
!gUpdateManager.downloadingUpdate, !gUpdateManager.downloadingUpdate,
"First update download should no longer be in downloadingUpdate" "First update download should no longer be in downloadingUpdate"
); );
Assert.ok( Assert.ok(!!readyUpdate, "First update download should be in readyUpdate");
!!gUpdateManager.readyUpdate,
"First update download should be in readyUpdate"
);
Assert.equal( Assert.equal(
gUpdateManager.readyUpdate.state, readyUpdate.state,
STATE_PENDING, STATE_PENDING,
"readyUpdate should be pending" "readyUpdate should be pending"
); );
Assert.equal( Assert.equal(
gUpdateManager.readyUpdate.appVersion, readyUpdate.appVersion,
FIRST_UPDATE_VERSION, FIRST_UPDATE_VERSION,
"readyUpdate version should be match the version of the first update" "readyUpdate version should be match the version of the first update"
); );
@@ -242,21 +238,22 @@ async function multi_update_test(appUpdateAuto) {
"Updater state should be pending" "Updater state should be pending"
); );
let existingUpdate = gUpdateManager.readyUpdate; let existingUpdate = readyUpdate;
await testUpdateDoesNotDownload(); await testUpdateDoesNotDownload();
readyUpdate = await gUpdateManager.getReadyUpdate();
Assert.equal( Assert.equal(
gUpdateManager.readyUpdate, readyUpdate,
existingUpdate, existingUpdate,
"readyUpdate should not have changed when no newer update is available" "readyUpdate should not have changed when no newer update is available"
); );
Assert.equal( Assert.equal(
gUpdateManager.readyUpdate.state, readyUpdate.state,
STATE_PENDING, STATE_PENDING,
"readyUpdate should still be pending" "readyUpdate should still be pending"
); );
Assert.equal( Assert.equal(
gUpdateManager.readyUpdate.appVersion, readyUpdate.appVersion,
FIRST_UPDATE_VERSION, FIRST_UPDATE_VERSION,
"readyUpdate version should be match the version of the first update" "readyUpdate version should be match the version of the first update"
); );
@@ -271,18 +268,19 @@ async function multi_update_test(appUpdateAuto) {
prepareToDownloadVersion(SECOND_UPDATE_VERSION, true); prepareToDownloadVersion(SECOND_UPDATE_VERSION, true);
await testUpdateDoesNotDownload(); await testUpdateDoesNotDownload();
readyUpdate = await gUpdateManager.getReadyUpdate();
Assert.equal( Assert.equal(
gUpdateManager.readyUpdate, readyUpdate,
existingUpdate, existingUpdate,
"readyUpdate should not have changed when no newer partial update is available" "readyUpdate should not have changed when no newer partial update is available"
); );
Assert.equal( Assert.equal(
gUpdateManager.readyUpdate.state, readyUpdate.state,
STATE_PENDING, STATE_PENDING,
"readyUpdate should still be pending" "readyUpdate should still be pending"
); );
Assert.equal( Assert.equal(
gUpdateManager.readyUpdate.appVersion, readyUpdate.appVersion,
FIRST_UPDATE_VERSION, FIRST_UPDATE_VERSION,
"readyUpdate version should be match the version of the first update" "readyUpdate version should be match the version of the first update"
); );
@@ -294,7 +292,8 @@ async function multi_update_test(appUpdateAuto) {
prepareToDownloadVersion(SECOND_UPDATE_VERSION); prepareToDownloadVersion(SECOND_UPDATE_VERSION);
await downloadUpdate(appUpdateAuto, () => { await downloadUpdate(appUpdateAuto, async () => {
readyUpdate = await gUpdateManager.getReadyUpdate();
Assert.ok( Assert.ok(
!!gUpdateManager.downloadingUpdate, !!gUpdateManager.downloadingUpdate,
"Second update download should be in downloadingUpdate" "Second update download should be in downloadingUpdate"
@@ -305,16 +304,16 @@ async function multi_update_test(appUpdateAuto) {
"downloadingUpdate should be downloading" "downloadingUpdate should be downloading"
); );
Assert.ok( Assert.ok(
!!gUpdateManager.readyUpdate, !!readyUpdate,
"First update download should still be in readyUpdate" "First update download should still be in readyUpdate"
); );
Assert.equal( Assert.equal(
gUpdateManager.readyUpdate.state, readyUpdate.state,
STATE_PENDING, STATE_PENDING,
"readyUpdate should still be pending" "readyUpdate should still be pending"
); );
Assert.equal( Assert.equal(
gUpdateManager.readyUpdate.appVersion, readyUpdate.appVersion,
FIRST_UPDATE_VERSION, FIRST_UPDATE_VERSION,
"readyUpdate version should be match the version of the first update" "readyUpdate version should be match the version of the first update"
); );
@@ -325,21 +324,19 @@ async function multi_update_test(appUpdateAuto) {
); );
}); });
readyUpdate = await gUpdateManager.getReadyUpdate();
Assert.ok( Assert.ok(
!gUpdateManager.downloadingUpdate, !gUpdateManager.downloadingUpdate,
"Second update download should no longer be in downloadingUpdate" "Second update download should no longer be in downloadingUpdate"
); );
Assert.ok( Assert.ok(!!readyUpdate, "Second update download should be in readyUpdate");
!!gUpdateManager.readyUpdate,
"Second update download should be in readyUpdate"
);
Assert.equal( Assert.equal(
gUpdateManager.readyUpdate.state, readyUpdate.state,
STATE_PENDING, STATE_PENDING,
"readyUpdate should be pending" "readyUpdate should be pending"
); );
Assert.equal( Assert.equal(
gUpdateManager.readyUpdate.appVersion, readyUpdate.appVersion,
SECOND_UPDATE_VERSION, SECOND_UPDATE_VERSION,
"readyUpdate version should be match the version of the second update" "readyUpdate version should be match the version of the second update"
); );
@@ -356,7 +353,7 @@ async function multi_update_test(appUpdateAuto) {
// Second parameter forces a complete MAR download. // Second parameter forces a complete MAR download.
prepareToDownloadVersion(FIRST_UPDATE_VERSION, true); prepareToDownloadVersion(FIRST_UPDATE_VERSION, true);
await downloadUpdate(appUpdateAuto, () => { await downloadUpdate(appUpdateAuto, async () => {
Assert.equal( Assert.equal(
gUpdateManager.downloadingUpdate.selectedPatch.type, gUpdateManager.downloadingUpdate.selectedPatch.type,
"complete", "complete",
@@ -364,8 +361,9 @@ async function multi_update_test(appUpdateAuto) {
); );
}); });
readyUpdate = await gUpdateManager.getReadyUpdate();
Assert.equal( Assert.equal(
gUpdateManager.readyUpdate.selectedPatch.type, readyUpdate.selectedPatch.type,
"complete", "complete",
"First update download should be a complete patch" "First update download should be a complete patch"
); );

View File

@@ -50,7 +50,7 @@ add_task(async function onlyDownloadUpdatesThisSession() {
await downloadUpdate(); await downloadUpdate();
Assert.ok( Assert.ok(
!gUpdateManager.readyUpdate, !(await gUpdateManager.getReadyUpdate()),
"There should not be a ready update. The update should still be downloading" "There should not be a ready update. The update should still be downloading"
); );
Assert.ok( Assert.ok(

View File

@@ -159,7 +159,10 @@ async function run_test() {
!gUpdateManager.downloadingUpdate, !gUpdateManager.downloadingUpdate,
"there should not be a downloading update" "there should not be a downloading update"
); );
Assert.ok(!gUpdateManager.readyUpdate, "there should not be a ready update"); Assert.ok(
!(await gUpdateManager.getReadyUpdate()),
"there should not be a ready update"
);
const history = await gUpdateManager.getHistory(); const history = await gUpdateManager.getHistory();
Assert.equal( Assert.equal(
history.length, history.length,

View File

@@ -80,7 +80,10 @@ async function run_test() {
!gUpdateManager.downloadingUpdate, !gUpdateManager.downloadingUpdate,
"there should not be a downloading update" "there should not be a downloading update"
); );
Assert.ok(!gUpdateManager.readyUpdate, "there should not be a ready update"); Assert.ok(
!(await gUpdateManager.getReadyUpdate()),
"there should not be a ready update"
);
const history = await gUpdateManager.getHistory(); const history = await gUpdateManager.getHistory();
Assert.equal( Assert.equal(
history.length, history.length,