Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B00FC10ADD for ; Fri, 23 Jan 2015 20:19:18 +0000 (UTC) Received: (qmail 78055 invoked by uid 500); 23 Jan 2015 20:19:18 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 77865 invoked by uid 500); 23 Jan 2015 20:19:18 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 77617 invoked by uid 99); 23 Jan 2015 20:19:18 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Jan 2015 20:19:18 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 254F5E0D4A; Fri, 23 Jan 2015 20:19:18 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: purplecabbage@apache.org To: commits@cordova.apache.org Date: Fri, 23 Jan 2015 20:19:25 -0000 Message-Id: <81f74384f811419eb2ece38c90acb159@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [08/12] cordova-plugin-file git commit: Added tests for windows 8. Made URL checks use windows specific URL scheme. Fixed indentation. Added tests for windows 8. Made URL checks use windows specific URL scheme. Fixed indentation. Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/6550791b Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/6550791b Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/6550791b Branch: refs/heads/master Commit: 6550791b9ca1408e2f744fa73404f2e3c7c32a9a Parents: 42c80e5 Author: Vladimir Avdonin Authored: Fri Dec 5 07:27:56 2014 -0600 Committer: Vladimir Avdonin Committed: Thu Jan 22 22:24:28 2015 -0600 ---------------------------------------------------------------------- tests/tests.js | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/6550791b/tests/tests.js ---------------------------------------------------------------------- diff --git a/tests/tests.js b/tests/tests.js index 5f6293e..c56d60e 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -2674,18 +2674,18 @@ exports.defineAutoTests = function () { var fileName = "resolve.file.uri"; var dirName = "resolve.dir.uri"; // create a new file entry - createDirectory(dirName, function () { - createFile(dirName+"/../" + fileName, function (entry) { - // lookup file system entry - window.resolveLocalFileSystemURL(entry.toURL(), function (fileEntry) { - expect(fileEntry).toBeDefined(); - expect(fileEntry.name).toCanonicallyMatch(fileName); - // cleanup - deleteEntry(fileName); - done(); - }, failed.bind(null, done, 'window.resolveLocalFileSystemURL - Error resolving URI: ' + entry.toURL())); - }, failed.bind(null, done, 'createFile - Error creating file: ../' + fileName)); - }, failed.bind(null, done, 'createDirectory - Error creating directory: ' + dirName)); + createDirectory(dirName, function () { + createFile(dirName+"/../" + fileName, function (entry) { + // lookup file system entry + window.resolveLocalFileSystemURL(entry.toURL(), function (fileEntry) { + expect(fileEntry).toBeDefined(); + expect(fileEntry.name).toCanonicallyMatch(fileName); + // cleanup + deleteEntry(fileName); + done(); + }, failed.bind(null, done, 'window.resolveLocalFileSystemURL - Error resolving URI: ' + entry.toURL())); + }, failed.bind(null, done, 'createFile - Error creating file: ../' + fileName)); + }, failed.bind(null, done, 'createDirectory - Error creating directory: ' + dirName)); }); it("file.spec.111 should not traverse above above the root directory", function (done) { var fileName = "traverse.file.uri"; @@ -2696,8 +2696,8 @@ exports.defineAutoTests = function () { create : false }, succeed.bind(null, done, "root.getFile('../"+fileName+ "')- Unexpected success callback, it should not traverse abvoe the root directory"), function (error) { - expect(error).toBeDefined(); - done(); + expect(error).toBeDefined(); + done(); }); }, failed.bind(null, done, 'createFile - Error creating file: ../' + fileName)); }); @@ -2729,10 +2729,10 @@ exports.defineAutoTests = function () { create : false }, succeed.bind(null, done, 'root.getFile - Unexpected success callback, it should not locate nonexistent file: ' + fileName), function (error) { expect(error).toBeDefined(); - if (cordova.platformId == "windows") - expect(error).toBeFileError(FileError.SECURITY_ERR); + if (cordova.platformId == "windows8" || cordova.platformId == "windows") + expect(error).toBeFileError(FileError.SECURITY_ERR); else - expect(error).toBeFileError(FileError.NOT_FOUND_ERR); + expect(error).toBeFileError(FileError.NOT_FOUND_ERR); done(); }); }); @@ -2742,7 +2742,10 @@ exports.defineAutoTests = function () { /* These specs verify that FileEntries have a toNativeURL method * which appears to be sane. */ - var pathExpect = cordova.platformId === 'windowsphone' ? "//nativ" : "file://"; + var pathExpect = cordova.platformId === 'windowsphone' ? "//nativ" : + (cordova.platformId == "windows8" || cordova.platformId == "windows")? + "ms-appdata:/": + "file://"; it("file.spec.114 fileEntry should have a toNativeURL method", function (done) { var fileName = "native.file.uri"; if (isWindows) { @@ -2757,8 +2760,7 @@ exports.defineAutoTests = function () { var nativeURL = entry.toNativeURL(); var indexOfRoot = isWindows ? rootPath.indexOf(":") : 7; expect(typeof nativeURL).toBe("string"); - if (cordova.platformId != "windows") - expect(nativeURL.substring(0, 7)).toEqual(pathExpect); + expect(nativeURL.substring(0, pathExpect.length)).toEqual(pathExpect); expect(nativeURL.substring(nativeURL.length - fileName.length)).toEqual(fileName); // cleanup deleteEntry(fileName); @@ -2777,8 +2779,7 @@ exports.defineAutoTests = function () { var nativeURL = entries[0].toNativeURL(); var indexOfRoot = (isWindows) ? nativeURL.indexOf(":") : 7; expect(typeof nativeURL).toBe("string"); - if (cordova.platformId != "windows") - expect(nativeURL.substring(0, 7)).toEqual(pathExpect); + expect(nativeURL.substring(0, pathExpect.length)).toEqual(pathExpect); expect(nativeURL.substring(nativeURL.length - fileName.length)).toEqual(fileName); // cleanup directory.removeRecursively(null, null); @@ -2807,8 +2808,7 @@ exports.defineAutoTests = function () { var nativeURL = entry.toNativeURL(); var indexOfRoot = (isWindows) ? nativeURL.indexOf(":") : 7; expect(typeof nativeURL).toBe("string"); - if (cordova.platformId != "windows") - expect(nativeURL.substring(0, 7)).toEqual(pathExpect); + expect(nativeURL.substring(0, pathExpect.length)).toEqual(pathExpect); expect(nativeURL.substring(nativeURL.length - fileName.length)).toEqual(fileName); // cleanup deleteEntry(fileName); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org For additional commands, e-mail: commits-help@cordova.apache.org