mirror of
https://github.com/apache/cordova-plugin-file-transfer.git
synced 2024-10-06 07:42:20 +08:00
CB-10536: Removing flaky test assertions about abort callback latency
This closes #137
This commit is contained in:
parent
c48fc02d7e
commit
b66cb2ec6a
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user