diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/system/tests/preload-SystemUpdateManager-jsm.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/system/tests/preload-SystemUpdateManager-jsm.js')
-rw-r--r-- | dom/system/tests/preload-SystemUpdateManager-jsm.js | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/dom/system/tests/preload-SystemUpdateManager-jsm.js b/dom/system/tests/preload-SystemUpdateManager-jsm.js new file mode 100644 index 000000000..005b70461 --- /dev/null +++ b/dom/system/tests/preload-SystemUpdateManager-jsm.js @@ -0,0 +1,80 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +'use strict'; + +const {classes: Cc, interfaces: Ci, utils: Cu, manager: Cm} = Components; + +Cu.import('resource://gre/modules/XPCOMUtils.jsm'); + +const cid = '{17a84227-28f4-453d-9b80-9ae75a5682e0}'; +const contractId = '@mozilla.org/test-update-provider;1'; + +function TestUpdateProvider() {} +TestUpdateProvider.prototype = { + QueryInterface: XPCOMUtils.generateQI([Ci.nsISystemUpdateProvider]), + + checkForUpdate: function() { + dump('check for update'); + this._listener.onUpdateAvailable('test-type', 'test-version', 'test-description', Date.now().valueOf(), 5566); + }, + + startDownload: function() { + dump('test start download'); + this._listener.onProgress(10, 100); + }, + + stopDownload: function() { + dump('test stop download'); + }, + + applyUpdate: function() { + dump('apply update'); + }, + + setParameter: function(name, value) { + dump('set parameter'); + return (name === 'dummy' && value === 'dummy-value'); + }, + + getParameter: function(name) { + dump('get parameter'); + if (name === 'dummy') { + return 'dummy-value'; + } + }, + + setListener: function(listener) { + this._listener = listener; + }, + + unsetListener: function() { + this._listener = null; + }, +}; + +var factory = { + createInstance: function(outer, iid) { + if (outer) { + throw Components.results.NS_ERROR_NO_AGGREGATION; + } + + return new TestUpdateProvider().QueryInterface(iid); + }, + lockFactory: function(aLock) { + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + }, + QueryInterface: XPCOMUtils.generateQI([Ci.nsIFactory]) +}; + +Cm.nsIComponentRegistrar.registerFactory(Components.ID(cid), '', contractId, factory); + +var cm = Cc['@mozilla.org/categorymanager;1'].getService(Ci.nsICategoryManager); +cm.addCategoryEntry('system-update-provider', 'DummyProvider', + contractId + ',' + cid, false, true); + +Cu.import('resource://gre/modules/SystemUpdateService.jsm'); +this.SystemUpdateService.addProvider('{17a84227-28f4-453d-9b80-9ae75a5682e0}', + '@mozilla.org/test-update-provider;1', + 'DummyProvider');
\ No newline at end of file |