You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2016/07/07 13:35:19 UTC
cordova-plugin-file-transfer git commit: CB-11497 Use cordova-vm for
testing 304 errors
Repository: cordova-plugin-file-transfer
Updated Branches:
refs/heads/master 134dde5f9 -> 855def11c
CB-11497 Use cordova-vm for testing 304 errors
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/855def11
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/tree/855def11
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/diff/855def11
Branch: refs/heads/master
Commit: 855def11c3c35df6f9de10ccca46e7336baa2506
Parents: 134dde5
Author: Vladimir Kotikov <ko...@gmail.com>
Authored: Thu Jul 7 14:39:30 2016 +0300
Committer: Vladimir Kotikov <ko...@gmail.com>
Committed: Thu Jul 7 14:39:30 2016 +0300
----------------------------------------------------------------------
tests/tests.js | 32 +++++---------------------------
1 file changed, 5 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/blob/855def11/tests/tests.js
----------------------------------------------------------------------
diff --git a/tests/tests.js b/tests/tests.js
index d3dc4c7..58a2ef2 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -784,9 +784,6 @@ exports.defineAutoTests = function () {
return;
}
- var imageURL = "http://apache.org/images/feather-small.gif";
- var lastModified = new Date();
-
var downloadFail = function (error) {
expect(error.http_status).toBe(304);
expect(error.code).toBe(FileTransferError.NOT_MODIFIED_ERR);
@@ -798,12 +795,7 @@ exports.defineAutoTests = function () {
done();
};
- this.transfer.download(imageURL + "?q=" + lastModified.getTime(), this.localFilePath, downloadWin, downloadFail, null,
- {
- headers: {
- "If-Modified-Since": lastModified.toUTCString()
- }
- });
+ this.transfer.download(SERVER + '/304', this.localFilePath, downloadWin, downloadFail);
}, DOWNLOAD_TIMEOUT);
it("filetransfer.spec.35 304 should not result in the deletion of a cached file", function (done) {
@@ -813,8 +805,6 @@ exports.defineAutoTests = function () {
return;
}
- var imageURL = "http://apache.org/images/feather-small.gif";
- var lastModified = new Date();
var specContext = this;
var fileOperationFail = function() {
@@ -832,11 +822,6 @@ exports.defineAutoTests = function () {
done();
};
- var httpFail = function() {
- unexpectedCallbacks.httpFail();
- done();
- };
-
var downloadFail = function (error) {
expect(error.http_status).toBe(304);
expect(error.code).toBe(FileTransferError.NOT_MODIFIED_ERR);
@@ -869,17 +854,10 @@ exports.defineAutoTests = function () {
);
};
- // Adding parameters to the requests to avoid caching on iOS, which leads to 200
- // instead of 304 in result of the second request. (a similar issue is described in CB-8606, CB-10088)
- specContext.transfer.download(imageURL + "?q=" + lastModified.getTime(), specContext.localFilePath, function () {
- specContext.transfer.download(imageURL + "?q=" + (lastModified.getTime() + 1), specContext.localFilePath, httpWin, downloadFail, null,
- {
- headers: {
- "If-Modified-Since": lastModified.toUTCString()
- }
- });
- }, httpFail);
- }, DOWNLOAD_TIMEOUT * 2);
+ writeFile(specContext.root, specContext.fileName, 'Temp data', function () {
+ specContext.transfer.download(SERVER + '/304', specContext.localFilePath, httpWin, downloadFail);
+ }, fileOperationFail);
+ }, DOWNLOAD_TIMEOUT);
it("filetransfer.spec.36 should handle non-UTF8 encoded download response", function (done) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org