You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2012/04/18 23:49:52 UTC

[3/37] spec commit: tweaked all.html test page so that it waits to set up file system properly

tweaked all.html test page so that it waits to set up file system properly


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/commit/8d7e897e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/tree/8d7e897e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/diff/8d7e897e

Branch: refs/heads/master
Commit: 8d7e897e6f2c161154a0ec13ee8b703e9a2b8462
Parents: 15df380
Author: Fil Maj <ma...@gmail.com>
Authored: Tue Apr 17 16:45:24 2012 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Tue Apr 17 16:45:24 2012 -0700

----------------------------------------------------------------------
 autotest/pages/all.html |   39 +++++++++++++++++++++++++++++----------
 1 files changed, 29 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/blob/8d7e897e/autotest/pages/all.html
----------------------------------------------------------------------
diff --git a/autotest/pages/all.html b/autotest/pages/all.html
index b230501..339db4f 100644
--- a/autotest/pages/all.html
+++ b/autotest/pages/all.html
@@ -36,20 +36,39 @@
   <script type="text/javascript" src="../tests/storage.tests.js"></script>
 
   <script type="text/javascript">
-    document.addEventListener('deviceready', function () {
-      var jasmineEnv = jasmine.getEnv();
-      jasmineEnv.updateInterval = 1000;
+      document.addEventListener('deviceready', function () {
+          // one-time retrieval of the root file system entry
+          var onError = function(e) {
+              console.log('[ERROR] Problem setting up root filesystem for test running! Error to follow.');
+              console.log(JSON.stringify(e));
+          };
 
-      var htmlReporter = new jasmine.HtmlReporter();
+          window.requestFileSystem(LocalFileSystem.PERSISTENT, 0,
+              function(fileSystem) {
+                  console.log('File API test Init: Setting PERSISTENT FS.');
+                  root = fileSystem.root; // set in file.tests.js
+                  persistent_root = root;
 
-      jasmineEnv.addReporter(htmlReporter);
+                  // Once root is set up, fire off tests
+                  var jasmineEnv = jasmine.getEnv();
+                  jasmineEnv.updateInterval = 1000;
 
-      jasmineEnv.specFilter = function(spec) {
-        return htmlReporter.specFilter(spec);
-      };
+                  var htmlReporter = new jasmine.HtmlReporter();
 
-      jasmineEnv.execute();
-    }, false);
+                  jasmineEnv.addReporter(htmlReporter);
+
+                  jasmineEnv.specFilter = function(spec) {
+                    return htmlReporter.specFilter(spec);
+                  };
+
+                  jasmineEnv.execute();
+              }, onError);
+          window.requestFileSystem(LocalFileSystem.TEMPORARY, 0,
+              function(fileSystem) {
+                  console.log('File API test Init: Setting TEMPORARY FS.');
+                  temp_root = fileSystem.root; // set in file.tests.js
+              }, onError);
+      }, false);
   </script>
 </head>