diff --git a/tests/tests.js b/tests/tests.js index 48361c5..bf4cc5a 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -993,9 +993,25 @@ exports.defineManualTests = function (contentEl, createActionButton) { function downloadImg(source, urlFn, element, directory) { var filename = source.substring(source.lastIndexOf("/") + 1); filename = (directory || '') + filename; + function download(fileSystem) { var ft = new FileTransfer(); console.log("Starting download"); + + var progress = document.getElementById("loadingStatus"); + progress.value = 0; + + ft.onprogress = function(progressEvent) { + if (progressEvent.lengthComputable) { + var currPercents = parseInt(100 * (progressEvent.loaded / progressEvent.total), 10); + if (currPercents > progress.value) { + progress.value = currPercents; + } + } else { + progress.value = null; + } + }; + ft.download(source, fileSystem.root.toURL() + filename, function (entry) { console.log("Download complete"); element.src = urlFn(entry); @@ -1032,6 +1048,7 @@ exports.defineManualTests = function (contentEl, createActionButton) { /******************************************************************************/ + var progress_tag = ''; var file_transfer_tests = '