cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lorinb...@apache.org
Subject [02/12] spec commit: [CB-2226] Add spec test for FileTransfer.abort error callback
Date Tue, 02 Apr 2013 15:44:34 GMT
[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/2.6.x
Commit: 46e478f306f6aae8d550ef8d688329b14bd6a2fa
Parents: dbf631c
Author: Ian Clelland <iclelland@chromium.org>
Authored: Mon Mar 18 16:21:02 2013 -0400
Committer: Andrew Grieve <agrieve@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');
 


Mime
View raw message