You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/03/27 21:40:44 UTC
[1/2] spec commit: [CB-2226] Add spec test for FileTransfer.abort
error callback
Updated Branches:
refs/heads/master dbf631c43 -> da89eaacf
[CB-2226] Add spec test for FileTransfer.abort error callback
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/46e478f3
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/46e478f3
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/46e478f3
Branch: refs/heads/master
Commit: 46e478f306f6aae8d550ef8d688329b14bd6a2fa
Parents: dbf631c
Author: Ian Clelland <ic...@chromium.org>
Authored: Mon Mar 18 16:21:02 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Wed Mar 27 16:24:54 2013 -0400
----------------------------------------------------------------------
autotest/tests/filetransfer.tests.js | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/46e478f3/autotest/tests/filetransfer.tests.js
----------------------------------------------------------------------
diff --git a/autotest/tests/filetransfer.tests.js b/autotest/tests/filetransfer.tests.js
index f459bb4..a766879 100644
--- a/autotest/tests/filetransfer.tests.js
+++ b/autotest/tests/filetransfer.tests.js
@@ -276,6 +276,26 @@ describe('FileTransfer', function() {
waitsForAny(downloadWin, downloadFail);
});
+ it("should call the error callback on abort()", function() {
+ var downloadWin = createDoNotCallSpy('downloadWin');
+ var downloadFail = jasmine.createSpy().andCallFake(function(e) { console.log("Abort called") });
+ var remoteFile = 'http://cordova.apache.org/downloads/BlueZedEx.mp3';
+ var localFileName = remoteFile.substring(remoteFile.lastIndexOf('/')+1);
+ var startTime = +new Date();
+
+ this.after(function() {
+ deleteFile(localFileName);
+ });
+ runs(function() {
+ var ft = new FileTransfer();
+ ft.abort(); // should be a no-op.
+ ft.download(remoteFile, root.fullPath + "/" + localFileName, downloadWin, downloadFail);
+ ft.abort();
+ ft.abort(); // should be a no-op.
+ });
+
+ waitsForAny(downloadFail);
+ });
it("should get http status on failure", function() {
var downloadWin = createDoNotCallSpy('downloadWin');
[2/2] spec commit: [CB-1517] [CB-1518] Add spec test for gzip-encoded
resources
Posted by ag...@apache.org.
[CB-1517] [CB-1518] Add spec test for gzip-encoded resources
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/da89eaac
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/da89eaac
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/da89eaac
Branch: refs/heads/master
Commit: da89eaacfdc9625b94a96a3b22a5a50ed309b87e
Parents: 46e478f
Author: Ian Clelland <ic...@chromium.org>
Authored: Wed Mar 20 11:03:28 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Wed Mar 27 16:40:28 2013 -0400
----------------------------------------------------------------------
autotest/tests/filetransfer.tests.js | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/da89eaac/autotest/tests/filetransfer.tests.js
----------------------------------------------------------------------
diff --git a/autotest/tests/filetransfer.tests.js b/autotest/tests/filetransfer.tests.js
index a766879..df1aebd 100644
--- a/autotest/tests/filetransfer.tests.js
+++ b/autotest/tests/filetransfer.tests.js
@@ -391,6 +391,30 @@ describe('FileTransfer', function() {
waitsForAny(downloadWin, downloadFail);
});
+ it("progress should work with gzip encoding", function() {
+ var downloadFail = createDoNotCallSpy('downloadFail');
+ var remoteFile = "http://www.apache.org/";
+ var localFileName = "index.html";
+ var lastProgressEvent = null;
+
+ var downloadWin = jasmine.createSpy().andCallFake(function(entry) {
+ expect(entry.name).toBe(localFileName);
+ expect(lastProgressEvent.loaded).toBeGreaterThan(1, 'loaded');
+ expect(lastProgressEvent.lengthComputable).toBe(true, 'lengthComputable');
+ });
+
+ this.after(function() {
+ deleteFile(localFileName);
+ });
+ runs(function() {
+ var ft = new FileTransfer();
+ ft.onprogress = function(e) {
+ lastProgressEvent = e;
+ };
+ ft.download(remoteFile, root.fullPath + "/" + localFileName, downloadWin, downloadFail);
+ });
+ waitsForAny(downloadWin, downloadFail);
+ });
});
describe('upload method', function() {
it("should be able to upload a file", function() {