cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject spec commit: CB-2331: adding "body" property on FileTransferError object.
Date Fri, 15 Feb 2013 23:02:15 GMT
Updated Branches:
  refs/heads/master 10e1d54d0 -> f86d530fc


CB-2331: adding "body" property on FileTransferError object.


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/f86d530f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/f86d530f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/f86d530f

Branch: refs/heads/master
Commit: f86d530fcedc4c3b783282f307b82656bcb3b1d2
Parents: 10e1d54
Author: Fil Maj <maj.fil@gmail.com>
Authored: Fri Feb 15 15:01:45 2013 -0800
Committer: Fil Maj <maj.fil@gmail.com>
Committed: Fri Feb 15 15:01:45 2013 -0800

----------------------------------------------------------------------
 autotest/tests/filetransfer.tests.js |   27 +++++++++++++++++++++------
 1 files changed, 21 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/f86d530f/autotest/tests/filetransfer.tests.js
----------------------------------------------------------------------
diff --git a/autotest/tests/filetransfer.tests.js b/autotest/tests/filetransfer.tests.js
index d6b4356..ca37f25 100644
--- a/autotest/tests/filetransfer.tests.js
+++ b/autotest/tests/filetransfer.tests.js
@@ -102,15 +102,10 @@ describe('FileTransfer', function() {
     describe('download method', function() {
 
         // NOTE: if download tests are failing, check the white list
-        // Android
+        //
         //   <access origin="httpssss://example.com"/>
         //   <access origin="apache.org" subdomains="true" />
         //   <access origin="cordova-filetransfer.jitsu.com"/>
-        // iOS
-        //   # Cordova.plist
-        //   ExternalHosts
-        //     - Item 1 String cordova-filetransfer.jitsu.com
-        //     - Item 2 String *.apache.org
 
         it("should be able to download a file using http", function() {
             var fail = createDoNotCallSpy('downloadFail');
@@ -256,6 +251,26 @@ describe('FileTransfer', function() {
 
             waitsForAny(downloadWin, downloadFail);
         });
+        it("should get response body on failure", function() {
+            var downloadWin = createDoNotCallSpy('downloadWin');
+
+            var remoteFile = server + "/404";
+            var localFileName = remoteFile.substring(remoteFile.lastIndexOf('/')+1);
+            var downloadFail = jasmine.createSpy().andCallFake(function(error) {
+                expect(error.body).toBeDefined();
+                expect(error.body).toEqual('You requested a 404');
+            });
+
+            this.after(function() {
+                deleteFile(localFileName);
+            });
+            runs(function() {
+                var ft = new FileTransfer();
+                ft.download(remoteFile, root.fullPath + "/" + localFileName, downloadWin,
downloadFail);
+            });
+
+            waitsForAny(downloadWin, downloadFail);
+        });
         it("should handle malformed urls", function() {
             var downloadWin = createDoNotCallSpy('downloadWin');
 


Mime
View raw message