CB-11709 Tests should use resolveLocalFileSystemURL() instead of deprecated resolveFileSystemURI()

This commit is contained in:
Alexander Sorokin 2016-08-16 19:19:22 +03:00
parent 92d67d990d
commit 62d1b01e81
2 changed files with 9 additions and 9 deletions

View File

@ -1,5 +1,5 @@
/*jshint node: true */ /*jshint node: true */
/* global Q, resolveLocalFileSystemURI, Camera, cordova */ /* global Q, resolveLocalFileSystemURL, Camera, cordova */
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
@ -174,11 +174,11 @@ module.exports.checkPicture = function (pid, options, cb) {
result.indexOf('content:') === 0 || result.indexOf('content:') === 0 ||
result.indexOf('assets-library:') === 0) { result.indexOf('assets-library:') === 0) {
if (!window.resolveLocalFileSystemURI) { if (!window.resolveLocalFileSystemURL) {
errorCallback('Cannot read file. Please install cordova-plugin-file to fix this.'); errorCallback('Cannot read file. Please install cordova-plugin-file to fix this.');
return; return;
} }
resolveLocalFileSystemURI(result, function (entry) { resolveLocalFileSystemURL(result, function (entry) {
if (skipFileTypeCheck) { if (skipFileTypeCheck) {
displayFile(entry); displayFile(entry);
} else { } else {

View File

@ -19,7 +19,7 @@
* *
*/ */
/* globals Camera, resolveLocalFileSystemURI, FileEntry, CameraPopoverOptions, FileTransfer, FileUploadOptions, LocalFileSystem, MSApp */ /* globals Camera, resolveLocalFileSystemURL, FileEntry, CameraPopoverOptions, FileTransfer, FileUploadOptions, LocalFileSystem, MSApp */
/* jshint jasmine: true */ /* jshint jasmine: true */
exports.defineAutoTests = function () { exports.defineAutoTests = function () {
@ -142,11 +142,11 @@ exports.defineManualTests = function (contentEl, createActionButton) {
setPicture(data); setPicture(data);
// TODO: Fix resolveLocalFileSystemURI to work with native-uri. // TODO: Fix resolveLocalFileSystemURI to work with native-uri.
if (pictureUrl.indexOf('file:') === 0 || pictureUrl.indexOf('content:') === 0 || pictureUrl.indexOf('ms-appdata:') === 0 || pictureUrl.indexOf('assets-library:') === 0) { if (pictureUrl.indexOf('file:') === 0 || pictureUrl.indexOf('content:') === 0 || pictureUrl.indexOf('ms-appdata:') === 0 || pictureUrl.indexOf('assets-library:') === 0) {
resolveLocalFileSystemURI(data, function (e) { resolveLocalFileSystemURL(data, function (e) {
fileEntry = e; fileEntry = e;
logCallback('resolveLocalFileSystemURI()', true)(e.toURL()); logCallback('resolveLocalFileSystemURL()', true)(e.toURL());
readFile(); readFile();
}, logCallback('resolveLocalFileSystemURI()', false)); }, logCallback('resolveLocalFileSystemURL()', false));
} else if (pictureUrl.indexOf('data:image/jpeg;base64') === 0) { } else if (pictureUrl.indexOf('data:image/jpeg;base64') === 0) {
// do nothing // do nothing
} else { } else {
@ -251,7 +251,7 @@ exports.defineManualTests = function (contentEl, createActionButton) {
//cleanup //cleanup
//rename moved file back to original name so other tests can reference image //rename moved file back to original name so other tests can reference image
resolveLocalFileSystemURI(destDirEntry.nativeURL+'moved_file.png', function(fileEntry) { resolveLocalFileSystemURL(destDirEntry.nativeURL+'moved_file.png', function(fileEntry) {
fileEntry.moveTo(destDirEntry, origName, logCallback('FileEntry.moveTo', true), logCallback('FileEntry.moveTo', false)); fileEntry.moveTo(destDirEntry, origName, logCallback('FileEntry.moveTo', true), logCallback('FileEntry.moveTo', false));
console.log('Cleanup: successfully renamed file back to original name'); console.log('Cleanup: successfully renamed file back to original name');
}, function () { }, function () {
@ -259,7 +259,7 @@ exports.defineManualTests = function (contentEl, createActionButton) {
}); });
//remove copied file //remove copied file
resolveLocalFileSystemURI(destDirEntry.nativeURL+'copied_file.png', function(fileEntry) { resolveLocalFileSystemURL(destDirEntry.nativeURL+'copied_file.png', function(fileEntry) {
fileEntry.remove(logCallback('FileEntry.remove', true), logCallback('FileEntry.remove', false)); fileEntry.remove(logCallback('FileEntry.remove', true), logCallback('FileEntry.remove', false));
console.log('Cleanup: successfully removed copied file'); console.log('Cleanup: successfully removed copied file');
}, function () { }, function () {