VulpesOS/gaia/apps/system/test/unit/mock_update_manager.js
OverSu b38dea0597 Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
2026-09-30 23:13:03 +02:00

85 lines
2.4 KiB
JavaScript
Executable file

'use strict';
/* exported MockUpdateManager */
var MockUpdateManager = {
_startedDownloadUsingDataConnection: false,
addToUpdatesQueue: function mum_addtoUpdateQueue(updatable) {
this.mLastUpdatesAdd = updatable;
this.mUpdates.push(updatable);
},
addToUpdatableApps: function mum_addToUpdatableApps(updatable) {
this.mLastUpdatableAdd = updatable;
},
removeFromUpdatesQueue: function mum_removeFromUpdateQueue(updatable) {
this.mLastUpdatesRemoval = updatable;
var index = this.mUpdates.indexOf(updatable);
if (index >= 0) {
this.mUpdates.splice(index, 1);
}
},
addToDownloadsQueue: function mum_addtoActiveDownloads(updatable) {
this.mLastDownloadsAdd = updatable;
this.mDownloads.push(updatable);
},
removeFromDownloadsQueue:
function mum_removeFromActiveDownloads(updatable) {
this.mLastDownloadsRemoval = updatable;
var index = this.mDownloads.indexOf(updatable);
if (index >= 0) {
this.mDownloads.splice(index, 1);
}
},
downloaded: function mum_downloaded(updatable) {
this.mDownloadedCalled = true;
},
downloadProgressed: function mum_downloadProgressed(bytes) {
this.mProgressCalledWith = bytes;
},
startedUncompressing: function mum_startedUncompressing() {
this.mStartedUncompressingCalled = true;
},
requestErrorBanner: function mum_requestErrorBanner() {
this.mErrorBannerRequested = true;
},
checkForUpdates: function mum_checkForUpdate(forced) {
this.mCheckForUpdatesCalledWith = forced;
},
mErrorBannerRequested: false,
mUpdates: [],
mDownloads: [],
mLastUpdatesAdd: null,
mLastUpdatableAdd: null,
mLastUpdatesRemoval: null,
mLastDownloadsAdd: null,
mLastDownloadsRemoval: null,
mProgressCalledWith: null,
mCheckForUpdatesCalledWith: null,
mStartedUncompressingCalled: false,
mDownloadedCalled: false,
mTeardown: function mum_mTeardown() {
this._startedDownloadUsingDataConnection = false;
this.mErrorBannerRequested = false;
this.mLastUpdatesAdd = null;
this.mLastUpdatableAdd = null;
this.mLastUpdatesRemoval = null;
this.mLastDownloadsAdd = null;
this.mLastDownloadsRemoval = null;
this.mProgressCalledWith = null;
this.mCheckForUpdatesCalledWith = null;
this.mStartedUncompressingCalled = false;
this.mDownloadedCalled = false;
this.mUpdates = [];
this.mDownloads = [];
}
};