cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an-s...@apache.org
Subject cordova-plugin-file git commit: CB-9539 Fixed test failure on Android emulator
Date Mon, 24 Aug 2015 12:36:25 GMT
Repository: cordova-plugin-file
Updated Branches:
  refs/heads/master aa83df737 -> c452f1a67


CB-9539 Fixed test failure on Android emulator


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/c452f1a6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/c452f1a6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/c452f1a6

Branch: refs/heads/master
Commit: c452f1a67f41cb1165c92555f0e721fbb07329cc
Parents: aa83df7
Author: alsorokin <alexander.sorokin@akvelon.com>
Authored: Fri Aug 21 12:18:38 2015 +0300
Committer: alsorokin <alexander.sorokin@akvelon.com>
Committed: Mon Aug 24 14:22:41 2015 +0300

----------------------------------------------------------------------
 tests/plugin.xml                             |  1 +
 tests/tests.js                               | 15 +++++++++------
 tests/www/fixtures/asset-test/asset-test.txt |  1 +
 3 files changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/c452f1a6/tests/plugin.xml
----------------------------------------------------------------------
diff --git a/tests/plugin.xml b/tests/plugin.xml
index 45d69fc..1a148fc 100644
--- a/tests/plugin.xml
+++ b/tests/plugin.xml
@@ -38,5 +38,6 @@
                 android:authorities="org.apache.cordova.file.testprovider"
                 android:exported="false" />
         </config-file>
+        <asset src="www/fixtures/asset-test" target="fixtures/asset-test" />
     </platform>
 </plugin>

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/c452f1a6/tests/tests.js
----------------------------------------------------------------------
diff --git a/tests/tests.js b/tests/tests.js
index 921ec10..2d222d5 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -32,7 +32,6 @@ exports.defineAutoTests = function () {
     var isWindows = (cordova.platformId === "windows" || cordova.platformId === "windows8");
     
     var MEDIUM_TIMEOUT = 15000;
-    var LONG_TIMEOUT = 60000;
 
     describe('File API', function () {
         // Adding a Jasmine helper matcher, to report errors when comparing to FileError
better.
@@ -3484,19 +3483,23 @@ exports.defineAutoTests = function () {
                     }, failed.bind(null, done, 'resolveLocalFileSystemURL failed for content
provider'));
                 });
             });
+
+            // these tests ensure that you can read and copy from android_asset folder
+            // for details see https://issues.apache.org/jira/browse/CB-6428
+            // and https://mail-archives.apache.org/mod_mbox/cordova-dev/201508.mbox/%3C782154441.8406572.1440182722528.JavaMail.yahoo%40mail.yahoo.com%3E
             describe('asset: URLs', function() {
                 it("file.spec.141 filePaths.applicationStorage", function() {
                     expect(cordova.file.applicationDirectory).toEqual('file:///android_asset/');
                 }, MEDIUM_TIMEOUT);
                 it("file.spec.142 assets should be enumerable", function(done) {
-                    resolveLocalFileSystemURL('file:///android_asset/www/', function(entry)
{
+                    resolveLocalFileSystemURL('file:///android_asset/www/fixtures/asset-test',
function(entry) {
                         var reader = entry.createReader();
                         reader.readEntries(function (entries) {
                             expect(entries.length).not.toBe(0);
                             done();
                         }, failed.bind(null, done, 'reader.readEntries - Error during reading
of entries from assets directory'));
                     }, failed.bind(null, done, 'resolveLocalFileSystemURL failed for assets'));
-                }, LONG_TIMEOUT);
+                }, MEDIUM_TIMEOUT);
                 it("file.spec.143 copyTo: asset -> temporary", function(done) {
                     var file2 = "entry.copy.file2b",
                     fullPath = joinURL(temp_root.fullPath, file2),
@@ -3522,7 +3525,7 @@ exports.defineAutoTests = function () {
                 }, MEDIUM_TIMEOUT);
             });
             it("file.spec.144 copyTo: asset directory", function (done) {
-                var srcUrl = 'file:///android_asset/www';
+                var srcUrl = 'file:///android_asset/www/fixtures/asset-test';
                 var dstDir = "entry.copy.dstDir";
                 var dstPath = joinURL(root.fullPath, dstDir);
                 // create a new directory entry to kick off it
@@ -3542,7 +3545,7 @@ exports.defineAutoTests = function () {
                                 expect(dirEntry.isDirectory).toBe(true);
                                 expect(dirEntry.fullPath).toCanonicallyMatch(dstPath);
                                 expect(dirEntry.name).toCanonicallyMatch(dstDir);
-                                dirEntry.getFile('cordova.js', {
+                                dirEntry.getFile('asset-test.txt', {
                                     create : false
                                 }, function (fileEntry) {
                                     expect(fileEntry).toBeDefined();
@@ -3554,7 +3557,7 @@ exports.defineAutoTests = function () {
                         }, failed.bind(null, done, 'directory.copyTo - Error copying directory'));
                     }, failed.bind(null, done, 'resolving src dir'));
                 }, failed.bind(null, done, 'deleteEntry - Error removing directory : ' +
dstDir));
-            }, LONG_TIMEOUT);
+            }, MEDIUM_TIMEOUT);
         }
     });
 

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/c452f1a6/tests/www/fixtures/asset-test/asset-test.txt
----------------------------------------------------------------------
diff --git a/tests/www/fixtures/asset-test/asset-test.txt b/tests/www/fixtures/asset-test/asset-test.txt
new file mode 100644
index 0000000..2ee2df0
--- /dev/null
+++ b/tests/www/fixtures/asset-test/asset-test.txt
@@ -0,0 +1 @@
+This file is here for testing purposes
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message