| OLD | NEW |
| 1 (function() | 1 (function() |
| 2 { | 2 { |
| 3 let testRunner = null; | 3 let testRunner = null; |
| 4 let requestHandlers = null; | 4 let requestHandlers = null; |
| 5 let randomResult = 0.5; | 5 let randomResult = 0.5; |
| 6 | 6 |
| 7 module("Synchronizer", { | 7 module("Synchronizer", { |
| 8 setup: function() | 8 setup: function() |
| 9 { | 9 { |
| 10 testRunner = this; | 10 testRunner = this; |
| 11 | 11 |
| 12 prepareFilterComponents.call(this); | 12 prepareFilterComponents.call(this); |
| 13 preparePrefs.call(this); | 13 preparePrefs.call(this); |
| 14 |
| 15 Synchronizer.init(); |
| 16 |
| 14 setupVirtualTime.call(this, function(wrapTimer) | 17 setupVirtualTime.call(this, function(wrapTimer) |
| 15 { | 18 { |
| 16 let SynchronizerModule = getModuleGlobal("synchronizer"); | 19 let SynchronizerModule = getModuleGlobal("synchronizer"); |
| 17 SynchronizerModule.downloader._timer = wrapTimer(SynchronizerModule.down
loader._timer); | 20 SynchronizerModule.downloader._timer = wrapTimer(SynchronizerModule.down
loader._timer); |
| 18 }, "synchronizer", "downloader"); | 21 }, "synchronizer", "downloader"); |
| 19 setupVirtualXMLHttp.call(this, "synchronizer", "downloader"); | 22 setupVirtualXMLHttp.call(this, "synchronizer", "downloader"); |
| 20 | 23 |
| 21 // Replace Math.random() function | 24 // Replace Math.random() function |
| 22 let DownloaderGlobal = Cu.getGlobalForObject(getModuleGlobal("downloader")
); | 25 let DownloaderGlobal = Cu.getGlobalForObject(getModuleGlobal("downloader")
); |
| 23 this._origRandom = DownloaderGlobal.Math.random; | 26 this._origRandom = DownloaderGlobal.Math.random; |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 | 513 |
| 511 testRunner.runScheduledTasks(24); | 514 testRunner.runScheduledTasks(24); |
| 512 | 515 |
| 513 equal(subscription.downloadStatus, "synchronize_connection_error", "download
Status after download error"); | 516 equal(subscription.downloadStatus, "synchronize_connection_error", "download
Status after download error"); |
| 514 equal(subscription.lastDownload * MILLIS_IN_SECOND, startTime + 26.1 * MILLI
S_IN_HOUR, "lastDownload after download error"); | 517 equal(subscription.lastDownload * MILLIS_IN_SECOND, startTime + 26.1 * MILLI
S_IN_HOUR, "lastDownload after download error"); |
| 515 equal(subscription.lastSuccess * MILLIS_IN_SECOND, startTime + 0.1 * MILLIS_
IN_HOUR, "lastSuccess after download error"); | 518 equal(subscription.lastSuccess * MILLIS_IN_SECOND, startTime + 0.1 * MILLIS_
IN_HOUR, "lastSuccess after download error"); |
| 516 equal(subscription.lastCheck * MILLIS_IN_SECOND, startTime + 27.1 * MILLIS_I
N_HOUR, "lastCheck after download error"); | 519 equal(subscription.lastCheck * MILLIS_IN_SECOND, startTime + 27.1 * MILLIS_I
N_HOUR, "lastCheck after download error"); |
| 517 equal(subscription.errors, 2, "errors after download error"); | 520 equal(subscription.errors, 2, "errors after download error"); |
| 518 }); | 521 }); |
| 519 })(); | 522 })(); |
| OLD | NEW |