Skip to content

Commit

Permalink
Bug 940966 - [Download Manager] [DownloadFormatter] The field started…
Browse files Browse the repository at this point in the history
… is startTime in the API
  • Loading branch information
crdlc committed Nov 20, 2013
1 parent 234fbc3 commit 4714c79
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
4 changes: 1 addition & 3 deletions apps/settings/test/unit/download_formatter_test.js
Expand Up @@ -204,13 +204,11 @@ suite('DownloadFormatter', function() {
var mockDownload = new MockDownload(
{
url: 'http://firefoxos.com/fichero.mp4',
started: now
startTime: now
}
);
var expectedUUID = 'fichero.mp4' + now.getTime();
var retrievedUUID = DownloadFormatter.getUUID(mockDownload);
assert.equal(retrievedUUID, expectedUUID);
});
});


5 changes: 2 additions & 3 deletions shared/js/download/download_formatter.js
Expand Up @@ -68,18 +68,17 @@
return _calcPercentage(downloadedBytes, totalBytes);
},
getDate: function(download, callback) {
var date = download.started;
var date = download.startTime;
LazyLoader.load(['shared/js/l10n_date.js'], function onload() {
var prettyDate = navigator.mozL10n.DateTimeFormat().fromNow(date, true);
callback && callback(prettyDate);
});
},
getUUID: function(download) {
return this.getFileName(download) + download.started.getTime();
return this.getFileName(download) + download.startTime.getTime();
}
};

exports.DownloadFormatter = DownloadFormatter;

}(this));

8 changes: 4 additions & 4 deletions shared/test/unit/mocks/mock_download.js
Expand Up @@ -8,7 +8,7 @@ var DEFAULT_PARAMS = {
path: '//SDCARD/Downloads/archivo.mp3',
state: 'downloading',
contentType: 'audio/mpeg',
started: new Date()
startTime: new Date()
};

function MockDownload(params) {
Expand All @@ -18,7 +18,7 @@ function MockDownload(params) {
this.path = params.path || DEFAULT_PARAMS.path;
this.state = params.state || DEFAULT_PARAMS.state;
this.contentType = params.contentType || DEFAULT_PARAMS.contentType;
this.started = params.started || DEFAULT_PARAMS.started;
this.startTime = params.startTime || DEFAULT_PARAMS.startTime;
}

MockAttachment.prototype = {
Expand All @@ -40,8 +40,8 @@ MockAttachment.prototype = {
get contentType() {
return this.contentType;
},
get started() {
return this.started;
get startTime() {
return this.startTime;
},
cancel: function() {},
pause: function() {},
Expand Down

0 comments on commit 4714c79

Please sign in to comment.