Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Bug 804571: Support for canceling (pausing) system update downloads. #6724

Merged
merged 3 commits into from

2 participants

apps/system/test/unit/updatable_test.js
@@ -199,6 +199,15 @@ suite('system/Updatable', function() {
test('should call cancelDownload on the app', function() {
assert.isTrue(mockApp.mCancelCalled);
});
+
+ test('should send cancel message for system updates', function() {
+ subject = new SystemUpdatable(42);
+ subject._dispatchEvent = fakeDispatchEvent;
+ subject.cancelDownload();
+
+ assert.equal('update-download-cancel', lastDispatchedEvent.type);
+ assert.equal(subject, MockUpdateManager.mLastDownloadsRemoval);
@etiennesegonzac Collaborator

nit: if you break it in 2 tests we'll have it nicely documented from looking at the tests results that we're dispatching the event and removing it from the updates queue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@marshall marshall merged commit 9afa4dd into mozilla-b2g:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 29, 2012
  1. @marshall
Commits on Nov 30, 2012
  1. @marshall
Commits on Dec 4, 2012
  1. @marshall
This page is out of date. Refresh to see the latest.
View
3  apps/system/js/updatable.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() {
View
19 apps/system/test/unit/updatable_test.js
@@ -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() {
Something went wrong with that request. Please try again.