You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2012/11/01 23:09:19 UTC

[36/58] [abbrv] git commit: fixes File Api unit tests issue

fixes File Api unit tests issue


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp8/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp8/commit/ce62f8fe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp8/tree/ce62f8fe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp8/diff/ce62f8fe

Branch: refs/heads/master
Commit: ce62f8fe8bd3b17e06df8222cd5875e1da83b838
Parents: 18bacb6
Author: sgrebnov <se...@gmail.com>
Authored: Tue Oct 23 15:33:23 2012 +0400
Committer: sgrebnov <se...@gmail.com>
Committed: Tue Oct 23 15:33:23 2012 +0400

----------------------------------------------------------------------
 templates/standalone/cordovalib/Commands/File.cs   |    4 +-
 templates/standalone/cordovalib/NativeExecution.cs |   21 ++++++++++----
 tests/MobileSpecUnitTests/www/cordova-2.1.0.js     |    6 +---
 3 files changed, 19 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp8/blob/ce62f8fe/templates/standalone/cordovalib/Commands/File.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/cordovalib/Commands/File.cs b/templates/standalone/cordovalib/Commands/File.cs
index 06bf638..a27d8e8 100644
--- a/templates/standalone/cordovalib/Commands/File.cs
+++ b/templates/standalone/cordovalib/Commands/File.cs
@@ -348,11 +348,11 @@ namespace WPCordovaClassLib.Cordova.Commands
 
                     try
                     {
-                        this.FullPath = filePath;// new Uri(filePath).LocalPath;
+                        this.FullPath = filePath.Replace('\\', '/'); // new Uri(filePath).LocalPath;
                     }
                     catch (Exception)
                     {
-                          
+                        this.FullPath = filePath;
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp8/blob/ce62f8fe/templates/standalone/cordovalib/NativeExecution.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/cordovalib/NativeExecution.cs b/templates/standalone/cordovalib/NativeExecution.cs
index 2e8fb6b..ffa49a5 100644
--- a/templates/standalone/cordovalib/NativeExecution.cs
+++ b/templates/standalone/cordovalib/NativeExecution.cs
@@ -93,11 +93,9 @@ namespace WPCordovaClassLib.Cordova
 
                 bc.OnCustomScript += OnCustomScriptHandler;
 
-                // TODO: alternative way is using thread pool (ThreadPool.QueueUserWorkItem) instead of 
-                // new thread for every command call; but num threads are not sufficient - 2 threads per CPU core
-
-                Thread thread = new Thread(func =>
+                ThreadStart methodInvokation = () =>
                 {
+
                     try
                     {
                         bc.InvokeMethodNamed(commandCallParams.Action, commandCallParams.Args);
@@ -114,9 +112,20 @@ namespace WPCordovaClassLib.Cordova
 
                         return;
                     }
-                });
+                };
+
+                if (bc is File)
+                {
+                    // Due to some issues with the IsolatedStorage in current version of WP8 SDK we have to run all File Api commands synchronously.
+                    // TODO: test this in WP8 RTM
+                    methodInvokation.Invoke();
+                }
+                else
+                {
+                    new Thread(methodInvokation).Start();
+                }
 
-                thread.Start();
+                    
             }
             catch (Exception ex)
             {

http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp8/blob/ce62f8fe/tests/MobileSpecUnitTests/www/cordova-2.1.0.js
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/cordova-2.1.0.js b/tests/MobileSpecUnitTests/www/cordova-2.1.0.js
index b615867..a4c1c83 100644
--- a/tests/MobileSpecUnitTests/www/cordova-2.1.0.js
+++ b/tests/MobileSpecUnitTests/www/cordova-2.1.0.js
@@ -1,6 +1,6 @@
 // commit 4a0b4a4a54a684414690147295ffae61eae24b71
 
-// File generated at :: Thu Oct 18 2012 14:08:34 GMT+0400 (Russian Standard Time)
+// File generated at :: Tue Oct 23 2012 15:10:24 GMT+0400 (Russian Standard Time)
 
 /*
  Licensed to the Apache Software Foundation (ASF) under one
@@ -983,6 +983,7 @@ module.exports = {
     initialize:function() {
         window.alert = require("cordova/plugin/notification").alert;
         window.FileReader = require("cordova/plugin/FileReader");
+        window.File = require("cordova/plugin/File");
 
         // Inject a listener for the backbutton, and tell native to override the flag (true/false) when we have 1 or more, or 0, listeners
         var backButtonChannel = cordova.addDocumentEventHandler('backbutton');
@@ -2093,9 +2094,6 @@ Entry.prototype.remove = function(successCallback, errorCallback) {
     var fail = typeof errorCallback !== 'function' ? null : function(code) {
         errorCallback(new FileError(code));
     };
-
-	console.log('remove entry (js): ' + JSON.stringify(this));
-
     exec(successCallback, fail, "File", "remove", [this.fullPath]);
 };