CB-10536: Removing flaky test assertions about abort callback latency

This closes #137


Project: 
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/commit/b66cb2ec
Tree: 
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/tree/b66cb2ec
Diff: 
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/diff/b66cb2ec

Branch: refs/heads/1.5.x
Commit: b66cb2ec6a9666798316a7b471a817982b91bc42
Parents: c48fc02
Author: Richard Knoll <[email protected]>
Authored: Mon Apr 4 17:44:46 2016 -0700
Committer: Richard Knoll <[email protected]>
Committed: Tue Apr 5 12:05:55 2016 -0700

----------------------------------------------------------------------
 tests/tests.js | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/blob/b66cb2ec/tests/tests.js
----------------------------------------------------------------------
diff --git a/tests/tests.js b/tests/tests.js
index 0bdf58d..42fc680 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -31,7 +31,6 @@ exports.defineAutoTests = function () {
     var ONE_SECOND = 1000; // in milliseconds
     var GRACE_TIME_DELTA = 600; // in milliseconds
     var DEFAULT_FILESYSTEM_SIZE = 1024 * 50; // filesystem size in bytes
-    var WINDOWS_GRACE_TIME_DELTA = 5 * ONE_SECOND; // Some Windows devices 
need a few seconds to create an upload/download operation.
     var UNKNOWN_HOST = "http://foobar.apache.org";;
     var HEADERS_ECHO = "http://whatheaders.com";; // NOTE: this site is very 
useful!
     var DOWNLOAD_TIMEOUT = 7 * ONE_SECOND;
@@ -545,7 +544,7 @@ exports.defineAutoTests = function () {
                     specContext.transfer.download(fileURL, 
specContext.localFilePath, downloadWin, downloadFail);
                 }, DOWNLOAD_TIMEOUT);
 
-                it("filetransfer.spec.10 should be stopped by abort() right 
away", function (done) {
+                it("filetransfer.spec.10 should be stopped by abort()", 
function (done) {
 
                     var fileURL = 
"http://cordova.apache.org/downloads/BlueZedEx.mp3";;
                     fileURL = fileURL + "?q=" + (new Date()).getTime();
@@ -553,8 +552,6 @@ exports.defineAutoTests = function () {
 
                     expect(specContext.transfer.abort).not.toThrow(); // 
should be a no-op.
 
-                    var startTime = +new Date();
-
                     var downloadWin = function() {
                         unexpectedCallbacks.httpWin();
                         done();
@@ -563,7 +560,6 @@ exports.defineAutoTests = function () {
                     var downloadFail = function (error) {
 
                         expect(error.code).toBe(FileTransferError.ABORT_ERR);
-                        expect(new Date() - startTime).toBeLessThan(isWindows 
? WINDOWS_GRACE_TIME_DELTA : GRACE_TIME_DELTA);
 
                         // delay calling done() to wait for the bogus abort()
                         setTimeout(done, GRACE_TIME_DELTA * 2);
@@ -1045,15 +1041,13 @@ exports.defineAutoTests = function () {
                     specContext.transfer.upload(specContext.localFilePath, 
fileURL, uploadWin, uploadFail, specContext.uploadOptions);
                 }, UPLOAD_TIMEOUT);
 
-                it("filetransfer.spec.21 should be stopped by abort() right 
away", function (done) {
+                it("filetransfer.spec.21 should be stopped by abort()", 
function (done) {
 
                     var fileURL = SERVER + "/upload";
-                    var startTime;
                     var specContext = this;
 
                     var uploadFail = function (e) {
                         expect(e.code).toBe(FileTransferError.ABORT_ERR);
-                        expect(new Date() - startTime).toBeLessThan(isWindows 
? WINDOWS_GRACE_TIME_DELTA : GRACE_TIME_DELTA);
 
                         // delay calling done() to wait for the bogus abort()
                         setTimeout(done, GRACE_TIME_DELTA * 2);
@@ -1066,8 +1060,6 @@ exports.defineAutoTests = function () {
 
                     var fileWin = function () {
 
-                        startTime = +new Date();
-
                         expect(specContext.transfer.abort).not.toThrow();
 
                         // NOTE: removing uploadOptions cause Android to 
timeout


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to