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 2012/09/21 05:37:19 UTC

[1/2] spec commit: Fix up deleteFile() so that it never fails.

Updated Branches:
  refs/heads/master 80e69c2e5 -> e134e02e5


Fix up deleteFile() so that it never fails.

And also so that tests wait for it before continuing to the next one.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/commit/e134e02e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/tree/e134e02e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/diff/e134e02e

Branch: refs/heads/master
Commit: e134e02e5c2263b435df8968fa3dceee24b8fbd2
Parents: 6ac22a5
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Sep 20 23:35:58 2012 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Sep 20 23:35:58 2012 -0400

----------------------------------------------------------------------
 autotest/tests/filetransfer.tests.js |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/blob/e134e02e/autotest/tests/filetransfer.tests.js
----------------------------------------------------------------------
diff --git a/autotest/tests/filetransfer.tests.js b/autotest/tests/filetransfer.tests.js
index 22c4f40..2ea20b7 100644
--- a/autotest/tests/filetransfer.tests.js
+++ b/autotest/tests/filetransfer.tests.js
@@ -94,18 +94,18 @@ describe('FileTransfer', function() {
         }
     };
 
-    // NOTE: copied from file.tests.js
     // deletes file, if it exists, then invokes callback
     var deleteFile = function(fileName, callback) {
+        var spy = jasmine.createSpy().andCallFake(callback);
         root.getFile(fileName, null,
             // remove file system entry
             function(entry) {
-                entry.remove(callback, function() { expect(true).toBe(false, 'deleteFile cleanup method invoked fail callback. File: ' + fileName); });
+                entry.remove(spy, spy);
             },
             // doesn't exist
-            callback);
+            spy);
+        waitsFor(function() { return spy.wasCalled; }, Tests.TEST_TIMEOUT);
     };
-    // end copied from file.tests.js
 
     it("should exist and be constructable", function() {
         var ft = new FileTransfer();
@@ -326,7 +326,7 @@ describe('FileTransfer', function() {
         });
         it("should be stopped by abort() right away.", function() {
             var remoteFile = server + "/upload";
-            var localFileName = "upload2.txt";
+            var localFileName = "upload.txt";
 
             var fileFail = createDoNotCallSpy('fileFail');
             var uploadWin = createDoNotCallSpy('uploadWin', 'Should have been aborted');