mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-18 15:55:36 +00:00
Bug 1664829 - Add nsIProgressEventSink to AppUpdater so that download progress is correctly reported again. r=bytesized
`AppUpdater` just needs to declare that it implements `nsIProgressEventSink`. `nsIProgressEventSink.onProgress` is the method that's called whenever download progress is made, and `AppUpdater` implements it, but the caller doesn't call it because it checks that consumers are `instanceof nsIProgressEventSink`: https://searchfox.org/mozilla-central/source/toolkit/mozapps/update/UpdateService.jsm#5014 The legacy aboutDialog updater (which I removed in bug 1600864) has this exact `generateQI` call, I just forgot to port it over to `AppUpdater`. It also includes `nsIRequestObserver` since AppUpdater (and the legacy aboutDialog updater) implements it too. I've updated all the updater tests (via their head.js) so that they check the download progress text. This applies to aboutDialog and about:preferences tests. Differential Revision: https://phabricator.services.mozilla.com/D90632
This commit is contained in:
parent
1d58fba49c
commit
433b8b3f69
@ -45,6 +45,10 @@ class AppUpdater {
|
||||
"@mozilla.org/updates/update-manager;1",
|
||||
"nsIUpdateManager"
|
||||
);
|
||||
this.QueryInterface = ChromeUtils.generateQI([
|
||||
"nsIProgressEventSink",
|
||||
"nsIRequestObserver",
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -12,6 +12,11 @@ ChromeUtils.defineModuleGetter(
|
||||
"AppMenuNotifications",
|
||||
"resource://gre/modules/AppMenuNotifications.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"DownloadUtils",
|
||||
"resource://gre/modules/DownloadUtils.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"UpdateListener",
|
||||
@ -783,6 +788,22 @@ function runAboutDialogUpdateTest(params, steps) {
|
||||
" value should equal " +
|
||||
data[resultName]
|
||||
);
|
||||
|
||||
// Check the download status text. It should be something like,
|
||||
// "1.4 of 1.4 KB".
|
||||
let expectedText = DownloadUtils.getTransferTotal(
|
||||
data[resultName] == gBadSizeResult ? 0 : patch.size,
|
||||
patch.size
|
||||
);
|
||||
Assert.ok(
|
||||
expectedText,
|
||||
"Sanity check: Expected download status text should be non-empty"
|
||||
);
|
||||
Assert.equal(
|
||||
aboutDialog.downloadStatus.textContent,
|
||||
expectedText,
|
||||
"Download status text should be correct"
|
||||
);
|
||||
}
|
||||
}
|
||||
} else if (continueFile) {
|
||||
@ -977,6 +998,28 @@ function runAboutPrefsUpdateTest(params, steps) {
|
||||
" value should equal " +
|
||||
data[resultName]
|
||||
);
|
||||
|
||||
// Check the download status text. It should be something like,
|
||||
// "Downloading update — 1.4 of 1.4 KB". We check only the second
|
||||
// part to make sure that the downloaded size is updated correctly.
|
||||
let actualText = await SpecialPowers.spawn(
|
||||
tab.linkedBrowser,
|
||||
[],
|
||||
() => content.document.getElementById("downloading").textContent
|
||||
);
|
||||
let expectedSuffix = DownloadUtils.getTransferTotal(
|
||||
data[resultName] == gBadSizeResult ? 0 : patch.size,
|
||||
patch.size
|
||||
);
|
||||
Assert.ok(
|
||||
expectedSuffix,
|
||||
"Sanity check: Expected download status text should be non-empty"
|
||||
);
|
||||
Assert.ok(
|
||||
actualText.endsWith(expectedSuffix),
|
||||
"Download status text should end as expected: " +
|
||||
JSON.stringify({ actualText, expectedSuffix })
|
||||
);
|
||||
}
|
||||
}
|
||||
} else if (continueFile) {
|
||||
|
Loading…
Reference in New Issue
Block a user