Permalink
Browse files

Merge pull request #6724 from marshall/updateDownloadCancel

Bug 804571: Support for canceling (pausing) system update downloads.
  • Loading branch information...
2 parents 26b8f9d + 1768a81 commit 9afa4dd241846bbfbf106fb4021f6c96e04a3ebe @marshall marshall committed Dec 4, 2012
Showing with 20 additions and 2 deletions.
  1. +2 −1 apps/system/js/updatable.js
  2. +18 −1 apps/system/test/unit/updatable_test.js
@@ -112,7 +112,8 @@ SystemUpdatable.prototype.download = function() {
};
SystemUpdatable.prototype.cancelDownload = function() {
- // Not implemented yet https://bugzilla.mozilla.org/show_bug.cgi?id=804571
+ this._dispatchEvent('update-download-cancel');
+ UpdateManager.removeFromDownloadsQueue(this);
};
SystemUpdatable.prototype.uninit = function() {
@@ -185,7 +185,7 @@ suite('system/Updatable', function() {
});
});
- suite('cancel download', function() {
+ suite('cancel app update download', function() {
setup(function() {
subject.cancelDownload();
});
@@ -200,6 +200,23 @@ suite('system/Updatable', function() {
assert.isTrue(mockApp.mCancelCalled);
});
});
+
+ suite('cancel system update download', function() {
+ setup(function() {
+ subject = new SystemUpdatable(42);
+ subject._dispatchEvent = fakeDispatchEvent;
+ subject.cancelDownload();
+ });
+
+ test('should remove self from active downloads', function() {
+ assert.isNotNull(MockUpdateManager.mLastDownloadsRemoval);
+ assert.equal(subject, MockUpdateManager.mLastDownloadsRemoval);
+ });
+
+ test('should send cancel message', function() {
+ assert.equal('update-download-cancel', lastDispatchedEvent.type);
+ });
+ });
});
suite('events', function() {

0 comments on commit 9afa4dd

Please sign in to comment.